Thread (8 messages) 8 messages, 3 authors, 2012-07-04
STALE5125d

[PATCH 3/3] Btrfs: use helper function to simplify code

From: Liu Bo <hidden>
Date: 2012-06-29 09:55:27
Subsystem: btrfs file system, filesystems (vfs and infrastructure), the rest · Maintainers: Chris Mason, David Sterba, Alexander Viro, Christian Brauner, Linus Torvalds

We've made a helper function for reading root, so just apply it.

Signed-off-by: Liu Bo <redacted>
---
 fs/btrfs/ioctl.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index f9c2180..9b93fda 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2844,7 +2844,6 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 	struct btrfs_dir_item *di;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_path *path;
-	struct btrfs_key location;
 	struct btrfs_disk_key disk_key;
 	struct btrfs_super_block *disk_super;
 	u64 features;
@@ -2857,20 +2856,10 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 	if (copy_from_user(&objectid, argp, sizeof(objectid)))
 		return -EFAULT;
 
-	if (!objectid)
-		objectid = root->root_key.objectid;
-
-	location.objectid = objectid;
-	location.type = BTRFS_ROOT_ITEM_KEY;
-	location.offset = (u64)-1;
-
-	new_root = btrfs_read_fs_root_no_name(root->fs_info, &location);
+	new_root = __btrfs_subvol_get_root(root, objectid);
 	if (IS_ERR(new_root))
 		return PTR_ERR(new_root);
 
-	if (btrfs_root_refs(&new_root->root_item) == 0)
-		return -ENOENT;
-
 	path = btrfs_alloc_path();
 	if (!path)
 		return -ENOMEM;
-- 
1.6.5.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help