From: Nikolay Borisov <nborisov@suse.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 1/2] btrfs: match btrfs_device->mode same as it used for open
Date: Thu, 2 Nov 2017 10:47:13 +0200 [thread overview]
Message-ID: <b801c55a-13ad-eb87-7fb1-b816df64eb80@suse.com> (raw)
In-Reply-To: <20171102061117.7430-1-anand.jain@oracle.com>
On 2.11.2017 08:11, Anand Jain wrote:
> This patch maintains consistency of mode in device get and put. And is just
> a cleanup patch. There isn't any problem that was noticed, so no functional
> changes.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> v2: commit update
> v3: commit update
>
> fs/btrfs/volumes.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index b39737568c22..765c2bd2d8d9 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2323,12 +2323,12 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
> u64 tmp;
> int seeding_dev = 0;
> int ret = 0;
> + fmode_t flag = FMODE_WRITE | FMODE_EXCL;
>
> if (sb_rdonly(sb) && !fs_info->fs_devices->seeding)
> return -EROFS;
>
> - bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL,
> - fs_info->bdev_holder);
> + bdev = blkdev_get_by_path(device_path, flag, fs_info->bdev_holder);
> if (IS_ERR(bdev))
> return PTR_ERR(bdev);
>
> @@ -2392,7 +2392,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
> device->bdev = bdev;
> device->in_fs_metadata = 1;
> device->is_tgtdev_for_dev_replace = 0;
> - device->mode = FMODE_EXCL;
> + device->mode = flag;
> device->dev_stats_valid = 1;
> set_blocksize(device->bdev, BTRFS_BDEV_BLOCKSIZE);
>
> @@ -2506,7 +2506,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
> btrfs_sysfs_rm_device_link(fs_info->fs_devices, device);
> kfree(device);
> error:
> - blkdev_put(bdev, FMODE_EXCL);
> + blkdev_put(bdev, flag);
> if (seeding_dev) {
> mutex_unlock(&uuid_mutex);
> up_write(&sb->s_umount);
> @@ -2526,6 +2526,7 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
> struct rcu_string *name;
> u64 devid = BTRFS_DEV_REPLACE_DEVID;
> int ret = 0;
> + fmode_t flags = FMODE_WRITE | FMODE_EXCL;
>
> *device_out = NULL;
> if (fs_info->fs_devices->seeding) {
> @@ -2533,8 +2534,7 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
> return -EINVAL;
> }
>
> - bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL,
> - fs_info->bdev_holder);
> + bdev = blkdev_get_by_path(device_path, flags, fs_info->bdev_holder);
> if (IS_ERR(bdev)) {
> btrfs_err(fs_info, "target device %s is invalid!", device_path);
> return PTR_ERR(bdev);
> @@ -2595,7 +2595,7 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
> device->bdev = bdev;
> device->in_fs_metadata = 1;
> device->is_tgtdev_for_dev_replace = 1;
> - device->mode = FMODE_EXCL;
> + device->mode = flags;
> device->dev_stats_valid = 1;
> set_blocksize(device->bdev, BTRFS_BDEV_BLOCKSIZE);
> device->fs_devices = fs_info->fs_devices;
> @@ -2608,7 +2608,7 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
> return ret;
>
> error:
> - blkdev_put(bdev, FMODE_EXCL);
> + blkdev_put(bdev, flags);
> return ret;
> }
>
>
prev parent reply other threads:[~2017-11-02 8:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 10:33 [PATCH 1/2] btrfs: match btrfs_device->mode same as it used for open Anand Jain
2017-10-20 10:33 ` [PATCH 2/2] btrfs: maintain consistent fmode flags for device open Anand Jain
2017-10-20 12:26 ` [PATCH 1/2] btrfs: match btrfs_device->mode same as it used for open Nikolay Borisov
2017-10-20 14:00 ` Anand Jain
2017-10-20 14:07 ` [PATCH v2 " Anand Jain
2017-10-30 14:39 ` David Sterba
2017-10-31 2:11 ` Anand Jain
2017-10-31 14:21 ` Nikolay Borisov
2017-11-02 5:55 ` Anand Jain
2017-11-02 6:11 ` [PATCH v3 " Anand Jain
2017-11-02 8:47 ` Nikolay Borisov [this message]
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=b801c55a-13ad-eb87-7fb1-b816df64eb80@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).