* [PATCH 1/2] btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set
@ 2018-01-04 10:01 Anand Jain
2018-01-04 10:01 ` [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error() Anand Jain
2018-01-04 13:21 ` [PATCH 1/2] btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set Nikolay Borisov
0 siblings, 2 replies; 5+ messages in thread
From: Anand Jain @ 2018-01-04 10:01 UTC (permalink / raw)
To: linux-btrfs
__btrfs_handle_fs_error() sets BTRFS_FS_STATE_ERROR, and calls
btrfs_handle_error() so no need to check if the BTRFS_FS_STATE_ERROR
is set in btrfs_handle_error(). And there is no other user of
btrfs_handle_error() as well.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/super.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 4c49bb5632a2..60766f8ca434 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -113,20 +113,18 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
if (sb_rdonly(sb))
return;
- if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) {
- sb->s_flags |= SB_RDONLY;
- btrfs_info(fs_info, "forced readonly");
- /*
- * Note that a running device replace operation is not
- * canceled here although there is no way to update
- * the progress. It would add the risk of a deadlock,
- * therefore the canceling is omitted. The only penalty
- * is that some I/O remains active until the procedure
- * completes. The next time when the filesystem is
- * mounted writeable again, the device replace
- * operation continues.
- */
- }
+ sb->s_flags |= SB_RDONLY;
+ btrfs_info(fs_info, "forced readonly");
+ /*
+ * Note that a running device replace operation is not
+ * canceled here although there is no way to update
+ * the progress. It would add the risk of a deadlock,
+ * therefore the canceling is omitted. The only penalty
+ * is that some I/O remains active until the procedure
+ * completes. The next time when the filesystem is
+ * mounted writeable again, the device replace
+ * operation continues.
+ */
}
/*
--
2.15.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error()
2018-01-04 10:01 [PATCH 1/2] btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set Anand Jain
@ 2018-01-04 10:01 ` Anand Jain
2018-01-04 12:11 ` Nikolay Borisov
2018-01-04 13:21 ` [PATCH 1/2] btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set Nikolay Borisov
1 sibling, 1 reply; 5+ messages in thread
From: Anand Jain @ 2018-01-04 10:01 UTC (permalink / raw)
To: linux-btrfs
There is no other consumer for btrfs_handle_error() other than
__btrfs_handle_fs_error(), further this function quite small.
Merge it into its parent.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/super.c | 43 +++++++++++++++++++------------------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 60766f8ca434..0216a5dd0f4b 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -105,28 +105,6 @@ const char *btrfs_decode_error(int errno)
return errstr;
}
-/* btrfs handle error by forcing the filesystem readonly */
-static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
-{
- struct super_block *sb = fs_info->sb;
-
- if (sb_rdonly(sb))
- return;
-
- sb->s_flags |= SB_RDONLY;
- btrfs_info(fs_info, "forced readonly");
- /*
- * Note that a running device replace operation is not
- * canceled here although there is no way to update
- * the progress. It would add the risk of a deadlock,
- * therefore the canceling is omitted. The only penalty
- * is that some I/O remains active until the procedure
- * completes. The next time when the filesystem is
- * mounted writeable again, the device replace
- * operation continues.
- */
-}
-
/*
* __btrfs_handle_fs_error decodes expected errors from the caller and
* invokes the approciate error response.
@@ -173,8 +151,25 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
set_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state);
/* Don't go through full error handling during mount */
- if (sb->s_flags & SB_BORN)
- btrfs_handle_error(fs_info);
+ if (!(sb->s_flags & SB_BORN))
+ return;
+
+ if (sb_rdonly(sb))
+ return;
+
+ /* btrfs handle error by forcing the filesystem readonly */
+ sb->s_flags |= SB_RDONLY;
+ btrfs_info(fs_info, "forced readonly");
+ /*
+ * Note that a running device replace operation is not
+ * canceled here although there is no way to update
+ * the progress. It would add the risk of a deadlock,
+ * therefore the canceling is omitted. The only penalty
+ * is that some I/O remains active until the procedure
+ * completes. The next time when the filesystem is
+ * mounted writeable again, the device replace
+ * operation continues.
+ */
}
#ifdef CONFIG_PRINTK
--
2.15.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error()
2018-01-04 10:01 ` [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error() Anand Jain
@ 2018-01-04 12:11 ` Nikolay Borisov
2018-01-05 13:00 ` David Sterba
0 siblings, 1 reply; 5+ messages in thread
From: Nikolay Borisov @ 2018-01-04 12:11 UTC (permalink / raw)
To: Anand Jain, linux-btrfs
On 4.01.2018 12:01, Anand Jain wrote:
> There is no other consumer for btrfs_handle_error() other than
> __btrfs_handle_fs_error(), further this function quite small.
> Merge it into its parent.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/super.c | 43 +++++++++++++++++++------------------------
> 1 file changed, 19 insertions(+), 24 deletions(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 60766f8ca434..0216a5dd0f4b 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -105,28 +105,6 @@ const char *btrfs_decode_error(int errno)
> return errstr;
> }
>
> -/* btrfs handle error by forcing the filesystem readonly */
> -static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
> -{
> - struct super_block *sb = fs_info->sb;
> -
> - if (sb_rdonly(sb))
> - return;
> -
> - sb->s_flags |= SB_RDONLY;
> - btrfs_info(fs_info, "forced readonly");
> - /*
> - * Note that a running device replace operation is not
> - * canceled here although there is no way to update
> - * the progress. It would add the risk of a deadlock,
> - * therefore the canceling is omitted. The only penalty
> - * is that some I/O remains active until the procedure
> - * completes. The next time when the filesystem is
> - * mounted writeable again, the device replace
> - * operation continues.
> - */
> -}
> -
> /*
> * __btrfs_handle_fs_error decodes expected errors from the caller and
> * invokes the approciate error response.
> @@ -173,8 +151,25 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
> set_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state);
>
> /* Don't go through full error handling during mount */
> - if (sb->s_flags & SB_BORN)
> - btrfs_handle_error(fs_info);
> + if (!(sb->s_flags & SB_BORN))
> + return;
> +
> + if (sb_rdonly(sb))
> + return;
> +
> + /* btrfs handle error by forcing the filesystem readonly */
> + sb->s_flags |= SB_RDONLY;
> + btrfs_info(fs_info, "forced readonly");
> + /*
> + * Note that a running device replace operation is not
> + * canceled here although there is no way to update
> + * the progress. It would add the risk of a deadlock,
> + * therefore the canceling is omitted. The only penalty
> + * is that some I/O remains active until the procedure
> + * completes. The next time when the filesystem is
> + * mounted writeable again, the device replace
> + * operation continues.
> + */
> }
>
> #ifdef CONFIG_PRINTK
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set
2018-01-04 10:01 [PATCH 1/2] btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set Anand Jain
2018-01-04 10:01 ` [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error() Anand Jain
@ 2018-01-04 13:21 ` Nikolay Borisov
1 sibling, 0 replies; 5+ messages in thread
From: Nikolay Borisov @ 2018-01-04 13:21 UTC (permalink / raw)
To: Anand Jain, linux-btrfs
On 4.01.2018 12:01, Anand Jain wrote:
> __btrfs_handle_fs_error() sets BTRFS_FS_STATE_ERROR, and calls
> btrfs_handle_error() so no need to check if the BTRFS_FS_STATE_ERROR
> is set in btrfs_handle_error(). And there is no other user of
> btrfs_handle_error() as well.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/super.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 4c49bb5632a2..60766f8ca434 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -113,20 +113,18 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info)
> if (sb_rdonly(sb))
> return;
>
> - if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) {
> - sb->s_flags |= SB_RDONLY;
> - btrfs_info(fs_info, "forced readonly");
> - /*
> - * Note that a running device replace operation is not
> - * canceled here although there is no way to update
> - * the progress. It would add the risk of a deadlock,
> - * therefore the canceling is omitted. The only penalty
> - * is that some I/O remains active until the procedure
> - * completes. The next time when the filesystem is
> - * mounted writeable again, the device replace
> - * operation continues.
> - */
> - }
> + sb->s_flags |= SB_RDONLY;
> + btrfs_info(fs_info, "forced readonly");
> + /*
> + * Note that a running device replace operation is not
> + * canceled here although there is no way to update
> + * the progress. It would add the risk of a deadlock,
> + * therefore the canceling is omitted. The only penalty
> + * is that some I/O remains active until the procedure
> + * completes. The next time when the filesystem is
> + * mounted writeable again, the device replace
> + * operation continues.
> + */
> }
>
> /*
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error()
2018-01-04 12:11 ` Nikolay Borisov
@ 2018-01-05 13:00 ` David Sterba
0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2018-01-05 13:00 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: Anand Jain, linux-btrfs
On Thu, Jan 04, 2018 at 02:11:21PM +0200, Nikolay Borisov wrote:
>
>
> On 4.01.2018 12:01, Anand Jain wrote:
> > There is no other consumer for btrfs_handle_error() other than
> > __btrfs_handle_fs_error(), further this function quite small.
> > Merge it into its parent.
> >
> > Signed-off-by: Anand Jain <anand.jain@oracle.com>
>
> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Both patches added to for-next, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-05 13:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04 10:01 [PATCH 1/2] btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set Anand Jain
2018-01-04 10:01 ` [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error() Anand Jain
2018-01-04 12:11 ` Nikolay Borisov
2018-01-05 13:00 ` David Sterba
2018-01-04 13:21 ` [PATCH 1/2] btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set Nikolay Borisov
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).