diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/inode.c | 11 | ||||
-rw-r--r-- | fs/gfs2/ops_file.c | 19 | ||||
-rw-r--r-- | fs/gfs2/ops_file.h | 2 |
3 files changed, 21 insertions, 11 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index faf9b9ed791d..56b39be76925 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -54,16 +54,6 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip) | |||
54 | i_size_write(inode, di->di_size); | 54 | i_size_write(inode, di->di_size); |
55 | inode->i_blocks = di->di_blocks << | 55 | inode->i_blocks = di->di_blocks << |
56 | (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT); | 56 | (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT); |
57 | |||
58 | if (di->di_flags & GFS2_DIF_IMMUTABLE) | ||
59 | inode->i_flags |= S_IMMUTABLE; | ||
60 | else | ||
61 | inode->i_flags &= ~S_IMMUTABLE; | ||
62 | |||
63 | if (di->di_flags & GFS2_DIF_APPENDONLY) | ||
64 | inode->i_flags |= S_APPEND; | ||
65 | else | ||
66 | inode->i_flags &= ~S_APPEND; | ||
67 | } | 57 | } |
68 | 58 | ||
69 | static int iget_test(struct inode *inode, void *opaque) | 59 | static int iget_test(struct inode *inode, void *opaque) |
@@ -210,6 +200,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
210 | di->di_generation = be64_to_cpu(str->di_generation); | 200 | di->di_generation = be64_to_cpu(str->di_generation); |
211 | 201 | ||
212 | di->di_flags = be32_to_cpu(str->di_flags); | 202 | di->di_flags = be32_to_cpu(str->di_flags); |
203 | gfs2_set_inode_flags(&ip->i_inode); | ||
213 | di->di_height = be16_to_cpu(str->di_height); | 204 | di->di_height = be16_to_cpu(str->di_height); |
214 | 205 | ||
215 | di->di_depth = be16_to_cpu(str->di_depth); | 206 | di->di_depth = be16_to_cpu(str->di_depth); |
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: |
diff --git a/fs/gfs2/ops_file.h b/fs/gfs2/ops_file.h index ce319f89ec8e..7e5d8ec9c846 100644 --- a/fs/gfs2/ops_file.h +++ b/fs/gfs2/ops_file.h | |||
@@ -17,7 +17,7 @@ extern struct file gfs2_internal_file_sentinel; | |||
17 | extern int gfs2_internal_read(struct gfs2_inode *ip, | 17 | extern int gfs2_internal_read(struct gfs2_inode *ip, |
18 | struct file_ra_state *ra_state, | 18 | struct file_ra_state *ra_state, |
19 | char *buf, loff_t *pos, unsigned size); | 19 | char *buf, loff_t *pos, unsigned size); |
20 | 20 | extern void gfs2_set_inode_flags(struct inode *inode); | |
21 | extern const struct file_operations gfs2_file_fops; | 21 | extern const struct file_operations gfs2_file_fops; |
22 | extern const struct file_operations gfs2_dir_fops; | 22 | extern const struct file_operations gfs2_dir_fops; |
23 | 23 | ||