* [PATCH] e2fsprogs: modify dumpe2fs to report free block ranges for bigalloc
@ 2023-07-21 18:55 Eric Whitney
2023-08-17 14:47 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Eric Whitney @ 2023-07-21 18:55 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, Eric Whitney
dumpe2fs has never been modified to correctly report block ranges
corresponding to free clusters in block allocation bitmaps from bigalloc
file systems. Rather than reporting block ranges covering all the
blocks in free clusters found in a block bitmap, it either reports just
the first block number in a cluster for a single free cluster, or a
range beginning with the first block number in the first cluster in a
series of free clusters, and ending with the first block number in the
last cluster in that series.
This behavior causes xfstest shared/298 to fail when run on a bigalloc
file system with a 1k block size. The test uses dumpe2fs to collect
a list of the blocks freed when files are deleted from a file system.
When the test deletes a file containing blocks located after the first
block in the last cluster in a series of clusters, dumpe2fs does not
report those blocks as free per the test's expectations.
Modify dumpe2fs to report full block ranges for free clusters. At the
same time, fix a small bug causing unnecessary !in_use() retests while
iterating over a block bitmap.
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
misc/dumpe2fs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 7c080ed9..d2d57fb0 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -84,8 +84,7 @@ static void print_free(unsigned long group, char * bitmap,
unsigned long num, unsigned long offset, int ratio)
{
int p = 0;
- unsigned long i;
- unsigned long j;
+ unsigned long i, j;
offset /= ratio;
offset += group * num;
@@ -95,13 +94,14 @@ static void print_free(unsigned long group, char * bitmap,
if (p)
printf (", ");
print_number((i + offset) * ratio);
- for (j = i; j < num && !in_use (bitmap, j); j++)
+ for (j = i + 1; j < num && !in_use(bitmap, j); j++)
;
- if (--j != i) {
+ if (j != i + 1 || ratio > 1) {
fputc('-', stdout);
- print_number((j + offset) * ratio);
- i = j;
+ print_number(((j - 1 + offset) * ratio) +
+ ratio - 1);
}
+ i = j;
p = 1;
}
}
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] e2fsprogs: modify dumpe2fs to report free block ranges for bigalloc
2023-07-21 18:55 [PATCH] e2fsprogs: modify dumpe2fs to report free block ranges for bigalloc Eric Whitney
@ 2023-08-17 14:47 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2023-08-17 14:47 UTC (permalink / raw)
To: linux-ext4, Eric Whitney; +Cc: Theodore Ts'o
On Fri, 21 Jul 2023 14:55:06 -0400, Eric Whitney wrote:
> dumpe2fs has never been modified to correctly report block ranges
> corresponding to free clusters in block allocation bitmaps from bigalloc
> file systems. Rather than reporting block ranges covering all the
> blocks in free clusters found in a block bitmap, it either reports just
> the first block number in a cluster for a single free cluster, or a
> range beginning with the first block number in the first cluster in a
> series of free clusters, and ending with the first block number in the
> last cluster in that series.
>
> [...]
Applied, thanks!
[1/1] e2fsprogs: modify dumpe2fs to report free block ranges for bigalloc
commit: b9df2bcb4d8a4d2f3985f3d2f9d85292b826cc8b
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-17 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-21 18:55 [PATCH] e2fsprogs: modify dumpe2fs to report free block ranges for bigalloc Eric Whitney
2023-08-17 14:47 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).