All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chandan Babu R <chandanrlinux@gmail.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Chandan Babu R <chandanrlinux@gmail.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfsprogs: xfs_fsr: Interpret arguments of qsort's compare function correctly
Date: Tue, 26 Jan 2021 10:44:44 +0530	[thread overview]
Message-ID: <87lfcgcm9n.fsf@garuda> (raw)
In-Reply-To: <da50be67-cc9a-8a99-84dc-a4ae3ee4fd73@sandeen.net>

On 25 Jan 2021 at 19:47, Eric Sandeen wrote:
> On 1/25/21 3:58 AM, Chandan Babu R wrote:
>> The first argument passed to qsort() in fsrfs() is an array of "struct
>> xfs_bulkstat". Hence the two arguments to the cmp() function must be
>> interpreted as being of type "struct xfs_bulkstat *" as against "struct
>> xfs_bstat *" that is being used to currently typecast them.
>>
>> Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
>
> Yikes. Broken since 5.3.0, and the structures have different sizes and
> different bs_extents offsets. :(
>
> Fixes: 4cca629d6 ("misc: convert xfrog_bulkstat functions to have v5 semantics")
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
>
> At least it's only affecting the whole-fs defragment which is generally not
> recommended, but is still available and does get used.
>
> I wonder if it explains this bug report:
>
> Jan 07 20:52:44 <Tharn>	hey, quick question... the first time I ran xfs_fsr last night, it ran for 2 hours and looking at the console log, it ended with a lot of "start inode=0" repeating

With my limited understanding of xfs_fsr code, looks like the bug reporter saw
the logs corresponding to the default (i.e. 10) number of passes that xfs_fsr
executes on the inodes of the filesystem. Sorry, I couldn't be of much help in
this case.

>
>> ---
>>  fsr/xfs_fsr.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
>> index 77a10a1d..635e4c70 100644
>> --- a/fsr/xfs_fsr.c
>> +++ b/fsr/xfs_fsr.c
>> @@ -702,9 +702,8 @@ out0:
>>  int
>>  cmp(const void *s1, const void *s2)
>>  {
>> -	return( ((struct xfs_bstat *)s2)->bs_extents -
>> -	        ((struct xfs_bstat *)s1)->bs_extents);
>> -
>> +	return( ((struct xfs_bulkstat *)s2)->bs_extents -
>> +	        ((struct xfs_bulkstat *)s1)->bs_extents);
>>  }
>>
>>  /*
>>


--
chandan

  reply	other threads:[~2021-01-27 10:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  9:58 [PATCH 1/2] xfsprogs: xfs_fsr: Interpret arguments of qsort's compare function correctly Chandan Babu R
2021-01-25  9:58 ` [PATCH 2/2] xfsprogs: xfs_fsr: Limit the scope of cmp() Chandan Babu R
2021-01-25 14:19   ` Eric Sandeen
2021-01-26  4:42     ` [PATCH V1.1] " Chandan Babu R
2021-02-02 20:21       ` Eric Sandeen
2021-01-25 14:17 ` [PATCH 1/2] xfsprogs: xfs_fsr: Interpret arguments of qsort's compare function correctly Eric Sandeen
2021-01-26  5:14   ` Chandan Babu R [this message]
2021-01-26 17:58 ` Darrick J. Wong
2021-01-26 18:12   ` Chandan Babu R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfcgcm9n.fsf@garuda \
    --to=chandanrlinux@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.