linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 0/5] Misc props.c cleanups
Date: Fri, 8 Feb 2019 09:15:05 +0200	[thread overview]
Message-ID: <b8e25617-15ff-0a5e-7d9d-d2ad7e070887@suse.com> (raw)
In-Reply-To: <1549609355-11053-1-git-send-email-anand.jain@oracle.com>



On 8.02.19 г. 9:02 ч., Anand Jain wrote:
> While adding the readmirror property found few cleanup things which
> can be fixed. As these aren't part of upcoming readmirror property
> I am sending these separately. Except for 1/5 rest fixes are in
> props.c. 1/5 is in volume.c.
> 
> Anand Jain (5):
>   btrfs: fix comment its device list mutex not volume lock
>   btrfs: kill __btrfs_set_prop()
>   btrfs: reorg functions to drop forward declaration
>   btrfs: drop redundant forward declaration in props.c
>   btrfs: trivial, fix c coding style
> 
>  fs/btrfs/ioctl.c   |  10 +--
>  fs/btrfs/props.c   | 201 ++++++++++++++++++++++++-----------------------------
>  fs/btrfs/props.h   |   6 +-
>  fs/btrfs/volumes.c |   2 +-
>  fs/btrfs/xattr.c   |   2 +-
>  5 files changed, 100 insertions(+), 121 deletions(-)
> 

Allow me to suggest to introduce another patch with the following hunk:

diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index ea78c3d6dcfc..37e9af2a9f8c 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -229,12 +229,11 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans,
        if (btrfs_root_readonly(root))
                return -EROFS;

-       if (trans)
-               return do_setxattr(trans, inode, name, value, size, flags);
-
-       trans = btrfs_start_transaction(root, 2);
-       if (IS_ERR(trans))
-               return PTR_ERR(trans);
+       if (!trans) {
+               trans = btrfs_start_transaction(root, 2);
+               if (IS_ERR(trans))
+                       return PTR_ERR(trans);
+       }

        ret = do_setxattr(trans, inode, name, value, size, flags);
        if (ret)


This just inverts the logic for !trans and makes the code a bit more
linear and (IMO) easier to follow.

  parent reply	other threads:[~2019-02-08  7:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  7:02 [PATCH 0/5] Misc props.c cleanups Anand Jain
2019-02-08  7:02 ` [PATCH 1/5] btrfs: fix comment its device list mutex not volume lock Anand Jain
2019-02-08  7:07   ` Nikolay Borisov
2019-02-08  7:16     ` Anand Jain
2019-02-08  7:19       ` Nikolay Borisov
2019-02-08  7:39         ` [PATCH v2 " Anand Jain
2019-02-11 18:41           ` David Sterba
2019-02-08  7:02 ` [PATCH 2/5] btrfs: kill __btrfs_set_prop() Anand Jain
2019-02-08  7:02 ` [PATCH 3/5] btrfs: reorg functions to drop forward declaration Anand Jain
2019-02-08  7:10   ` Nikolay Borisov
2019-02-11 18:43     ` David Sterba
2019-02-08  7:02 ` [PATCH 4/5] btrfs: drop redundant forward declaration in props.c Anand Jain
2019-02-08  7:09   ` Nikolay Borisov
2019-02-08  7:02 ` [PATCH 5/5] btrfs: trivial, fix c coding style Anand Jain
2019-02-08  7:09   ` Nikolay Borisov
2019-02-08  7:15 ` Nikolay Borisov [this message]
2019-02-08  7:31   ` [PATCH 0/5] Misc props.c cleanups Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8e25617-15ff-0a5e-7d9d-d2ad7e070887@suse.com \
    --to=nborisov@suse.com \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).