linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Filipe Manana <fdmanana@kernel.org>
Cc: fstests <fstests@vger.kernel.org>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH 1/4] fsx: add missing file size update on zero range operations
Date: Fri, 17 Apr 2020 13:26:06 -0400	[thread overview]
Message-ID: <20200417172606.GF13463@bfoster> (raw)
In-Reply-To: <CAL3q7H5nxP5tt8i=i0uQoG7VBs94O=ZkcAz8khS-DGCTTQG1=g@mail.gmail.com>

On Fri, Apr 17, 2020 at 06:20:24PM +0100, Filipe Manana wrote:
> On Fri, Apr 17, 2020 at 6:10 PM Brian Foster <bfoster@redhat.com> wrote:
> >
> > On Wed, Apr 08, 2020 at 11:35:52AM +0100, fdmanana@kernel.org wrote:
> > > From: Filipe Manana <fdmanana@suse.com>
> > >
> > > When a zero range operation increases the size of the test file we were
> > > not updating the global variable 'file_size' which tracks the current
> > > size of the test file. This variable is used to for example compute the
> > > offset for a source range of clone, dedupe and copy file range operations.
> > >
> > > So just fix it by updating the 'file_size' global variable whenever a zero
> > > range operation does not use the keep size flag and its range goes beyond
> > > the current file size.
> > >
> > > Signed-off-by: Filipe Manana <fdmanana@suse.com>
> > > ---
> > >  ltp/fsx.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/ltp/fsx.c b/ltp/fsx.c
> > > index 9d598a4f..fa383c94 100644
> > > --- a/ltp/fsx.c
> > > +++ b/ltp/fsx.c
> > > @@ -1212,6 +1212,8 @@ do_zero_range(unsigned offset, unsigned length, int keep_size)
> > >       }
> > >
> > >       end_offset = keep_size ? 0 : offset + length;
> > > +     if (!keep_size && end_offset > file_size)
> > > +             file_size = end_offset;
> >
> > Should this ever happen if the caller uses TRIM_OFF_LEN() on the
> > offset and length?
> 
> TRIM_OFF_LEN only trims the range, not the file_size.
> Or did I miss something?
> 

Right, but TRIM_LEN() does:

        if ((off) + (len) > (size))             \                               
                (len) = (size) - (off);         \

... where size is file_size. Hm?

Brian

> Thanks.
> 
> >
> > Brian
> >
> > >
> > >       if (end_offset > biggest) {
> > >               biggest = end_offset;
> > > --
> > > 2.11.0
> > >
> >
> 


  reply	other threads:[~2020-04-17 17:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 10:35 [PATCH 1/4] fsx: add missing file size update on zero range operations fdmanana
2020-04-17 17:10 ` Brian Foster
2020-04-17 17:20   ` Filipe Manana
2020-04-17 17:26     ` Brian Foster [this message]
2020-04-17 17:32       ` Filipe Manana
2020-04-17 17:47         ` Brian Foster
2020-04-17 17:53           ` Filipe Manana
2020-04-17 18:25             ` Brian Foster
2020-04-20 17:07               ` Filipe Manana
2020-04-19 14:55 ` Eryu Guan

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=20200417172606.GF13463@bfoster \
    --to=bfoster@redhat.com \
    --cc=fdmanana@kernel.org \
    --cc=fdmanana@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).