Message ID | 9f0cf7c0a07faefb4f3af86f8e7c63b56a338b7a.1440405874.git.zhaolei@cn.fujitsu.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Mon, Aug 24, 2015 at 04:45:02PM +0800, Zhao Lei wrote: > If more than one fs_devices in fs_uuids list(as mkfs.btrfs), we need > close them all before exit. > This function is for above propose. > > Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Applied, thanks. -- 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-info.html
diff --git a/volumes.c b/volumes.c index f7462c5..ca50f1c 100644 --- a/volumes.c +++ b/volumes.c @@ -198,6 +198,17 @@ again: return 0; } +void btrfs_close_all_devices(void) +{ + struct btrfs_fs_devices *fs_devices; + + while (!list_empty(&fs_uuids)) { + fs_devices = list_entry(fs_uuids.next, struct btrfs_fs_devices, + list); + btrfs_close_devices(fs_devices); + } +} + int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, int flags) { int fd; diff --git a/volumes.h b/volumes.h index 71d5d66..f776131 100644 --- a/volumes.h +++ b/volumes.h @@ -187,6 +187,7 @@ int btrfs_add_device(struct btrfs_trans_handle *trans, int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, int flags); int btrfs_close_devices(struct btrfs_fs_devices *fs_devices); +void btrfs_close_all_devices(void); int btrfs_add_device(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_device *device);
If more than one fs_devices in fs_uuids list(as mkfs.btrfs), we need close them all before exit. This function is for above propose. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> --- volumes.c | 11 +++++++++++ volumes.h | 1 + 2 files changed, 12 insertions(+)