aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-04-25 13:20:27 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-25 13:20:27 -0400
commit4bcf7091f9da595016f9d1175aa1bea8e736566f (patch)
treee1ebe2ac39eff1d73b4f974174e3a61682107a10
parentb5ea3e1ef307548bdd40fff6aba5fc96b002f284 (diff)
[GFS2] Remove inherited flags from exported flags.
We don't need the inherited flags since this action can be implied by setting the flags on directories where they wouldn't otherwise make sense. It reduces the number of extra flags by two. Also updated the list of flags to take account of one extra ext2/3 flag. Cc: Andreas Dilger <adilger@clusterfs.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/ops_file.c23
-rw-r--r--include/linux/iflags.h10
2 files changed, 13 insertions, 20 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 3fb1a29f88a6..c2dbc300a50c 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -545,8 +545,6 @@ static const u32 iflags_to_gfs2[32] = {
545 [iflag_Index] = GFS2_DIF_EXHASH, 545 [iflag_Index] = GFS2_DIF_EXHASH,
546 [iflag_JournalData] = GFS2_DIF_JDATA, 546 [iflag_JournalData] = GFS2_DIF_JDATA,
547 [iflag_DirectIO] = GFS2_DIF_DIRECTIO, 547 [iflag_DirectIO] = GFS2_DIF_DIRECTIO,
548 [iflag_InheritDirectIO] = GFS2_DIF_INHERIT_DIRECTIO,
549 [iflag_InheritJdata] = GFS2_DIF_INHERIT_JDATA,
550}; 548};
551 549
552static const u32 gfs2_to_iflags[32] = { 550static const u32 gfs2_to_iflags[32] = {
@@ -557,8 +555,8 @@ static const u32 gfs2_to_iflags[32] = {
557 [gfs2fl_ExHash] = IFLAG_INDEX, 555 [gfs2fl_ExHash] = IFLAG_INDEX,
558 [gfs2fl_Jdata] = IFLAG_JOURNAL_DATA, 556 [gfs2fl_Jdata] = IFLAG_JOURNAL_DATA,
559 [gfs2fl_Directio] = IFLAG_DIRECTIO, 557 [gfs2fl_Directio] = IFLAG_DIRECTIO,
560 [gfs2fl_InheritDirectio] = IFLAG_INHERITDIRECTIO, 558 [gfs2fl_InheritDirectio] = IFLAG_DIRECTIO,
561 [gfs2fl_InheritJdata] = IFLAG_INHERITJDATA, 559 [gfs2fl_InheritJdata] = IFLAG_JOURNAL_DATA,
562}; 560};
563 561
564static int gfs2_get_flags(struct file *filp, u32 __user *ptr) 562static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
@@ -621,20 +619,17 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
621 if ((new_flags ^ flags) == 0) 619 if ((new_flags ^ flags) == 0)
622 goto out; 620 goto out;
623 621
622 if (S_ISDIR(inode->i_mode)) {
623 if ((new_flags ^ flags) & GFS2_DIF_JDATA)
624 new_flags ^= (GFS2_DIF_JDATA|GFS2_DIF_INHERIT_JDATA);
625 if ((new_flags ^ flags) & GFS2_DIF_DIRECTIO)
626 new_flags ^= (GFS2_DIF_DIRECTIO|GFS2_DIF_INHERIT_DIRECTIO);
627 }
628
624 error = -EINVAL; 629 error = -EINVAL;
625 if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET) 630 if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET)
626 goto out; 631 goto out;
627 632
628 if (S_ISDIR(inode->i_mode)) {
629 if ((new_flags ^ flags) & (GFS2_DIF_JDATA | GFS2_DIF_DIRECTIO))
630 goto out;
631 } else if (S_ISREG(inode->i_mode)) {
632 if ((new_flags ^ flags) & (GFS2_DIF_INHERIT_DIRECTIO|
633 GFS2_DIF_INHERIT_JDATA))
634 goto out;
635 } else
636 goto out;
637
638 error = -EPERM; 633 error = -EPERM;
639 if (IS_IMMUTABLE(inode) && (new_flags & GFS2_DIF_IMMUTABLE)) 634 if (IS_IMMUTABLE(inode) && (new_flags & GFS2_DIF_IMMUTABLE))
640 goto out; 635 goto out;
diff --git a/include/linux/iflags.h b/include/linux/iflags.h
index 1b4d9ef5d62b..5b27102dfeaf 100644
--- a/include/linux/iflags.h
+++ b/include/linux/iflags.h
@@ -46,9 +46,8 @@ enum {
46 iflag_NoTail = 15, /* file tail should not be merged */ 46 iflag_NoTail = 15, /* file tail should not be merged */
47 iflag_DirSync = 16, /* dirsync behaviour */ 47 iflag_DirSync = 16, /* dirsync behaviour */
48 iflag_TopDir = 17, /* Top of directory hierarchies */ 48 iflag_TopDir = 17, /* Top of directory hierarchies */
49 iflag_DirectIO = 18, /* Always use direct I/O on this file */ 49 iflag_Extent = 19, /* Extents */
50 iflag_InheritDirectIO = 19, /* Set DirectIO on new files in dir */ 50 iflag_DirectIO = 20, /* Always use direct I/O on this file */
51 iflag_InheritJdata = 20, /* Set JournalData on create in dir */
52 iflag_Reserved = 31 /* reserved for ext2/3 lib */ 51 iflag_Reserved = 31 /* reserved for ext2/3 lib */
53}; 52};
54 53
@@ -72,9 +71,8 @@ enum {
72#define IFLAG_NOTAIL __IFL(NoTail) /* 0x00008000 */ 71#define IFLAG_NOTAIL __IFL(NoTail) /* 0x00008000 */
73#define IFLAG_DIRSYNC __IFL(DirSync) /* 0x00010000 */ 72#define IFLAG_DIRSYNC __IFL(DirSync) /* 0x00010000 */
74#define IFLAG_TOPDIR __IFL(TopDir) /* 0x00020000 */ 73#define IFLAG_TOPDIR __IFL(TopDir) /* 0x00020000 */
75#define IFLAG_DIRECTIO __IFL(DirectIO) /* 0x00040000 */ 74#define IFLAG_EXTENT __IFL(Extent) /* 0x00080000 */
76#define IFLAG_INHERITDIRECTIO __IFL(InheritDirectIO) /* 0x00080000 */ 75#define IFLAG_DIRECTIO __IFL(DirectIO) /* 0x00100000 */
77#define IFLAG_INHERITJDATA __IFL(InheritJdata) /* 0x00100000 */
78#define IFLAG_RESERVED __IFL(Reserved) /* 0x80000000 */ 76#define IFLAG_RESERVED __IFL(Reserved) /* 0x80000000 */
79 77
80#ifdef __KERNEL__ 78#ifdef __KERNEL__