linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@gmail.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>, kernel-team@fb.com
Subject: Re: [PATCH 4/8] btrfs: cleanup btrfs_discard_update_discardable usage
Date: Wed, 4 Nov 2020 18:28:13 +0000	[thread overview]
Message-ID: <CAL3q7H6hWx=VZDNZQjxzwEDw0-3TMUPtft5y3Mc-NSU4VBj2dw@mail.gmail.com> (raw)
In-Reply-To: <fd63e33b-49ea-2150-eaef-e3fd19e5372a@toxicpanda.com>

On Wed, Nov 4, 2020 at 6:21 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> On 11/4/20 10:54 AM, Filipe Manana wrote:
> > On Fri, Oct 23, 2020 at 5:12 PM Josef Bacik <josef@toxicpanda.com> wrote:
> >>
> >> This passes in the block_group and the free_space_ctl, but we can get
> >> this from the block group itself.  Part of this is because we call it
> >> from __load_free_space_cache, which can be called for the inode cache as
> >> well.  Move that call into the block group specific load section, wrap
> >> it in the right lock that we need, and fix up the arguments to only take
> >> the block group.  Add a lockdep_assert as well for good measure to make
> >> sure we don't mess up the locking again.
> >
> > So this is actually 2 different things in one patch:
> >
> > 1) A cleanup to remove an unnecessary argument to
> > btrfs_discard_update_discardable();
> >
> > 2) A bug because btrfs_discard_update_discardable() is not being
> > called with the lock ->tree_lock held in one specific context.
>
> Yeah but the specific context is on load, so we won't have concurrent modifiers
> to the tree until _after_ the cache is successfully loaded.  Of course this
> patchset changes that so it's important now, but prior to this we didn't
> necessarily need the lock, so it's not really a bug fix, just an adjustment.
>
> However I'm always happy to inflate my patch counts, makes me look good at
> performance review time ;).  I'm happy to respin with it broken out.  Thanks,

Then make it 3! One more just to add the assertion!

I'm fine with it as it is, maybe just add an explicit note that we
can't have concurrent access in the load case, so it's not fixing any
bug, but just prevention.

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

Thanks.

>
> Josef



-- 
Filipe David Manana,

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

  reply	other threads:[~2020-11-04 18:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 13:58 [PATCH 0/8] Block group caching fixes Josef Bacik
2020-10-23 13:58 ` [PATCH 1/8] btrfs: do not shorten unpin len for caching block groups Josef Bacik
2020-11-04 13:38   ` Filipe Manana
2020-10-23 13:58 ` [PATCH 2/8] btrfs: update last_byte_to_unpin in switch_commit_roots Josef Bacik
2020-11-04 15:15   ` Filipe Manana
2025-01-14 17:28     ` Alex Lyakas
2020-10-23 13:58 ` [PATCH 3/8] btrfs: explicitly protect ->last_byte_to_unpin in unpin_extent_range Josef Bacik
2020-11-04 15:36   ` Filipe Manana
2020-10-23 13:58 ` [PATCH 4/8] btrfs: cleanup btrfs_discard_update_discardable usage Josef Bacik
2020-11-04 15:54   ` Filipe Manana
2020-11-04 17:36     ` Amy Parker
2020-11-04 18:21     ` Josef Bacik
2020-11-04 18:28       ` Filipe Manana [this message]
2020-11-05 13:22         ` David Sterba
2020-10-23 13:58 ` [PATCH 5/8] btrfs: load free space cache into a temporary ctl Josef Bacik
2020-11-04 16:20   ` Filipe Manana
2020-10-23 13:58 ` [PATCH 6/8] btrfs: load the free space cache inode extents from commit root Josef Bacik
2020-11-04 16:27   ` Filipe Manana
2020-10-23 13:58 ` [PATCH 7/8] btrfs: async load free space cache Josef Bacik
2020-11-04 18:02   ` Filipe Manana
2020-10-23 13:58 ` [PATCH 8/8] btrfs: protect the fs_info->caching_block_groups differently Josef Bacik
2020-11-04 18:27   ` Filipe Manana
2020-11-05 14:27 ` [PATCH 0/8] Block group caching fixes 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='CAL3q7H6hWx=VZDNZQjxzwEDw0-3TMUPtft5y3Mc-NSU4VBj2dw@mail.gmail.com' \
    --to=fdmanana@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --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).