Message ID | 5d46b47eaa1ab5c82ad17cb4e3d59ddf9857ff4e.1695333082.git.fdmanana@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: some cleanups around inode update and helpers | expand |
On 2023/9/22 20:07, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > The following condition at btrfs_dirty_inode() is redundant: > > if (ret && (ret == -ENOSPC || ret == -EDQUOT)) > > The first check for a non-zero 'ret' value is pointless, we can simplify > this to simply: > > if (ret == -ENOSPC || ret == -EDQUOT) > > Not only this makes it easier to read, it also slightly reduces the text > size of the btrfs kernel module: > > $ size fs/btrfs/btrfs.ko.before > text data bss dec hex filename > 1641400 168265 16864 1826529 1bdee1 fs/btrfs/btrfs.ko.before > > $ size fs/btrfs/btrfs.ko.after > text data bss dec hex filename > 1641224 168181 16864 1826269 1bdddd fs/btrfs/btrfs.ko.after > > Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> A little surprised that compiler didn't optimize it out. Thanks, Qu > --- > fs/btrfs/inode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 514d2e8a4f52..f16dfeabeaf0 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -6011,7 +6011,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode) > return PTR_ERR(trans); > > ret = btrfs_update_inode(trans, root, inode); > - if (ret && (ret == -ENOSPC || ret == -EDQUOT)) { > + if (ret == -ENOSPC || ret == -EDQUOT) { > /* whoops, lets try again with the full transaction */ > btrfs_end_transaction(trans); > trans = btrfs_start_transaction(root, 1);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 514d2e8a4f52..f16dfeabeaf0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6011,7 +6011,7 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode) return PTR_ERR(trans); ret = btrfs_update_inode(trans, root, inode); - if (ret && (ret == -ENOSPC || ret == -EDQUOT)) { + if (ret == -ENOSPC || ret == -EDQUOT) { /* whoops, lets try again with the full transaction */ btrfs_end_transaction(trans); trans = btrfs_start_transaction(root, 1);