Message ID | 1512119984-12708-3-git-send-email-nborisov@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Dec 01, 2017 at 11:19:41AM +0200, Nikolay Borisov wrote: > 'clear' is always set to 0 (BTRFS_FEATURE_COMPAT_SAFE_CLEAR, > BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR and BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR are > all defined to 0). So remove the code that logically can never execute. The point of the macros is to wrap all values that can mean "compatibility, safe to clear", similar to BTRFS_FEATURE_COMPAT_RO_SUPP etc. So when we have such feature, we'll modify the defines and the rest of the code will work. But with your change the 'safe clear' would have to be patched again. The macros provide complete interface, though some of the bits are not used. A single line of unused code is IMHO not that significant that we have to remove it and silently break the implementation. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 4.12.2017 15:50, David Sterba wrote: > On Fri, Dec 01, 2017 at 11:19:41AM +0200, Nikolay Borisov wrote: >> 'clear' is always set to 0 (BTRFS_FEATURE_COMPAT_SAFE_CLEAR, >> BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR and BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR are >> all defined to 0). So remove the code that logically can never execute. > > The point of the macros is to wrap all values that can mean > "compatibility, safe to clear", similar to BTRFS_FEATURE_COMPAT_RO_SUPP > etc. So when we have such feature, we'll modify the defines and the rest > of the code will work. Fair enough feel free to drop it. > > But with your change the 'safe clear' would have to be patched again. The > macros provide complete interface, though some of the bits are not used. > A single line of unused code is IMHO not that significant that we have > to remove it and silently break the implementation. > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index a8bafed931f4..37dbf2fccedc 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -84,8 +84,6 @@ static int can_modify_feature(struct btrfs_feature_attr *fa) if (set & fa->feature_bit) val |= 1; - if (clear & fa->feature_bit) - val |= 2; return val; }
'clear' is always set to 0 (BTRFS_FEATURE_COMPAT_SAFE_CLEAR, BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR and BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR are all defined to 0). So remove the code that logically can never execute. Signed-off-by: Nikolay Borisov <nborisov@suse.com> --- fs/btrfs/sysfs.c | 2 -- 1 file changed, 2 deletions(-)