ceph: quota: add initial infrastructure to support cephfs quotas

This patch adds the infrastructure required to support cephfs quotas as it
is currently implemented in the ceph fuse client.  Cephfs quotas can be
set on any directory, and can restrict the number of bytes or the number
of files stored beneath that point in the directory hierarchy.

Quotas are set using the extended attributes 'ceph.quota.max_files' and
'ceph.quota.max_bytes', and can be removed by setting these attributes to
'0'.

Link: http://tracker.ceph.com/issues/22372
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Luis Henriques
2018-01-05 10:47:18 +00:00
committed by Ilya Dryomov
parent 08a79102aa
commit fb18a57568
11 changed files with 180 additions and 1 deletions

View File

@@ -134,6 +134,7 @@ struct ceph_dir_layout {
#define CEPH_MSG_CLIENT_LEASE 0x311
#define CEPH_MSG_CLIENT_SNAP 0x312
#define CEPH_MSG_CLIENT_CAPRELEASE 0x313
#define CEPH_MSG_CLIENT_QUOTA 0x314
/* pool ops */
#define CEPH_MSG_POOLOP_REPLY 48
@@ -807,4 +808,20 @@ struct ceph_mds_snap_realm {
} __attribute__ ((packed));
/* followed by my snap list, then prior parent snap list */
/*
* quotas
*/
struct ceph_mds_quota {
__le64 ino; /* ino */
struct ceph_timespec rctime;
__le64 rbytes; /* dir stats */
__le64 rfiles;
__le64 rsubdirs;
__u8 struct_v; /* compat */
__u8 struct_compat;
__le32 struct_len;
__le64 max_bytes; /* quota max. bytes */
__le64 max_files; /* quota max. files */
} __attribute__ ((packed));
#endif