From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 1/2] btrfs: add function to device list delete
Date: Mon, 20 Nov 2017 16:23:20 +0800 [thread overview]
Message-ID: <7bf08094-478e-d417-c757-b319a667d482@oracle.com> (raw)
In-Reply-To: <20171118140337.13612-1-anand.jain@oracle.com>
Wrong ML. Pls ignore.
Thanks, Anand
On 11/18/2017 10:03 PM, Anand Jain wrote:
> We need device delete from the dev_list so create a new function,
> instead of refactor of btrfs_free_stale_device() because,
> btrfs_free_stale_device() doesn't hold device_list_mutex which
> is actually needed here.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> v1: title of this patch
> btrfs: refactor btrfs_free_stale_device() to get device list delete
> v2:
> add new function instead of peal from
> btrfs_free_stale_device() to delete a device from the device list,
> since btrfs_free_stale_device() does not hold device_list_mutex,
> may be it can be fixed later.
>
>
> /btrfs/volumes.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index bddf75d5e6a0..68f1dd44385b 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -546,6 +546,27 @@ static void pending_bios_fn(struct btrfs_work *work)
> run_scheduled_bios(device);
> }
>
> +static void delete_device_from_list(struct btrfs_device *device)
> +{
> + struct btrfs_fs_devices *fs_devices;
> + fs_devices = device->fs_devices;
> +
> + lockdep_assert_held(&uuid_mutex);
> +
> + mutex_lock(&fs_devices->device_list_mutex);
> + fs_devices->num_devices--;
> + list_del(&device->dev_list);
> + mutex_unlock(&fs_devices->device_list_mutex);
> +
> + rcu_string_free(device->name);
> + kfree(device);
> +
> + if (fs_devices->num_devices == 0) {
> + btrfs_sysfs_remove_fsid(fs_devices);
> + list_del(&fs_devices->list);
> + free_fs_devices(fs_devices);
> + }
> +}
>
> void btrfs_free_stale_device(struct btrfs_device *cur_dev)
> {
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-
next prev parent reply other threads:[~2017-11-20 8:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-13 5:44 [PATCH 0/2] Add cli and ioctl to ignore a scanned device Anand Jain
2017-11-13 5:44 ` [PATCH 1/2] btrfs: refactor btrfs_free_stale_device() to get device list delete Anand Jain
2017-11-16 13:59 ` Nikolay Borisov
2017-11-18 13:50 ` Anand Jain
2017-11-13 5:44 ` [PATCH 2/2] btrfs: introduce feature to ignore a btrfs device Anand Jain
2017-11-16 14:03 ` Nikolay Borisov
2017-11-18 13:50 ` Anand Jain
2017-11-16 14:11 ` Nikolay Borisov
2017-11-18 13:50 ` Anand Jain
2017-11-18 14:28 ` Nikolay Borisov
2017-11-20 8:21 ` Anand Jain
2017-11-13 5:45 ` [PATCH] btrfs-progs: add 'btrfs device ignore' cli Anand Jain
2017-11-18 14:03 ` [PATCH v2 1/2] btrfs: add function to device list delete Anand Jain
2017-11-18 14:03 ` [PATCH v2 2/2] btrfs: introduce feature to ignore a btrfs device Anand Jain
2017-11-20 8:23 ` Anand Jain [this message]
2017-11-20 8:38 ` [PATCH v3 1/2] btrfs: add function to device list delete Anand Jain
2017-11-20 8:38 ` [PATCH v3 2/2] btrfs: introduce feature to ignore a btrfs device 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=7bf08094-478e-d417-c757-b319a667d482@oracle.com \
--to=anand.jain@oracle.com \
--cc=fstests@vger.kernel.org \
--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).