Skip to content

Commit

Permalink
fix build issue with kernels >=5.14
Browse files Browse the repository at this point in the history
  • Loading branch information
abbbi committed Sep 10, 2021
1 parent 2ac3eb5 commit 7381a0c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nullfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,14 @@ const struct inode_operations nullfs_special_inode_operations = {
.getattr = nullfs_getattr,
.set_acl = nullfs_set_acl,
};
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
static const struct address_space_operations nullfs_aops = {
.readpage = simple_readpage,
.write_begin = simple_write_begin,
.write_end = simple_write_end,
.direct_IO = noop_direct_IO
};
#endif

static const struct inode_operations nullfs_dir_inode_operations;
static const struct super_operations nullfs_ops;
Expand Down Expand Up @@ -323,7 +325,11 @@ struct inode *nullfs_get_inode(struct super_block *sb,
#else
inode_init_owner(inode, dir, mode);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0)
inode->i_mapping->a_ops = &ram_aops;
#else
inode->i_mapping->a_ops = &nullfs_aops;
#endif
if (!uid_eq(fsi->mount_opts.uid, GLOBAL_ROOT_UID))
inode->i_uid = fsi->mount_opts.uid;
if (!gid_eq(fsi->mount_opts.gid, GLOBAL_ROOT_GID))
Expand Down

0 comments on commit 7381a0c

Please sign in to comment.