2018-04-03 19:23:33 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-10 17:26:59 +08:00
|
|
|
|
2022-10-19 10:51:00 -04:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-12 13:04:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-12 13:04:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2015-12-15 01:42:10 +09:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2022-09-16 15:28:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2022-09-16 15:28:35 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-18 14:06:55 +01:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-15 09:22:56 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-15 09:22:56 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-15 09:22:56 -04:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2022-09-19 15:06:29 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2022-09-16 15:28:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2022-09-16 15:28:35 +08:00
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
btrfs: tests: remove invalid file extent map tests
In the inode self tests, there are several problems:
- Invalid file extents
E.g. hole range [4K, 4K + 4) is completely invalid.
Only inlined extent maps can have an unaligned ram_bytes, and even for
that case, the generated extent map will use sectorsize as em->len.
- Unaligned hole after inlined extent
The kernel never does this by itself, the current btrfs_get_extent()
will only return a single inlined extent map that covers the first
block.
- Incorrect numbers in the comment
E.g. 12291 no matter if you add or dec 1, is not aligned to 4K.
The properly number for 12K is 12288, I don't know why there is even a
diff of 3, and this completely doesn't match the extent map we
inserted later.
- Hard-to-modify sequence in setup_file_extents()
If some unfortunate person, just like me, needs to modify
setup_file_extents(), good luck not screwing up the file offset.
Fix them by:
- Remove invalid unaligned extent maps
This mostly means remove the [4K, 4K + 4) hole case.
The remaining ones are already properly aligned.
This slightly changes the on-disk data extent allocation, with that
removed, the regular extents at [4K, 8K) and [8K , 12K) can be merged.
So also add a 4K gap between those two data extents to prevent em
merge.
- Remove the implied hole after an inlined extent
Just like what the kernel is doing for inlined extents in the real
world.
- Update the commit using proper numbers with 'K' suffixes
Since there is no unaligned range except the first inlined one, we can
always use numbers with 'K' suffixes, which is way more easier to read,
and will always be aligned to 1024 at least.
- Add comments in setup_file_extents()
So that we're clear about the file offset for each test file extent.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-01-22 09:37:58 +10:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:41:15 +01:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2025-04-08 16:41:15 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:41:15 +01:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2025-04-08 16:41:15 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:41:15 +01:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2025-04-08 16:41:15 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2026-01-16 10:57:00 +00:00
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:04 +09:30
|
|
|
|
|
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2014-05-07 17:06:09 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-18 14:06:55 +01:00
|
|
|
|
|
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-15 09:22:56 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-15 09:22:56 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-15 09:22:56 -04:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
2024-04-30 07:53:06 +09:30
|
|
|
|
|
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
2024-01-08 13:50:20 +10:30
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
2025-04-08 16:52:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-08 17:13:12 +01:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
2014-05-07 17:06:09 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-18 14:06:55 +01:00
|
|
|
|
|
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-15 09:22:56 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-15 09:22:56 -04:00
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2019-03-15 17:28:46 +01:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-03 08:55:35 +03:00
|
|
|
|
|
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2020-06-03 08:55:35 +03:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2019-07-17 16:18:17 +03:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2025-07-11 09:46:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2020-06-03 08:55:35 +03:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2019-07-17 16:18:17 +03:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2020-06-03 08:55:35 +03:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
2019-07-17 16:18:17 +03:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-03 08:55:35 +03:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2019-07-17 16:18:17 +03:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-11 09:46:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-03 08:55:35 +03:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2019-07-17 16:18:17 +03:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-11 09:46:16 +01:00
|
|
|
|
|
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-17 00:00:42 +02:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-11 09:46:16 +01:00
|
|
|
|
|
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
2016-06-20 14:14:09 -04:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
2019-03-18 14:06:55 +01:00
|
|
|
|
|
|
|
|
|
btrfs: use the flags of an extent map to identify the compression type
Currently, in struct extent_map, we use an unsigned int (32 bits) to
identify the compression type of an extent and an unsigned long (64 bits
on a 64 bits platform, 32 bits otherwise) for flags. We are only using
6 different flags, so an unsigned long is excessive and we can use flags
to identify the compression type instead of using a dedicated 32 bits
field.
We can easily have tens or hundreds of thousands (or more) of extent maps
on busy and large filesystems, specially with compression enabled or many
or large files with tons of small extents. So it's convenient to have the
extent_map structure as small as possible in order to use less memory.
So remove the compression type field from struct extent_map, use flags
to identify the compression type and shorten the flags field from an
unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
reduces the size of the structure from 136 bytes down to 128 bytes, using
now only two cache lines, and increases the number of extent maps we can
have per 4K page from 30 to 32. By using a u32 for the flags instead of
an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
but that level of atomicity is not needed as most flags are never cleared
once set (before adding an extent map to the tree), and the ones that can
be cleared or set after an extent map is added to the tree, are always
performed while holding the write lock on the extent map tree, while the
reader holds a lock on the tree or tests for a flag that never changes
once the extent map is in the tree (such as compression flags).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-04 16:20:33 +00:00
|
|
|
|
|
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-14 13:15:02 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2015-03-16 17:38:52 -04:00
|
|
|
|
|
|
|
|
|
2016-06-01 19:18:25 +08:00
|
|
|
|
2013-10-11 14:44:09 -04:00
|
|
|
|