public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandan Babu R <chandanrlinux@gmail.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Chandan Babu R <chandanrlinux@gmail.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: Allow scrub to detect inodes with non-maximal sized extents
Date: Wed, 24 Feb 2021 08:39:58 +0530	[thread overview]
Message-ID: <87mtvu17qx.fsf@garuda> (raw)
In-Reply-To: <20210223203013.GX4662@dread.disaster.area>

On 24 Feb 2021 at 02:00, Dave Chinner wrote:
> On Tue, Feb 23, 2021 at 01:56:29PM +0530, Chandan Babu R wrote:
>> This commit now makes it possible for scrub to check if an inode's extents are
>> maximally sized i.e. it checks if an inode's extent is contiguous (in terms of
>> both file offset and disk offset) with neighbouring extents and the total
>> length of both the extents is less than the maximum allowed extent
>> length (i.e. MAXEXTLEN).
>
> It took me a while to understand that what this is actually doing
> (had to read the code because I couldn't work out what this meant).
> Essentially, it is determining if two extents that are physically
> and logically adjacent were not merged together into a single extent
> when the combined size of the two extents would fit into a single
> extent record.
>
> I'm not sure this is an issue - it most definitely isn't corruption
> as nothing will have any problems looking up either extent, nor
> modifying or removing either extent. It's not ideal, but it isn't
> corruption.
>
> I can see how it would come about, too, because extent removal
> doesn't merge remaining partial extents.
>
> That is, create a long written extent in a file, then use fallocate
> to allocate an adjacent extent that puts the two extents over
> MAXEXTLEN. Now we have two phsyically and logically adjacent extents
> that only differ by state. Now do a single write that converts the
> entire unwritten extent to written so no merging occurs during the
> state conversion.  Now punch out the far end of the second extent.
>
> This ends up in xfs_bmap_del_extent_real(), which simply removes the
> end of the second extent. It does not look up the previous extent
> and attempt to merge the remaining part of the second extent into
> the previous adjacent extent.
>
> Hence, at this point, we have two logically and physically adjacent
> extents whose combined length is less than MAXLEN. This patch will
> now signal that as corruption, which is wrong.

Ah ok. Thanks for explaining the scenario which could lead to a false positive
report because of the code changes in this patch.

--
chandan

      reply	other threads:[~2021-02-24  3:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23  8:26 [PATCH] xfs: Allow scrub to detect inodes with non-maximal sized extents Chandan Babu R
2021-02-23 17:01 ` Darrick J. Wong
2021-02-23 20:30 ` Dave Chinner
2021-02-24  3:09   ` Chandan Babu R [this message]

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=87mtvu17qx.fsf@garuda \
    --to=chandanrlinux@gmail.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox