From: Su Yue <l@damenly.su>
To: Anand Jain <anand.jain@oracle.com>
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.com
Subject: Re: [PATCH v3 2/4] btrfs: save latest btrfs_device instead of its block_device in fs_devices
Date: Sat, 21 Aug 2021 22:46:58 +0800 [thread overview]
Message-ID: <v93yets9.fsf@damenly.su> (raw)
In-Reply-To: <61d6dafaff6a119f56782fb35b2374411585b634.1629458519.git.anand.jain@oracle.com>
On Fri 20 Aug 2021 at 19:28, Anand Jain <anand.jain@oracle.com>
wrote:
> In preparation to fix a bug in btrfs_show_devname(), save the
> device with
> the largest generation in fs_info instead of just its bdev. So
> that
> btrfs_show_devname() can read device's name.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> v2: born
> v3: -
> fs/btrfs/disk-io.c | 6 +++---
> fs/btrfs/extent_io.c | 2 +-
> fs/btrfs/inode.c | 2 +-
> fs/btrfs/procfs.c | 6 +++---
>
Try to test the patchset but...
I can't find procfs in Linus/master, kdave/misc-next, v5.14-rc6
even
through Google search.
--
Su
> fs/btrfs/super.c | 2 +-
> fs/btrfs/volumes.c | 10 +++++-----
> fs/btrfs/volumes.h | 2 +-
> 7 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 1052437cec64..c0d2c093b874 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3228,12 +3228,12 @@ int __cold open_ctree(struct super_block
> *sb, struct btrfs_fs_devices *fs_device
> mapping_set_gfp_mask(fs_info->btree_inode->i_mapping,
> GFP_NOFS);
> btrfs_init_btree_inode(fs_info);
>
> - invalidate_bdev(fs_devices->latest_bdev);
> + invalidate_bdev(fs_devices->latest_dev->bdev);
>
> /*
> * Read super block and check the signature bytes only
> */
> - disk_super = btrfs_read_dev_super(fs_devices->latest_bdev);
> + disk_super =
> btrfs_read_dev_super(fs_devices->latest_dev->bdev);
> if (IS_ERR(disk_super)) {
> err = PTR_ERR(disk_super);
> goto fail_alloc;
> @@ -3466,7 +3466,7 @@ int __cold open_ctree(struct super_block
> *sb, struct btrfs_fs_devices *fs_device
> * below in btrfs_init_dev_replace().
> */
> btrfs_free_extra_devids(fs_devices);
> - if (!fs_devices->latest_bdev) {
> + if (!fs_devices->latest_dev->bdev) {
> btrfs_err(fs_info, "failed to read devices");
> goto fail_tree_roots;
> }
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index aaddd7225348..edf0162c9020 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -3327,7 +3327,7 @@ static int alloc_new_bio(struct
> btrfs_inode *inode,
> if (wbc) {
> struct block_device *bdev;
>
> - bdev = fs_info->fs_devices->latest_bdev;
> + bdev = fs_info->fs_devices->latest_dev->bdev;
> bio_set_dev(bio, bdev);
> wbc_init_bio(wbc, bio);
> }
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 2aa9646bce56..ceedcd54e6d2 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -7961,7 +7961,7 @@ static int btrfs_dio_iomap_begin(struct
> inode *inode, loff_t start,
> iomap->type = IOMAP_MAPPED;
> }
> iomap->offset = start;
> - iomap->bdev = fs_info->fs_devices->latest_bdev;
> + iomap->bdev = fs_info->fs_devices->latest_dev->bdev;
> iomap->length = len;
>
> if (write && btrfs_use_zone_append(BTRFS_I(inode),
> em->block_start))
> diff --git a/fs/btrfs/procfs.c b/fs/btrfs/procfs.c
> index 30eaeca07aeb..2c3bb474c28f 100644
> --- a/fs/btrfs/procfs.c
> +++ b/fs/btrfs/procfs.c
> @@ -291,9 +291,9 @@ void btrfs_print_fsinfo(struct seq_file
> *seq)
> bdevname(fs_info->sb->s_bdev, b) :
> "null");
> BTRFS_SEQ_PRINT2("\tlatest_bdev:\t\t%s\n",
> - fs_devices->latest_bdev ?
> - bdevname(fs_devices->latest_bdev, b) :
> - "null");
> + fs_devices->latest_dev->bdev ?
> + bdevname(fs_devices->latest_dev->bdev, b) :
> + "null");
>
> fs_state_to_str(fs_info, fs_str);
> BTRFS_SEQ_PRINT2("\tfs_state:\t\t%s\n", fs_str);
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 1f9dd1a4faa3..64ecbdb50c1a 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -1706,7 +1706,7 @@ static struct dentry
> *btrfs_mount_root(struct file_system_type *fs_type,
> goto error_close_devices;
> }
>
> - bdev = fs_devices->latest_bdev;
> + bdev = fs_devices->latest_dev->bdev;
> s = sget(fs_type, btrfs_test_super, btrfs_set_super, flags |
> SB_NOSEC,
> fs_info);
> if (IS_ERR(s)) {
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 51cf68785782..958503c8a854 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1091,7 +1091,7 @@ void btrfs_free_extra_devids(struct
> btrfs_fs_devices *fs_devices)
> list_for_each_entry(seed_dev, &fs_devices->seed_list,
> seed_list)
> __btrfs_free_extra_devids(seed_dev, &latest_dev);
>
> - fs_devices->latest_bdev = latest_dev->bdev;
> + fs_devices->latest_dev = latest_dev;
>
> mutex_unlock(&uuid_mutex);
> }
> @@ -1206,7 +1206,7 @@ static int open_fs_devices(struct
> btrfs_fs_devices *fs_devices,
> return -EINVAL;
>
> fs_devices->opened = 1;
> - fs_devices->latest_bdev = latest_dev->bdev;
> + fs_devices->latest_dev = latest_dev;
> fs_devices->total_rw_bytes = 0;
> fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR;
> fs_devices->read_policy = BTRFS_READ_POLICY_PID;
> @@ -1968,7 +1968,7 @@ static struct btrfs_device *
> btrfs_find_next_active_device(
> }
>
> /*
> - * Helper function to check if the given device is part of
> s_bdev / latest_bdev
> + * Helper function to check if the given device is part of
> s_bdev / latest_dev
> * and replace it with the provided or the next active device,
> in the context
> * where this function called, there should be always be
> another device (or
> * this_dev) which is active.
> @@ -1987,8 +1987,8 @@ void __cold
> btrfs_assign_next_active_device(struct btrfs_device *device,
> (fs_info->sb->s_bdev == device->bdev))
> fs_info->sb->s_bdev = next_device->bdev;
>
> - if (fs_info->fs_devices->latest_bdev == device->bdev)
> - fs_info->fs_devices->latest_bdev = next_device->bdev;
> + if (fs_info->fs_devices->latest_dev->bdev == device->bdev)
> + fs_info->fs_devices->latest_dev = next_device;
> }
>
> /*
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index 4c941b4dd269..150b4cd8f81f 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -246,7 +246,7 @@ struct btrfs_fs_devices {
> /* Highest generation number of seen devices */
> u64 latest_generation;
>
> - struct block_device *latest_bdev;
> + struct btrfs_device *latest_dev;
>
> /* all of the devices in the FS, protected by a mutex
> * so we can safely walk it to write out the supers without
next prev parent reply other threads:[~2021-08-21 14:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-20 11:28 [PATCH v3 0/4] btrf_show_devname related fixes Anand Jain
2021-08-20 11:28 ` [PATCH v3 1/4] btrfs: consolidate device_list_mutex in prepare_sprout to its parent Anand Jain
2021-08-23 11:31 ` [PATCH RFC v4 " Anand Jain
2021-08-20 11:28 ` [PATCH v3 2/4] btrfs: save latest btrfs_device instead of its block_device in fs_devices Anand Jain
2021-08-21 14:46 ` Su Yue [this message]
2021-08-23 3:03 ` Anand Jain
2021-08-20 11:28 ` [PATCH v3 3/4] btrfs: use latest_dev in btrfs_show_devname Anand Jain
2021-08-23 11:31 ` [PATCH RFC v4 " Anand Jain
2021-08-20 11:28 ` [PATCH v3 4/4] btrfs: update latest_dev when we sprout Anand Jain
2021-08-23 11:31 ` [PATCH v4 " Anand Jain
2021-08-20 11:32 ` [PATCH v3 0/4] btrf_show_devname related fixes Anand Jain
2021-08-23 11:31 ` [PATCH v4 " Anand Jain
2021-08-23 11:31 ` [PATCH v4 2/4] btrfs: save latest btrfs_device instead of its block_device in fs_devices Anand Jain
2021-08-23 11:45 ` [PATCH v3 0/4] btrf_show_devname related fixes David Sterba
2021-08-23 19:46 ` [PATCH v4 " David Sterba
2021-08-24 0:28 ` Anand Jain
2021-08-24 16:11 ` David Sterba
2021-08-25 2:13 ` Anand Jain
2021-08-31 15:40 ` David Sterba
2021-09-01 8:18 ` Anand Jain
2021-09-01 16:16 ` David Sterba
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=v93yets9.fsf@damenly.su \
--to=l@damenly.su \
--cc=anand.jain@oracle.com \
--cc=dsterba@suse.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