diff options
-rw-r--r-- | fs/nilfs2/inode.c | 7 | ||||
-rw-r--r-- | fs/nilfs2/nilfs.h | 17 |
2 files changed, 19 insertions, 5 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 2e6ac8e9203a..2534af8d2b5c 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -315,11 +315,8 @@ struct inode *nilfs_new_inode(struct inode *dir, int mode) | |||
315 | /* No lock is needed; iget() ensures it. */ | 315 | /* No lock is needed; iget() ensures it. */ |
316 | } | 316 | } |
317 | 317 | ||
318 | ii->i_flags = NILFS_I(dir)->i_flags; | 318 | ii->i_flags = nilfs_mask_flags( |
319 | if (S_ISLNK(mode)) | 319 | mode, NILFS_I(dir)->i_flags & NILFS_FL_INHERITED); |
320 | ii->i_flags &= ~(FS_IMMUTABLE_FL | FS_APPEND_FL); | ||
321 | if (!S_ISDIR(mode)) | ||
322 | ii->i_flags &= ~FS_DIRSYNC_FL; | ||
323 | 320 | ||
324 | /* ii->i_file_acl = 0; */ | 321 | /* ii->i_file_acl = 0; */ |
325 | /* ii->i_dir_acl = 0; */ | 322 | /* ii->i_dir_acl = 0; */ |
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 777e8fd04304..3e3acb1fdd2f 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
@@ -212,6 +212,23 @@ static inline int nilfs_init_acl(struct inode *inode, struct inode *dir) | |||
212 | 212 | ||
213 | #define NILFS_ATIME_DISABLE | 213 | #define NILFS_ATIME_DISABLE |
214 | 214 | ||
215 | /* Flags that should be inherited by new inodes from their parent. */ | ||
216 | #define NILFS_FL_INHERITED \ | ||
217 | (FS_SECRM_FL | FS_UNRM_FL | FS_COMPR_FL | FS_SYNC_FL | \ | ||
218 | FS_IMMUTABLE_FL | FS_APPEND_FL | FS_NODUMP_FL | FS_NOATIME_FL |\ | ||
219 | FS_COMPRBLK_FL | FS_NOCOMP_FL | FS_NOTAIL_FL | FS_DIRSYNC_FL) | ||
220 | |||
221 | /* Mask out flags that are inappropriate for the given type of inode. */ | ||
222 | static inline __u32 nilfs_mask_flags(umode_t mode, __u32 flags) | ||
223 | { | ||
224 | if (S_ISDIR(mode)) | ||
225 | return flags; | ||
226 | else if (S_ISREG(mode)) | ||
227 | return flags & ~(FS_DIRSYNC_FL | FS_TOPDIR_FL); | ||
228 | else | ||
229 | return flags & (FS_NODUMP_FL | FS_NOATIME_FL); | ||
230 | } | ||
231 | |||
215 | /* dir.c */ | 232 | /* dir.c */ |
216 | extern int nilfs_add_link(struct dentry *, struct inode *); | 233 | extern int nilfs_add_link(struct dentry *, struct inode *); |
217 | extern ino_t nilfs_inode_by_name(struct inode *, const struct qstr *); | 234 | extern ino_t nilfs_inode_by_name(struct inode *, const struct qstr *); |