Skip to contentSkip to conversation

Btrfs: creating the subvolume qgroup automatically when enabling quota

PATCH New Wang Shilong 1 participant 1 message Apr 7, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Btrfs: creating the subvolume qgroup automatically when enabling quota

From: Wang Shilong <[email protected]>

Creating the subvolume/snapshots(including root subvolume) qgroup auotomatically when enabling quota.

---
Changelog:

	V1->V2: Holding [down/up]_write() rather than [down/up]_read()
	when creating qgroup automatically.
---
 fs/btrfs/ioctl.c  |  2 ++
 fs/btrfs/qgroup.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
fs/btrfs/ioctl.c +2 -0
index 898c572..306fb0c 100644
@@ -3693,6 +3693,7 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
 		goto drop_write;
 	}
 
+	down_write(&root->fs_info->subvol_sem);
 	if (sa->cmd != BTRFS_QUOTA_CTL_RESCAN) {
 		trans = btrfs_start_transaction(root, 2);
 		if (IS_ERR(trans)) {
@@ -3726,6 +3727,7 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
 	}
 out:
 	kfree(sa);
+	up_write(&root->fs_info->subvol_sem);
 drop_write:
 	mnt_drop_write_file(file);
 	return ret;
fs/btrfs/qgroup.c +55 -0

73 lines not on this page · raw message

Signature · 1 line
1.7.11.7