GFS2: Add "top dir" flag support
authorSteven Whitehouse <steve@chygwyn.com>
Mon, 28 May 2012 14:26:56 +0000 (15:26 +0100)
committerSteven Whitehouse <swhiteho@redhat.com>
Wed, 6 Jun 2012 10:27:36 +0000 (11:27 +0100)
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: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/file.c
include/linux/gfs2_ondisk.h

index 26e2905070ed2987b434ffc595aa066c6a7086d6..6fbf3cbd974d323f1f020c891652e29e335c8c8f 100644 (file)
@@ -142,6 +142,7 @@ static const u32 fsflags_to_gfs2[32] = {
        [7] = GFS2_DIF_NOATIME,
        [12] = GFS2_DIF_EXHASH,
        [14] = GFS2_DIF_INHERIT_JDATA,
+       [17] = GFS2_DIF_TOPDIR,
 };
 
 static const u32 gfs2_to_fsflags[32] = {
@@ -150,6 +151,7 @@ static const u32 gfs2_to_fsflags[32] = {
        [gfs2fl_AppendOnly] = FS_APPEND_FL,
        [gfs2fl_NoAtime] = FS_NOATIME_FL,
        [gfs2fl_ExHash] = FS_INDEX_FL,
+       [gfs2fl_TopLevel] = FS_TOPDIR_FL,
        [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL,
 };
 
@@ -203,6 +205,7 @@ void gfs2_set_inode_flags(struct inode *inode)
                             GFS2_DIF_NOATIME|                  \
                             GFS2_DIF_SYNC|                     \
                             GFS2_DIF_SYSTEM|                   \
+                            GFS2_DIF_TOPDIR|                   \
                             GFS2_DIF_INHERIT_JDATA)
 
 /**
@@ -298,6 +301,7 @@ static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
 
        gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags);
        if (!S_ISDIR(inode->i_mode)) {
+               gfsflags &= ~GFS2_DIF_TOPDIR;
                if (gfsflags & GFS2_DIF_INHERIT_JDATA)
                        gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA);
                return do_gfs2_set_flags(filp, gfsflags, ~0);
index fa98bdb073b96e79c51ca9e0c71bf348d032171a..e8ccf6ff3b4d327a9af116a6fd4a1ff95b8f09f2 100644 (file)
@@ -214,6 +214,7 @@ enum {
        gfs2fl_NoAtime          = 7,
        gfs2fl_Sync             = 8,
        gfs2fl_System           = 9,
+       gfs2fl_TopLevel         = 10,
        gfs2fl_TruncInProg      = 29,
        gfs2fl_InheritDirectio  = 30,
        gfs2fl_InheritJdata     = 31,
@@ -230,8 +231,9 @@ enum {
 #define GFS2_DIF_NOATIME               0x00000080
 #define GFS2_DIF_SYNC                  0x00000100
 #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_INHERIT_DIRECTIO      0x40000000
+#define GFS2_DIF_INHERIT_DIRECTIO      0x40000000 /* only in gfs1 */
 #define GFS2_DIF_INHERIT_JDATA         0x80000000
 
 struct gfs2_dinode {
This page took 0.034268 seconds and 5 git commands to generate.