Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: provide seperate {inode,file}_operations for snapdir

remove all unsupported operations from {inode,file}_operations.

Signed-off-by: Yan, Zheng <zyan@redhat.com>

authored by

Yan, Zheng and committed by
Ilya Dryomov
38c48b5f 1f041a89

+19 -4
+15 -2
fs/ceph/dir.c
··· 26 26 * point by name. 27 27 */ 28 28 29 - const struct inode_operations ceph_dir_iops; 30 - const struct file_operations ceph_dir_fops; 31 29 const struct dentry_operations ceph_dentry_ops; 32 30 33 31 /* ··· 1333 1335 .fsync = ceph_dir_fsync, 1334 1336 }; 1335 1337 1338 + const struct file_operations ceph_snapdir_fops = { 1339 + .iterate = ceph_readdir, 1340 + .llseek = ceph_dir_llseek, 1341 + .open = ceph_open, 1342 + .release = ceph_release, 1343 + }; 1344 + 1336 1345 const struct inode_operations ceph_dir_iops = { 1337 1346 .lookup = ceph_lookup, 1338 1347 .permission = ceph_permission, ··· 1360 1355 .rename = ceph_rename, 1361 1356 .create = ceph_create, 1362 1357 .atomic_open = ceph_atomic_open, 1358 + }; 1359 + 1360 + const struct inode_operations ceph_snapdir_iops = { 1361 + .lookup = ceph_lookup, 1362 + .permission = ceph_permission, 1363 + .getattr = ceph_getattr, 1364 + .mkdir = ceph_mkdir, 1365 + .rmdir = ceph_unlink, 1363 1366 }; 1364 1367 1365 1368 const struct dentry_operations ceph_dentry_ops = {
+2 -2
fs/ceph/inode.c
··· 82 82 inode->i_mode = parent->i_mode; 83 83 inode->i_uid = parent->i_uid; 84 84 inode->i_gid = parent->i_gid; 85 - inode->i_op = &ceph_dir_iops; 86 - inode->i_fop = &ceph_dir_fops; 85 + inode->i_op = &ceph_snapdir_iops; 86 + inode->i_fop = &ceph_snapdir_fops; 87 87 ci->i_snap_caps = CEPH_CAP_PIN; /* so we can open */ 88 88 ci->i_rbytes = 0; 89 89 return inode;
+2
fs/ceph/super.h
··· 893 893 int ceph_uninline_data(struct file *filp, struct page *locked_page); 894 894 /* dir.c */ 895 895 extern const struct file_operations ceph_dir_fops; 896 + extern const struct file_operations ceph_snapdir_fops; 896 897 extern const struct inode_operations ceph_dir_iops; 898 + extern const struct inode_operations ceph_snapdir_iops; 897 899 extern const struct dentry_operations ceph_dentry_ops, ceph_snap_dentry_ops, 898 900 ceph_snapdir_dentry_ops; 899 901