提交 23d0bb83 编写于 作者: S Steven Whitehouse 提交者: Steven Whitehouse

GFS2: Add "top dir" flag support

This patch adds support for the "top dir" flag. Currently this is unused
but a subsequent patch is planned which will add support for the
Orlov allocation policy when allocating subdirectories in a parent
with this flag set.

In order to ensure backward compatible behaviour, mkfs.gfs2 does
not currently tag the root directory with this flag, it must always be
set manually.
Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
上级 5407e242
...@@ -142,6 +142,7 @@ static const u32 fsflags_to_gfs2[32] = { ...@@ -142,6 +142,7 @@ static const u32 fsflags_to_gfs2[32] = {
[7] = GFS2_DIF_NOATIME, [7] = GFS2_DIF_NOATIME,
[12] = GFS2_DIF_EXHASH, [12] = GFS2_DIF_EXHASH,
[14] = GFS2_DIF_INHERIT_JDATA, [14] = GFS2_DIF_INHERIT_JDATA,
[17] = GFS2_DIF_TOPDIR,
}; };
static const u32 gfs2_to_fsflags[32] = { static const u32 gfs2_to_fsflags[32] = {
...@@ -150,6 +151,7 @@ static const u32 gfs2_to_fsflags[32] = { ...@@ -150,6 +151,7 @@ static const u32 gfs2_to_fsflags[32] = {
[gfs2fl_AppendOnly] = FS_APPEND_FL, [gfs2fl_AppendOnly] = FS_APPEND_FL,
[gfs2fl_NoAtime] = FS_NOATIME_FL, [gfs2fl_NoAtime] = FS_NOATIME_FL,
[gfs2fl_ExHash] = FS_INDEX_FL, [gfs2fl_ExHash] = FS_INDEX_FL,
[gfs2fl_TopLevel] = FS_TOPDIR_FL,
[gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL, [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL,
}; };
...@@ -203,6 +205,7 @@ void gfs2_set_inode_flags(struct inode *inode) ...@@ -203,6 +205,7 @@ void gfs2_set_inode_flags(struct inode *inode)
GFS2_DIF_NOATIME| \ GFS2_DIF_NOATIME| \
GFS2_DIF_SYNC| \ GFS2_DIF_SYNC| \
GFS2_DIF_SYSTEM| \ GFS2_DIF_SYSTEM| \
GFS2_DIF_TOPDIR| \
GFS2_DIF_INHERIT_JDATA) GFS2_DIF_INHERIT_JDATA)
/** /**
...@@ -298,6 +301,7 @@ static int gfs2_set_flags(struct file *filp, u32 __user *ptr) ...@@ -298,6 +301,7 @@ static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags);
if (!S_ISDIR(inode->i_mode)) { if (!S_ISDIR(inode->i_mode)) {
gfsflags &= ~GFS2_DIF_TOPDIR;
if (gfsflags & GFS2_DIF_INHERIT_JDATA) if (gfsflags & GFS2_DIF_INHERIT_JDATA)
gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA); gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA);
return do_gfs2_set_flags(filp, gfsflags, ~0); return do_gfs2_set_flags(filp, gfsflags, ~0);
......
...@@ -214,6 +214,7 @@ enum { ...@@ -214,6 +214,7 @@ enum {
gfs2fl_NoAtime = 7, gfs2fl_NoAtime = 7,
gfs2fl_Sync = 8, gfs2fl_Sync = 8,
gfs2fl_System = 9, gfs2fl_System = 9,
gfs2fl_TopLevel = 10,
gfs2fl_TruncInProg = 29, gfs2fl_TruncInProg = 29,
gfs2fl_InheritDirectio = 30, gfs2fl_InheritDirectio = 30,
gfs2fl_InheritJdata = 31, gfs2fl_InheritJdata = 31,
...@@ -230,8 +231,9 @@ enum { ...@@ -230,8 +231,9 @@ enum {
#define GFS2_DIF_NOATIME 0x00000080 #define GFS2_DIF_NOATIME 0x00000080
#define GFS2_DIF_SYNC 0x00000100 #define GFS2_DIF_SYNC 0x00000100
#define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */ #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */
#define GFS2_DIF_TOPDIR 0x00000400 /* New in gfs2 */
#define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */ #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */
#define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 /* only in gfs1 */
#define GFS2_DIF_INHERIT_JDATA 0x80000000 #define GFS2_DIF_INHERIT_JDATA 0x80000000
struct gfs2_dinode { struct gfs2_dinode {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册