|
@@ -246,6 +246,23 @@ struct flex_groups {
|
|
|
EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\
|
|
|
EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL)
|
|
|
|
|
|
+/* Flags that are appropriate for regular files (all but dir-specific ones). */
|
|
|
+#define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL))
|
|
|
+
|
|
|
+/* Flags that are appropriate for non-directories/regular files. */
|
|
|
+#define EXT4_OTHER_FLMASK (EXT4_NODUMP_FL | EXT4_NOATIME_FL)
|
|
|
+
|
|
|
+/* Mask out flags that are inappropriate for the given type of inode. */
|
|
|
+static inline __u32 ext4_mask_flags(umode_t mode, __u32 flags)
|
|
|
+{
|
|
|
+ if (S_ISDIR(mode))
|
|
|
+ return flags;
|
|
|
+ else if (S_ISREG(mode))
|
|
|
+ return flags & EXT4_REG_FLMASK;
|
|
|
+ else
|
|
|
+ return flags & EXT4_OTHER_FLMASK;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Inode dynamic state flags
|
|
|
*/
|