]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: __btrfs_std_error() logic should be consistent w/out CONFIG_PRINTK defined
authorAnand Jain <anand.jain@oracle.com>
Fri, 14 Aug 2015 10:32:52 +0000 (18:32 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 29 Sep 2015 14:30:00 +0000 (16:30 +0200)
commit0702b09379edf1ceb72bc079a78d2f228e479038
tree9457a7ff7bb5bf280abdbbc8d85c971d96ba7c84
parent52ca64330a09b033aeecb2c246e87098f8a63cce
Btrfs: __btrfs_std_error() logic should be consistent w/out CONFIG_PRINTK defined

error handling logic behaves differently with or without
CONFIG_PRINTK defined, since there are two copies of the same
function which a bit of different logic

One, when CONFIG_PRINTK is defined, code is

__btrfs_std_error(..)
{
::
       save_error_info(fs_info);
       if (sb->s_flags & MS_BORN)
               btrfs_handle_error(fs_info);
}

and two when CONFIG_PRINTK is not defined, the code is

__btrfs_std_error(..)
{
::
       if (sb->s_flags & MS_BORN) {
               save_error_info(fs_info);
               btrfs_handle_error(fs_info);
        }
}

I doubt if this was intentional ? and appear to have caused since
we maintain two copies of the same function and they got diverged
with commits.

Now to decide which logic is correct reviewed changes as below,

 89062c4509712f40a876cdc0f6cc2f7d7a4ec393
Commit added two copies of this function

 0357b436a83edef7dbc537f744c22103f1d30ab0
Commit made change to only one copy of the function and to the
copy when CONFIG_PRINTK is defined.

To fix this, instead of maintaining two copies of same function
approach, maintain single function, and just put the extra
portion of the code under CONFIG_PRINTK define.

This patch just does that. And keeps code of with CONFIG_PRINTK
defined.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/super.c