]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - fs/ceph/quota.c
1b69d8365ec2df2abe52e7209103a11dd619fbca
1 // SPDX-License-Identifier: GPL-2.0
3 * quota.c - CephFS quota
5 * Copyright (C) 2017-2018 SUSE
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #include "mds_client.h"
24 void ceph_handle_quota(struct ceph_mds_client
*mdsc
,
25 struct ceph_mds_session
*session
,
28 struct super_block
*sb
= mdsc
->fsc
->sb
;
29 struct ceph_mds_quota
*h
= msg
->front
.iov_base
;
30 struct ceph_vino vino
;
32 struct ceph_inode_info
*ci
;
34 if (msg
->front
.iov_len
!= sizeof(*h
)) {
35 pr_err("%s corrupt message mds%d len %d\n", __func__
,
36 session
->s_mds
, (int)msg
->front
.iov_len
);
41 /* increment msg sequence number */
42 mutex_lock(&session
->s_mutex
);
44 mutex_unlock(&session
->s_mutex
);
47 vino
.ino
= le64_to_cpu(h
->ino
);
48 vino
.snap
= CEPH_NOSNAP
;
49 inode
= ceph_find_inode(sb
, vino
);
51 pr_warn("Failed to find inode %llu\n", vino
.ino
);
54 ci
= ceph_inode(inode
);
56 spin_lock(&ci
->i_ceph_lock
);
57 ci
->i_rbytes
= le64_to_cpu(h
->rbytes
);
58 ci
->i_rfiles
= le64_to_cpu(h
->rfiles
);
59 ci
->i_rsubdirs
= le64_to_cpu(h
->rsubdirs
);
60 ci
->i_max_bytes
= le64_to_cpu(h
->max_bytes
);
61 ci
->i_max_files
= le64_to_cpu(h
->max_files
);
62 spin_unlock(&ci
->i_ceph_lock
);