Message ID | 20181119093817.9291-3-jthumshirn@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: fix compiler warning with make W=1 | expand |
On Mon, Nov 19, 2018 at 10:38:14AM +0100, Johannes Thumshirn wrote: > err holds the return value of either btrfs_del_root_ref() or > btrfs_del_inode_ref() but it hasn't been checked since it's introduction with > commit fe66a05a0679 (Btrfs: improve error handling for btrfs_insert_dir_item > callers) in 2012. > > As the error value hasn't been of any interest for 6 years we can just drop it > as well. No, I think there should actually be proper error hanling. This is on the error handling path already so this might be tricky and could require restructuring btrfs_add_link. The error handling is not done everywhere it should and such inconsistencies are more like a hint to improve that than to count the years of negligence. Code removal patches should come with a brief analysis why the code can be safely dropped. You did that, which is great, but the conclusion was wrong.
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 9becf8543489..7f56a235c0b1 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6395,17 +6395,16 @@ int btrfs_add_link(struct btrfs_trans_handle *trans, fail_dir_item: if (unlikely(ino == BTRFS_FIRST_FREE_OBJECTID)) { u64 local_index; - int err; - err = btrfs_del_root_ref(trans, key.objectid, - root->root_key.objectid, parent_ino, - &local_index, name, name_len); + + btrfs_del_root_ref(trans, key.objectid, + root->root_key.objectid, parent_ino, + &local_index, name, name_len); } else if (add_backref) { u64 local_index; - int err; - err = btrfs_del_inode_ref(trans, root, name, name_len, - ino, parent_ino, &local_index); + btrfs_del_inode_ref(trans, root, name, name_len, + ino, parent_ino, &local_index); } return ret; }