linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@gmail.com>
To: dsterba@suse.cz, Nikolay Borisov <nborisov@suse.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	Filipe David Borba Manana <fdmanana@suse.com>
Subject: Re: [PATCH 1/3] btrfs: Don't discard unwritten extents
Date: Wed, 27 Nov 2019 17:37:34 +0000	[thread overview]
Message-ID: <CAL3q7H4U2V4jqh6PsOFZb6nNpBQbzrF+gm49j9iYNop5vSf5uw@mail.gmail.com> (raw)
In-Reply-To: <20191127160600.GU2734@twin.jikos.cz>

On Wed, Nov 27, 2019 at 4:08 PM David Sterba <dsterba@suse.cz> wrote:
>
> On Thu, Nov 21, 2019 at 02:03:29PM +0200, Nikolay Borisov wrote:
> > --- a/fs/btrfs/extent-tree.c
> > +++ b/fs/btrfs/extent-tree.c
> > @@ -4169,8 +4169,6 @@ static int __btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
> >               if (ret)
> >                       goto out;
> >       } else {
> > -             if (btrfs_test_opt(fs_info, DISCARD))
> > -                     ret = btrfs_discard_extent(fs_info, start, len, NULL);
> >               btrfs_add_free_space(cache, start, len);
> >               btrfs_free_reserved_bytes(cache, len, delalloc);
> >               trace_btrfs_reserved_extent_free(fs_info, start, len);
> > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> > index 0ac0f5b33003..5d80fe030e79 100644
> > --- a/fs/btrfs/inode.c
> > +++ b/fs/btrfs/inode.c
> > @@ -3250,10 +3250,15 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
> >               if ((ret || !logical_len) &&
> >                   clear_reserved_extent &&
> >                   !test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) &&
> > -                 !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags))
> > +                 !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) {
> >                       btrfs_free_reserved_extent(fs_info,
> >                                                  ordered_extent->start,
> >                                                  ordered_extent->disk_len, 1);
> > +                     if (ret && btrfs_test_opt(fs_info, DISCARD))
> > +                             btrfs_discard_extent(fs_info,
> > +                             ordered_extent->start, ordered_extent->disk_len,
> > +                             NULL);
>
> This brings back vague memories of misplaced discard (in
> finish_ordered_io), that was quite hard to catch. I can't find the fix
> though. Filipe, is it the same issue?

It's different (as you identified already in another reply).
Even though this is rarely hit on a healthy system, it looks fine to me.

Reviewed-by: Filipe Manana <fdmanana@suse.com>

thanks



-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

  parent reply	other threads:[~2019-11-27 17:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 12:03 [PATCH 0/3] 3 misc patches Nikolay Borisov
2019-11-21 12:03 ` [PATCH 1/3] btrfs: Don't discard unwritten extents Nikolay Borisov
2019-11-27 16:06   ` David Sterba
2019-11-27 16:15     ` David Sterba
2019-11-27 16:23       ` Nikolay Borisov
2019-11-27 17:37     ` Filipe Manana [this message]
2019-11-21 12:03 ` [PATCH 2/3] btrfs: Open code __btrfs_free_reserved_extent in btrfs_free_reserved_extent Nikolay Borisov
2019-11-27 18:55   ` David Sterba
2019-11-29  8:44     ` Nikolay Borisov
2019-11-21 12:03 ` [PATCH 3/3] btrfs: Rename __btrfs_free_reserved_extent to btrfs_pin_reserved_extent Nikolay Borisov
2019-11-28 11:14   ` David Sterba
2019-12-03 17:16 ` [PATCH 0/3] 3 misc patches David Sterba

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=CAL3q7H4U2V4jqh6PsOFZb6nNpBQbzrF+gm49j9iYNop5vSf5uw@mail.gmail.com \
    --to=fdmanana@gmail.com \
    --cc=dsterba@suse.cz \
    --cc=fdmanana@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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).