From: "Darrick J. Wong" <djwong@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 6/7] fs: remove unused helper
Date: Wed, 27 Sep 2023 08:12:37 -0700 [thread overview]
Message-ID: <20230927151237.GF11414@frogsfrogsfrogs> (raw)
In-Reply-To: <20230927-vfs-super-freeze-v1-6-ecc36d9ab4d9@kernel.org>
On Wed, Sep 27, 2023 at 03:21:19PM +0200, Christian Brauner wrote:
> The grab_super() helper is now only used by grab_super_dead(). Merge the
> two helpers into one.
>
> Signed-off-by: Christian Brauner <brauner@kernel.org>
Yup, nice cleanup...
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/super.c | 44 +++++++-------------------------------------
> 1 file changed, 7 insertions(+), 37 deletions(-)
>
> diff --git a/fs/super.c b/fs/super.c
> index 181ac8501301..6cdce2b31622 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -517,35 +517,6 @@ void deactivate_super(struct super_block *s)
>
> EXPORT_SYMBOL(deactivate_super);
>
> -/**
> - * grab_super - acquire an active reference
> - * @s: reference we are trying to make active
> - *
> - * Tries to acquire an active reference. grab_super() is used when we
> - * had just found a superblock in super_blocks or fs_type->fs_supers
> - * and want to turn it into a full-blown active reference. grab_super()
> - * is called with sb_lock held and drops it. Returns 1 in case of
> - * success, 0 if we had failed (superblock contents was already dead or
> - * dying when grab_super() had been called). Note that this is only
> - * called for superblocks not in rundown mode (== ones still on ->fs_supers
> - * of their type), so increment of ->s_count is OK here.
> - */
> -static int grab_super(struct super_block *s) __releases(sb_lock)
> -{
> - bool born;
> -
> - s->s_count++;
> - spin_unlock(&sb_lock);
> - born = super_lock_excl(s);
> - if (born && atomic_inc_not_zero(&s->s_active)) {
> - put_super(s);
> - return 1;
> - }
> - super_unlock_excl(s);
> - put_super(s);
> - return 0;
> -}
> -
> static inline bool wait_dead(struct super_block *sb)
> {
> unsigned int flags;
> @@ -559,7 +530,7 @@ static inline bool wait_dead(struct super_block *sb)
> }
>
> /**
> - * grab_super_dead - acquire an active reference to a superblock
> + * grab_super - acquire an active reference to a superblock
> * @sb: superblock to acquire
> *
> * Acquire a temporary reference on a superblock and try to trade it for
> @@ -570,17 +541,16 @@ static inline bool wait_dead(struct super_block *sb)
> * Return: This returns true if an active reference could be acquired,
> * false if not.
> */
> -static bool grab_super_dead(struct super_block *sb)
> +static bool grab_super(struct super_block *sb)
> {
> -
> sb->s_count++;
> - if (grab_super(sb)) {
> + spin_unlock(&sb_lock);
> + if (super_lock_excl(sb) && atomic_inc_not_zero(&sb->s_active)) {
> put_super(sb);
> - lockdep_assert_held(&sb->s_umount);
> return true;
> }
> + super_unlock_excl(sb);
> wait_var_event(&sb->s_flags, wait_dead(sb));
> - lockdep_assert_not_held(&sb->s_umount);
> put_super(sb);
> return false;
> }
> @@ -831,7 +801,7 @@ struct super_block *sget_fc(struct fs_context *fc,
> warnfc(fc, "reusing existing filesystem in another namespace not allowed");
> return ERR_PTR(-EBUSY);
> }
> - if (!grab_super_dead(old))
> + if (!grab_super(old))
> goto retry;
> destroy_unused_super(s);
> return old;
> @@ -875,7 +845,7 @@ struct super_block *sget(struct file_system_type *type,
> destroy_unused_super(s);
> return ERR_PTR(-EBUSY);
> }
> - if (!grab_super_dead(old))
> + if (!grab_super(old))
> goto retry;
> destroy_unused_super(s);
> return old;
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-09-27 15:12 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 13:21 [PATCH 0/7] Implement freeze and thaw as holder operations Christian Brauner
2023-09-27 13:21 ` [PATCH 1/7] bdev: rename freeze and thaw helpers Christian Brauner
2023-09-27 14:35 ` Darrick J. Wong
2023-10-02 6:51 ` Christoph Hellwig
2023-10-02 11:28 ` Jan Kara
2023-09-27 13:21 ` [PATCH 2/7] bdev: add freeze and thaw holder operations Christian Brauner
2023-09-27 14:38 ` Darrick J. Wong
2023-10-02 6:52 ` Christoph Hellwig
2023-10-02 16:32 ` Jan Kara
2023-09-27 13:21 ` [PATCH 3/7] bdev: implement " Christian Brauner
2023-09-27 14:53 ` Darrick J. Wong
2023-09-27 15:15 ` Christian Brauner
2023-09-27 16:01 ` Darrick J. Wong
2023-10-02 6:54 ` Christoph Hellwig
2023-10-02 7:10 ` Christoph Hellwig
2023-09-27 13:21 ` [PATCH 4/7] fs: remove get_active_super() Christian Brauner
2023-09-27 14:54 ` Darrick J. Wong
2023-10-02 7:10 ` Christoph Hellwig
2023-10-02 16:22 ` Jan Kara
2023-09-27 13:21 ` [PATCH 5/7] super: remove bd_fsfreeze_{mutex,sb} Christian Brauner
2023-09-27 15:11 ` Darrick J. Wong
2023-09-27 15:18 ` Christian Brauner
2023-10-02 7:12 ` Christoph Hellwig
2023-10-02 16:24 ` Jan Kara
2023-09-27 13:21 ` [PATCH 6/7] fs: remove unused helper Christian Brauner
2023-09-27 15:12 ` Darrick J. Wong [this message]
2023-10-02 7:12 ` Christoph Hellwig
2023-10-02 16:26 ` Jan Kara
2023-09-27 13:21 ` [PATCH 7/7] porting: document block device freeze and thaw changes Christian Brauner
2023-09-27 15:19 ` Darrick J. Wong
2023-10-02 16:45 ` Jan Kara
2023-10-05 6:48 ` Christoph Hellwig
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=20230927151237.GF11414@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=brauner@kernel.org \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-fsdevel@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