[RFC v2 60/83] Add special inode operations.

Andiry Xu
2018-03-10T18:30:09Z

fs/nova/inode.c | 2 ++
fs/nova/namei.c | 5 +++++
fs/nova/nova.h | 1 +
3 files changed, 8 insertions(+)

diff --git a/fs/nova/inode.c b/fs/nova/inode.c
index 2092a55..0e9ab4b 100644
--- a/fs/nova/inode.c
+++ b/fs/nova/inode.c
@@ -239,6 +239,7 @@ static int nova_read_inode(struct super_block *sb, struct inode *inode,
case S_IFLNK:
break;
default:
+ inode->i_op = &nova_special_inode_operations;
init_special_inode(inode, inode->i_mode,
le32_to_cpu(pi->dev.rdev));
break;
@@ -929,6 +930,7 @@ struct inode *nova_new_vfs_inode(enum nova_new_inode_type type,
break;
case TYPE_MKNOD:
init_special_inode(inode, mode, rdev);
+ inode->i_op = &nova_special_inode_operations;
break;
case TYPE_SYMLINK:
inode->i_mapping->a_ops = &nova_aops_dax;
diff --git a/fs/nova/namei.c b/fs/nova/namei.c
index 1966bff..7a81672 100644
--- a/fs/nova/namei.c
+++ b/fs/nova/namei.c
@@ -771,3 +771,8 @@ const struct inode_operations nova_dir_inode_operations = {
.setattr = nova_notify_change,
.get_acl = NULL,
};
+
+const struct inode_operations nova_special_inode_operations = {
+ .setattr = nova_notify_change,
+ .get_acl = NULL,
+};
diff --git a/fs/nova/nova.h b/fs/nova/nova.h
index 03ea0bd..85292d3 100644
--- a/fs/nova/nova.h
+++ b/fs/nova/nova.h
@@ -486,6 +486,7 @@ int nova_remove_dentry(struct dentry *dentry, int dec_link,

/* namei.c */
extern const struct inode_operations nova_dir_inode_operations;
+extern const struct inode_operations nova_special_inode_operations;
extern struct dentry *nova_get_parent(struct dentry *child);

/* rebuild.c */
--
2.7.4