From: Anand Jain <Anand.Jain@oracle.com>
To: Jeff Mahoney <jeffm@suse.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>,
David Sterba <dsterba@suse.cz>
Subject: Re: [PATCH] btrfs: handle add/remove of sysfs links when devices are added/removed
Date: Mon, 26 May 2014 17:51:35 +0800 [thread overview]
Message-ID: <53830EA7.0@oracle.com> (raw)
In-Reply-To: <537FAA8B.3060402@suse.com>
Jeff,
We were working on the same bugs. I have sent out my patches
as well.
Further I will be working on to revamp /sys/fs/btrfs/<fsid>/devices
so that instead of links to block device we will have dir based
on devices of the FS.
[PATCH RFC] btrfs: revamp /sys/fs/btrfs/<fsid>/devices
Comments appreciated.
Thanks, Anand
On 24/05/14 04:07, Jeff Mahoney wrote:
>
> btrfs currently publishes device membership via sysfs based on the devices
> present when the file system is mounted. That publishing is not updated
> when devices are added or removed while mounted.
>
> This patch handles those events.
>
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> ---
> fs/btrfs/volumes.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1704,6 +1704,9 @@ int btrfs_rm_device(struct btrfs_root *r
>
> ret = 0;
>
> + sysfs_remove_link(root->fs_info->device_dir_kobj,
> + part_to_dev(bdev->bd_part)->kobj.name);
> +
> /* Notify udev that device has changed */
> if (bdev)
> btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
> @@ -2038,6 +2041,12 @@ int btrfs_init_new_device(struct btrfs_r
> goto error;
> }
>
> + ret = sysfs_create_link(root->fs_info->device_dir_kobj,
> + &part_to_dev(bdev->bd_part)->kobj,
> + part_to_dev(bdev->bd_part)->kobj.name);
> + if (ret)
> + goto error;
> +
> lock_chunks(root);
>
> q = bdev_get_queue(bdev);
> @@ -2152,6 +2161,8 @@ error_trans:
> unlock_chunks(root);
> btrfs_end_transaction(trans, root);
> rcu_string_free(device->name);
> + sysfs_remove_link(root->fs_info->device_dir_kobj,
> + part_to_dev(bdev->bd_part)->kobj.name);
> kfree(device);
> error:
> blkdev_put(bdev, FMODE_EXCL);
>
prev parent reply other threads:[~2014-05-26 9:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-23 20:07 [PATCH] btrfs: handle add/remove of sysfs links when devices are added/removed Jeff Mahoney
2014-05-26 9:51 ` Anand Jain [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=53830EA7.0@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--cc=jeffm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.