diff options
author | Steven Whitehouse <steve@chygwyn.com> | 2012-05-28 10:26:56 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2012-06-06 06:27:36 -0400 |
commit | 23d0bb834e264f38335f19fe601564b8422431e7 (patch) | |
tree | b6c93a163ef1e24cae77d4204c15206375e0d175 | |
parent | 5407e24229408d7586ee451a384fc13e4a2332be (diff) |
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: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/file.c | 4 | ||||
-rw-r--r-- | include/linux/gfs2_ondisk.h | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 26e2905070ed..6fbf3cbd974d 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -142,6 +142,7 @@ static const u32 fsflags_to_gfs2[32] = { | |||
142 | [7] = GFS2_DIF_NOATIME, | 142 | [7] = GFS2_DIF_NOATIME, |
143 | [12] = GFS2_DIF_EXHASH, | 143 | [12] = GFS2_DIF_EXHASH, |
144 | [14] = GFS2_DIF_INHERIT_JDATA, | 144 | [14] = GFS2_DIF_INHERIT_JDATA, |
145 | [17] = GFS2_DIF_TOPDIR, | ||
145 | }; | 146 | }; |
146 | 147 | ||
147 | static const u32 gfs2_to_fsflags[32] = { | 148 | static const u32 gfs2_to_fsflags[32] = { |
@@ -150,6 +151,7 @@ static const u32 gfs2_to_fsflags[32] = { | |||
150 | [gfs2fl_AppendOnly] = FS_APPEND_FL, | 151 | [gfs2fl_AppendOnly] = FS_APPEND_FL, |
151 | [gfs2fl_NoAtime] = FS_NOATIME_FL, | 152 | [gfs2fl_NoAtime] = FS_NOATIME_FL, |
152 | [gfs2fl_ExHash] = FS_INDEX_FL, | 153 | [gfs2fl_ExHash] = FS_INDEX_FL, |
154 | [gfs2fl_TopLevel] = FS_TOPDIR_FL, | ||
153 | [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL, | 155 | [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL, |
154 | }; | 156 | }; |
155 | 157 | ||
@@ -203,6 +205,7 @@ void gfs2_set_inode_flags(struct inode *inode) | |||
203 | GFS2_DIF_NOATIME| \ | 205 | GFS2_DIF_NOATIME| \ |
204 | GFS2_DIF_SYNC| \ | 206 | GFS2_DIF_SYNC| \ |
205 | GFS2_DIF_SYSTEM| \ | 207 | GFS2_DIF_SYSTEM| \ |
208 | GFS2_DIF_TOPDIR| \ | ||
206 | GFS2_DIF_INHERIT_JDATA) | 209 | GFS2_DIF_INHERIT_JDATA) |
207 | 210 | ||
208 | /** | 211 | /** |
@@ -298,6 +301,7 @@ static int gfs2_set_flags(struct file *filp, u32 __user *ptr) | |||
298 | 301 | ||
299 | gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); | 302 | gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); |
300 | if (!S_ISDIR(inode->i_mode)) { | 303 | if (!S_ISDIR(inode->i_mode)) { |
304 | gfsflags &= ~GFS2_DIF_TOPDIR; | ||
301 | if (gfsflags & GFS2_DIF_INHERIT_JDATA) | 305 | if (gfsflags & GFS2_DIF_INHERIT_JDATA) |
302 | gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA); | 306 | gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA); |
303 | return do_gfs2_set_flags(filp, gfsflags, ~0); | 307 | return do_gfs2_set_flags(filp, gfsflags, ~0); |
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index fa98bdb073b9..e8ccf6ff3b4d 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -214,6 +214,7 @@ enum { | |||
214 | gfs2fl_NoAtime = 7, | 214 | gfs2fl_NoAtime = 7, |
215 | gfs2fl_Sync = 8, | 215 | gfs2fl_Sync = 8, |
216 | gfs2fl_System = 9, | 216 | gfs2fl_System = 9, |
217 | gfs2fl_TopLevel = 10, | ||
217 | gfs2fl_TruncInProg = 29, | 218 | gfs2fl_TruncInProg = 29, |
218 | gfs2fl_InheritDirectio = 30, | 219 | gfs2fl_InheritDirectio = 30, |
219 | gfs2fl_InheritJdata = 31, | 220 | gfs2fl_InheritJdata = 31, |
@@ -230,8 +231,9 @@ enum { | |||
230 | #define GFS2_DIF_NOATIME 0x00000080 | 231 | #define GFS2_DIF_NOATIME 0x00000080 |
231 | #define GFS2_DIF_SYNC 0x00000100 | 232 | #define GFS2_DIF_SYNC 0x00000100 |
232 | #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */ | 233 | #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */ |
234 | #define GFS2_DIF_TOPDIR 0x00000400 /* New in gfs2 */ | ||
233 | #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */ | 235 | #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */ |
234 | #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 | 236 | #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 /* only in gfs1 */ |
235 | #define GFS2_DIF_INHERIT_JDATA 0x80000000 | 237 | #define GFS2_DIF_INHERIT_JDATA 0x80000000 |
236 | 238 | ||
237 | struct gfs2_dinode { | 239 | struct gfs2_dinode { |