lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 8 Apr 2011 17:40:52 -0600
From:	Andreas Dilger <adilger@...ger.ca>
To:	Eric Sandeen <sandeen@...hat.com>
Cc:	ext4 development <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH] filefrag: count optimize non-verbose mode; count 0 extents properly when verbose

On 2011-04-08, at 10:44 AM, Eric Sandeen wrote:
> On 11/23/10 3:21 PM, Eric Sandeen wrote:
>> # rm -f a; touch a; filefrag -v a
>> 
>> yields 1 extent when it should be 0.  Without -v, 0 is returned.
>> 
>> Fix this up by special-casing no extents returned in verbose
>> mode; skip printing the header for the columns too, since there
>> are no columns to print.
>> 
>> Also, in nonverbose mode we can set fm_extent_count to 0
>> so that FIEMAP will just query the extent count without gathering
>> details; as it is today I think a non-verbose query may under-report
>> the extent count once "count" extents have been filled in.
>> 
>> Addresses-redhat-bugzilla: 653234
>> Signed-off-by: Eric Sandeen <sandeen@...hat.com>
> 
> ping^3
> 
>> ---
>> 
>> diff --git a/misc/filefrag.c b/misc/filefrag.c
>> index bd4486d..a48b9b0 100644
>> --- a/misc/filefrag.c
>> +++ b/misc/filefrag.c
>> @@ -194,7 +194,14 @@ static int filefrag_fiemap(int fd, int blk_shift, int *num_extents)
>> 	do {
>> 		fiemap->fm_length = ~0ULL;
>> 		fiemap->fm_flags = flags;
>> -		fiemap->fm_extent_count = count;
>> +		/*
>> +		 * If fm_extent_count == 0, FIEMAP returns count of
>> +		 * extents found without filling in details.
>> +		 */
>> +		if (!verbose)
>> +			fiemap->fm_extent_count = 0;
>> +		else
>> +			fiemap->fm_extent_count = count;

This is already checked before the start of the do {} while() loop, just above the context of this patch:

	if (!verbose)
		count = 0;

No point in checking (!verbose) inside the loop.

>> @@ -206,6 +213,14 @@ static int filefrag_fiemap(int fd, int blk_shift, int *num_extents)
>> 		}
>> 
>> 		if (verbose && !fiemap_header_printed) {
>> +			/*
>> +			 * No extents on first call?
>> +			 * Skip header and show 0 extents.
>> +			 */
>> +			if (fiemap->fm_mapped_extents == 0) {
>> +				*num_extents = 0;
>> +				goto out;
>> +			}
>> 			printf(" ext %*s %*s %*s length flags\n", logical_width,
>> 			       "logical", physical_width, "physical",
>> 			       physical_width, "expected");

This part definitely makes sense.

Cheers, Andreas





--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists