From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/2] btrfs: refactor btrfs_free_stale_device() to get device list delete
Date: Mon, 13 Nov 2017 13:44:09 +0800 [thread overview]
Message-ID: <20171113054410.24872-2-anand.jain@oracle.com> (raw)
In-Reply-To: <20171113054410.24872-1-anand.jain@oracle.com>
We need to delete a device from the dev_list, so refactor
btrfs_free_stale_device() for delete_device_from_list().
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/volumes.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8bac1cf17048..8ead85dba6f5 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -546,6 +546,22 @@ static void pending_bios_fn(struct btrfs_work *work)
run_scheduled_bios(device);
}
+void delete_device_from_list(struct btrfs_device *dev)
+{
+ struct btrfs_fs_devices *fs_devs;
+ fs_devs = dev->fs_devices;
+
+ if (fs_devs->num_devices == 1) {
+ btrfs_sysfs_remove_fsid(fs_devs);
+ list_del(&fs_devs->list);
+ free_fs_devices(fs_devs);
+ } else {
+ fs_devs->num_devices--;
+ list_del(&dev->dev_list);
+ rcu_string_free(dev->name);
+ kfree(dev);
+ }
+}
void btrfs_free_stale_device(struct btrfs_device *cur_dev)
{
@@ -586,16 +602,7 @@ void btrfs_free_stale_device(struct btrfs_device *cur_dev)
if (!del) {
/* delete the stale device */
- if (fs_devs->num_devices == 1) {
- btrfs_sysfs_remove_fsid(fs_devs);
- list_del(&fs_devs->list);
- free_fs_devices(fs_devs);
- } else {
- fs_devs->num_devices--;
- list_del(&dev->dev_list);
- rcu_string_free(dev->name);
- kfree(dev);
- }
+ delete_device_from_list(dev);
break;
}
}
--
2.13.1
next prev parent reply other threads:[~2017-11-13 5:44 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 ` Anand Jain [this message]
2017-11-16 13:59 ` [PATCH 1/2] btrfs: refactor btrfs_free_stale_device() to get device list delete 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 ` [PATCH v2 1/2] btrfs: add function to device list delete Anand Jain
2017-11-20 8:38 ` [PATCH v3 " 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=20171113054410.24872-2-anand.jain@oracle.com \
--to=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).