From: Chris Mason <chris.mason@fusionio.com>
Date: Wed, 25 Jul 2012 20:11:38 +0000 (-0400)
Subject: Merge branch 'qgroup' of git://git.jan-o-sch.net/btrfs-unstable into for-linus
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b478b2baa37ac99fc04a30809c780dd5dfd43595;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git

Merge branch 'qgroup' of git://git.jan-o-sch.net/btrfs-unstable into for-linus

Conflicts:
	fs/btrfs/ioctl.c
	fs/btrfs/ioctl.h
	fs/btrfs/transaction.c
	fs/btrfs/transaction.h

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
---

b478b2baa37ac99fc04a30809c780dd5dfd43595
diff --cc fs/btrfs/ioctl.c
index 17facea6a51c,1dffd0adf975..e54b663fd3aa
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@@ -1375,12 -1390,11 +1386,10 @@@ out
  }
  
  static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
- 						    char *name,
- 						    unsigned long fd,
- 						    int subvol,
- 						    u64 *transid,
- 						    bool readonly)
+ 				char *name, unsigned long fd, int subvol,
+ 				u64 *transid, bool readonly,
+ 				struct btrfs_qgroup_inherit **inherit)
  {
 -	struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
  	struct file *src_file;
  	int namelen;
  	int ret = 0;
@@@ -1422,11 -1435,9 +1431,11 @@@
  		}
  		ret = btrfs_mksubvol(&file->f_path, name, namelen,
  				     BTRFS_I(src_inode)->root,
- 				     transid, readonly);
+ 				     transid, readonly, inherit);
  		fput(src_file);
  	}
 +out_drop_write:
 +	mnt_drop_write_file(file);
  out:
  	return ret;
  }
@@@ -3484,7 -3675,17 +3686,15 @@@ long btrfs_ioctl(struct file *file, uns
  	case BTRFS_IOC_BALANCE_PROGRESS:
  		return btrfs_ioctl_balance_progress(root, argp);
  	case BTRFS_IOC_GET_DEV_STATS:
 -		return btrfs_ioctl_get_dev_stats(root, argp, 0);
 -	case BTRFS_IOC_GET_AND_RESET_DEV_STATS:
 -		return btrfs_ioctl_get_dev_stats(root, argp, 1);
 +		return btrfs_ioctl_get_dev_stats(root, argp);
+ 	case BTRFS_IOC_QUOTA_CTL:
+ 		return btrfs_ioctl_quota_ctl(root, argp);
+ 	case BTRFS_IOC_QGROUP_ASSIGN:
+ 		return btrfs_ioctl_qgroup_assign(root, argp);
+ 	case BTRFS_IOC_QGROUP_CREATE:
+ 		return btrfs_ioctl_qgroup_create(root, argp);
+ 	case BTRFS_IOC_QGROUP_LIMIT:
+ 		return btrfs_ioctl_qgroup_limit(root, argp);
  	}
  
  	return -ENOTTY;
diff --cc fs/btrfs/ioctl.h
index 4e3e5d342a2b,cdda57f1c240..3f9701d571ea
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@@ -363,8 -411,17 +415,16 @@@ struct btrfs_ioctl_qgroup_create_args 
  					struct btrfs_ioctl_ino_path_args)
  #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \
  					struct btrfs_ioctl_ino_path_args)
 -#define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
 -				      struct btrfs_ioctl_get_dev_stats)
 -#define BTRFS_IOC_GET_AND_RESET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 53, \
 -					struct btrfs_ioctl_get_dev_stats)
 -
 +#define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \
 +				     struct btrfs_ioctl_vol_args)
+ #define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \
+ 			       struct btrfs_ioctl_quota_ctl_args)
+ #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \
+ 			       struct btrfs_ioctl_qgroup_assign_args)
+ #define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \
+ 			       struct btrfs_ioctl_qgroup_create_args)
+ #define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \
+ 			       struct btrfs_ioctl_qgroup_limit_args)
 +#define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
 +				      struct btrfs_ioctl_get_dev_stats)
  #endif
diff --cc fs/btrfs/transaction.c
index 328b95f67660,127283913a42..cc20e95ea289
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@@ -349,9 -354,9 +354,10 @@@ again
  	h->transaction = cur_trans;
  	h->blocks_used = 0;
  	h->bytes_reserved = 0;
+ 	h->root = root;
  	h->delayed_ref_updates = 0;
  	h->use_count = 1;
 +	h->adding_csums = 0;
  	h->block_rsv = NULL;
  	h->orig_rsv = NULL;
  	h->aborted = 0;
diff --cc fs/btrfs/transaction.h
index d314a74b4968,cca315dcdfcd..e8b8416c688b
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@@ -57,7 -59,14 +59,15 @@@ struct btrfs_trans_handle 
  	struct btrfs_block_rsv *block_rsv;
  	struct btrfs_block_rsv *orig_rsv;
  	int aborted;
 +	int adding_csums;
+ 	/*
+ 	 * this root is only needed to validate that the root passed to
+ 	 * start_transaction is the same as the one passed to end_transaction.
+ 	 * Subvolume quota depends on this
+ 	 */
+ 	struct btrfs_root *root;
+ 	struct seq_list delayed_ref_elem;
+ 	struct list_head qgroup_ref_list;
  };
  
  struct btrfs_pending_snapshot {