btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set
PATCH 2/2 btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error()
In reply to Anand JainThere is no other consumer for btrfs_handle_error() other than __btrfs_handle_fs_error(), further this function quite small. Merge it into its parent.
--- fs/btrfs/super.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-)
fs/btrfs/super.c +19 -24
@@ -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 *functionset_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
Signature · 1 line
2.15.0
Re: [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error()
Quoted 5 lines · Anand Jain
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 <[email protected]>
Quoted 66 lines
--- fs/btrfs/super.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-)fs/btrfs/super.c +19
-24@@ -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 *functionset_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
PATCH 1/2 btrfs: remove check for BTRFS_FS_STATE_ERROR which we just set
__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.
--- fs/btrfs/super.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
fs/btrfs/super.c +12 -14
@@ -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. +*/ }/*
Signature · 1 line
2.15.0
Quoted 6 lines · Anand Jain
__btrfs_handle_fs_error()setsBTRFS_FS_STATE_ERROR, and callsbtrfs_handle_error()so no need to check if theBTRFS_FS_STATE_ERRORis set inbtrfs_handle_error(). And there is no other user ofbtrfs_handle_error()as well.Signed-off-by Anand Jain <[email protected]>
Quoted 42 lines
--- fs/btrfs/super.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)fs/btrfs/super.c +12
-14@@ -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. +*/ }/*
Re: [PATCH 2/2] btrfS: collapse btrfs_handle_error() into __btrfs_handle_fs_error()
In reply to Nikolay BorisovQuoted 10 lines · Nikolay Borisov
Quoted 5 lines · Anand Jain
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 <[email protected]>Reviewed-by Nikolay Borisov <[email protected]>
Both patches added to for-next, thanks.