Linux-BTRFS Archive on lore.kernel.org
 help / color / 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
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 index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  7:02 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 publically 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

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox