summaryrefslogtreecommitdiffstats
path: root/fs/ceph/inode.c
diff options
context:
space:
mode:
authorLuis Henriques <lhenriques@suse.com>2018-01-05 10:47:18 +0000
committerIlya Dryomov <idryomov@gmail.com>2018-04-02 11:17:51 +0200
commitfb18a57568c2b84cd611e242c0f6fa97b45e4907 (patch)
tree0f447778c8ce55e583cd8cf8eb8e945d38b5c208 /fs/ceph/inode.c
parent08a79102aa373e03ce704621fd84567605214465 (diff)
downloadlinux-fb18a57568c2b84cd611e242c0f6fa97b45e4907.tar.bz2
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>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r--fs/ceph/inode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index be5f12d0d637..2c6f8be4ed63 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -441,6 +441,9 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
atomic64_set(&ci->i_complete_seq[1], 0);
ci->i_symlink = NULL;
+ ci->i_max_bytes = 0;
+ ci->i_max_files = 0;
+
memset(&ci->i_dir_layout, 0, sizeof(ci->i_dir_layout));
RCU_INIT_POINTER(ci->i_layout.pool_ns, NULL);
@@ -790,6 +793,9 @@ static int fill_inode(struct inode *inode, struct page *locked_page,
inode->i_rdev = le32_to_cpu(info->rdev);
inode->i_blkbits = fls(le32_to_cpu(info->layout.fl_stripe_unit)) - 1;
+ ci->i_max_bytes = iinfo->max_bytes;
+ ci->i_max_files = iinfo->max_files;
+
if ((new_version || (new_issued & CEPH_CAP_AUTH_SHARED)) &&
(issued & CEPH_CAP_AUTH_EXCL) == 0) {
inode->i_mode = le32_to_cpu(info->mode);