diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-11-08 12:51:06 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-11-30 10:34:45 -0500 |
commit | 6b124d8dba1f46c5f2caf3b3159bbe627f75b9b6 (patch) | |
tree | 42f03f02a7fe7ccfc9c676ddcdbdcdcb28defef6 /fs/gfs2/ops_file.c | |
parent | 2ca99501fa5422e84f18333918a503433449e2b5 (diff) |
[GFS2] Only set inode flags when required
We were setting the inode flags from GFS2's flags far too often, even when they
couldn't possibly have changed. This patch reduces the amount of flag
setting going on so that we do it only when the inode is read in or
when the flags have changed. The create case is covered by the "when
the inode is read in" case.
This also fixes a bug where we didn't set S_SYNC correctly.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_file.c')
-rw-r--r-- | fs/gfs2/ops_file.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index b52b9db1a2bd..eabf6c61a96a 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -266,6 +266,24 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr) | |||
266 | return error; | 266 | return error; |
267 | } | 267 | } |
268 | 268 | ||
269 | void gfs2_set_inode_flags(struct inode *inode) | ||
270 | { | ||
271 | struct gfs2_inode *ip = GFS2_I(inode); | ||
272 | struct gfs2_dinode_host *di = &ip->i_di; | ||
273 | unsigned int flags = inode->i_flags; | ||
274 | |||
275 | flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); | ||
276 | if (di->di_flags & GFS2_DIF_IMMUTABLE) | ||
277 | flags |= S_IMMUTABLE; | ||
278 | if (di->di_flags & GFS2_DIF_APPENDONLY) | ||
279 | flags |= S_APPEND; | ||
280 | if (di->di_flags & GFS2_DIF_NOATIME) | ||
281 | flags |= S_NOATIME; | ||
282 | if (di->di_flags & GFS2_DIF_SYNC) | ||
283 | flags |= S_SYNC; | ||
284 | inode->i_flags = flags; | ||
285 | } | ||
286 | |||
269 | /* Flags that can be set by user space */ | 287 | /* Flags that can be set by user space */ |
270 | #define GFS2_FLAGS_USER_SET (GFS2_DIF_JDATA| \ | 288 | #define GFS2_FLAGS_USER_SET (GFS2_DIF_JDATA| \ |
271 | GFS2_DIF_DIRECTIO| \ | 289 | GFS2_DIF_DIRECTIO| \ |
@@ -338,6 +356,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | |||
338 | ip->i_di.di_flags = new_flags; | 356 | ip->i_di.di_flags = new_flags; |
339 | gfs2_dinode_out(ip, bh->b_data); | 357 | gfs2_dinode_out(ip, bh->b_data); |
340 | brelse(bh); | 358 | brelse(bh); |
359 | gfs2_set_inode_flags(inode); | ||
341 | out_trans_end: | 360 | out_trans_end: |
342 | gfs2_trans_end(sdp); | 361 | gfs2_trans_end(sdp); |
343 | out: | 362 | out: |