All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: open-code remount flag setting in btrfs_remount
@ 2020-07-22  9:00 Johannes Thumshirn
  2020-07-22 14:15 ` David Sterba
  2020-07-30  5:07 ` Anand Jain
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2020-07-22  9:00 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs, Johannes Thumshirn

When we're (re)mounting a btrfs filesystem we set the
BTRFS_FS_STATE_REMOUNTING state in fs_info to serialize against async
reclaim or defrags.

This flag is set in btrfs_remount_prepare() called by btrfs_remount(). As
btrfs_remount_prepare() does nothing but setting this flag and doesn't
have a second caller, we can just open-code the flag setting in
btrfs_remount().

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/super.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index a4f0bb29b8d6..19b1f0e8034e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1782,11 +1782,6 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
 				new_pool_size);
 }
 
-static inline void btrfs_remount_prepare(struct btrfs_fs_info *fs_info)
-{
-	set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
-}
-
 static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info,
 				       unsigned long old_opts, int flags)
 {
@@ -1837,7 +1832,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 	int ret;
 
 	sync_filesystem(sb);
-	btrfs_remount_prepare(fs_info);
+	set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
 
 	if (data) {
 		void *new_sec_opts = NULL;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: open-code remount flag setting in btrfs_remount
  2020-07-22  9:00 [PATCH] btrfs: open-code remount flag setting in btrfs_remount Johannes Thumshirn
@ 2020-07-22 14:15 ` David Sterba
  2020-07-30  5:07 ` Anand Jain
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-07-22 14:15 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs

On Wed, Jul 22, 2020 at 06:00:39PM +0900, Johannes Thumshirn wrote:
> When we're (re)mounting a btrfs filesystem we set the
> BTRFS_FS_STATE_REMOUNTING state in fs_info to serialize against async
> reclaim or defrags.
> 
> This flag is set in btrfs_remount_prepare() called by btrfs_remount(). As
> btrfs_remount_prepare() does nothing but setting this flag and doesn't
> have a second caller, we can just open-code the flag setting in
> btrfs_remount().

Agreed, that's too trivial and set_bit of state flags are commonly used.
I'd suggest to also lift the clear_bit counterpart from
btrfs_remount_cleanup and move it right after it in btrfs_remount, so we
have both set/clear in one function.

The original idea was probably to have prepare/cleanup wrapped but I
don't see much value to have the trivial wrapper.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: open-code remount flag setting in btrfs_remount
  2020-07-22  9:00 [PATCH] btrfs: open-code remount flag setting in btrfs_remount Johannes Thumshirn
  2020-07-22 14:15 ` David Sterba
@ 2020-07-30  5:07 ` Anand Jain
  1 sibling, 0 replies; 3+ messages in thread
From: Anand Jain @ 2020-07-30  5:07 UTC (permalink / raw)
  To: Johannes Thumshirn, David Sterba; +Cc: linux-btrfs


> -static inline void btrfs_remount_prepare(struct btrfs_fs_info *fs_info)
> -{
> -	set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
> -}
> -
>   static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info,
>   				       unsigned long old_opts, int flags)
>   {
> @@ -1837,7 +1832,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
>   	int ret;
>   
>   	sync_filesystem(sb);
> -	btrfs_remount_prepare(fs_info);
> +	set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
>   

  Reviewed-by: Anand Jain <anand.jain@oracle.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-30  5:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  9:00 [PATCH] btrfs: open-code remount flag setting in btrfs_remount Johannes Thumshirn
2020-07-22 14:15 ` David Sterba
2020-07-30  5:07 ` Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.