diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-05 21:52:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-05 21:52:54 -0500 |
commit | c54febae996d36c630f09209cd9983ecfda3fcad (patch) | |
tree | 35b2717dcd4e4ff2206cd468b5895afb16f49c8c /fs/gfs2/inode.c | |
parent | e42e4ba07bc72c0eb7c7ab3bf9e5076db90d0f37 (diff) | |
parent | eb8374e71f941a1b3c2ed6ea19dc809e7124dc5d (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw: (27 commits)
GFS2: Use DEFINE_SPINLOCK
GFS2: Fix use-after-free bug on umount (try #2)
Revert "GFS2: Fix use-after-free bug on umount"
GFS2: Streamline alloc calculations for writes
GFS2: Send useful information with uevent messages
GFS2: Fix use-after-free bug on umount
GFS2: Remove ancient, unused code
GFS2: Move four functions from super.c
GFS2: Fix bug in gfs2_lock_fs_check_clean()
GFS2: Send some sensible sysfs stuff
GFS2: Kill two daemons with one patch
GFS2: Move gfs2_recoverd into recovery.c
GFS2: Fix "truncate in progress" hang
GFS2: Clean up & move gfs2_quotad
GFS2: Add more detail to debugfs glock dumps
GFS2: Banish struct gfs2_rgrpd_host
GFS2: Move rg_free from gfs2_rgrpd_host to gfs2_rgrpd
GFS2: Move rg_igeneration into struct gfs2_rgrpd
GFS2: Banish struct gfs2_dinode_host
GFS2: Move i_size from gfs2_dinode_host and rename it to i_disksize
...
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index d57616840e89..3b87c188da41 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "log.h" | 32 | #include "log.h" |
33 | #include "meta_io.h" | 33 | #include "meta_io.h" |
34 | #include "ops_address.h" | 34 | #include "ops_address.h" |
35 | #include "ops_inode.h" | ||
36 | #include "quota.h" | 35 | #include "quota.h" |
37 | #include "rgrp.h" | 36 | #include "rgrp.h" |
38 | #include "trans.h" | 37 | #include "trans.h" |
@@ -248,7 +247,6 @@ fail: | |||
248 | 247 | ||
249 | static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | 248 | static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) |
250 | { | 249 | { |
251 | struct gfs2_dinode_host *di = &ip->i_di; | ||
252 | const struct gfs2_dinode *str = buf; | 250 | const struct gfs2_dinode *str = buf; |
253 | struct timespec atime; | 251 | struct timespec atime; |
254 | u16 height, depth; | 252 | u16 height, depth; |
@@ -274,8 +272,8 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
274 | * to do that. | 272 | * to do that. |
275 | */ | 273 | */ |
276 | ip->i_inode.i_nlink = be32_to_cpu(str->di_nlink); | 274 | ip->i_inode.i_nlink = be32_to_cpu(str->di_nlink); |
277 | di->di_size = be64_to_cpu(str->di_size); | 275 | ip->i_disksize = be64_to_cpu(str->di_size); |
278 | i_size_write(&ip->i_inode, di->di_size); | 276 | i_size_write(&ip->i_inode, ip->i_disksize); |
279 | gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks)); | 277 | gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks)); |
280 | atime.tv_sec = be64_to_cpu(str->di_atime); | 278 | atime.tv_sec = be64_to_cpu(str->di_atime); |
281 | atime.tv_nsec = be32_to_cpu(str->di_atime_nsec); | 279 | atime.tv_nsec = be32_to_cpu(str->di_atime_nsec); |
@@ -287,9 +285,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
287 | ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec); | 285 | ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec); |
288 | 286 | ||
289 | ip->i_goal = be64_to_cpu(str->di_goal_meta); | 287 | ip->i_goal = be64_to_cpu(str->di_goal_meta); |
290 | di->di_generation = be64_to_cpu(str->di_generation); | 288 | ip->i_generation = be64_to_cpu(str->di_generation); |
291 | 289 | ||
292 | di->di_flags = be32_to_cpu(str->di_flags); | 290 | ip->i_diskflags = be32_to_cpu(str->di_flags); |
293 | gfs2_set_inode_flags(&ip->i_inode); | 291 | gfs2_set_inode_flags(&ip->i_inode); |
294 | height = be16_to_cpu(str->di_height); | 292 | height = be16_to_cpu(str->di_height); |
295 | if (unlikely(height > GFS2_MAX_META_HEIGHT)) | 293 | if (unlikely(height > GFS2_MAX_META_HEIGHT)) |
@@ -300,9 +298,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
300 | if (unlikely(depth > GFS2_DIR_MAX_DEPTH)) | 298 | if (unlikely(depth > GFS2_DIR_MAX_DEPTH)) |
301 | goto corrupt; | 299 | goto corrupt; |
302 | ip->i_depth = (u8)depth; | 300 | ip->i_depth = (u8)depth; |
303 | di->di_entries = be32_to_cpu(str->di_entries); | 301 | ip->i_entries = be32_to_cpu(str->di_entries); |
304 | 302 | ||
305 | di->di_eattr = be64_to_cpu(str->di_eattr); | 303 | ip->i_eattr = be64_to_cpu(str->di_eattr); |
306 | if (S_ISREG(ip->i_inode.i_mode)) | 304 | if (S_ISREG(ip->i_inode.i_mode)) |
307 | gfs2_set_aops(&ip->i_inode); | 305 | gfs2_set_aops(&ip->i_inode); |
308 | 306 | ||
@@ -388,7 +386,6 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip) | |||
388 | gfs2_free_di(rgd, ip); | 386 | gfs2_free_di(rgd, ip); |
389 | 387 | ||
390 | gfs2_trans_end(sdp); | 388 | gfs2_trans_end(sdp); |
391 | clear_bit(GLF_STICKY, &ip->i_gl->gl_flags); | ||
392 | 389 | ||
393 | out_rg_gunlock: | 390 | out_rg_gunlock: |
394 | gfs2_glock_dq_uninit(&al->al_rgd_gh); | 391 | gfs2_glock_dq_uninit(&al->al_rgd_gh); |
@@ -690,7 +687,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name, | |||
690 | return error; | 687 | return error; |
691 | } | 688 | } |
692 | 689 | ||
693 | if (dip->i_di.di_entries == (u32)-1) | 690 | if (dip->i_entries == (u32)-1) |
694 | return -EFBIG; | 691 | return -EFBIG; |
695 | if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1) | 692 | if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1) |
696 | return -EMLINK; | 693 | return -EMLINK; |
@@ -790,11 +787,11 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | |||
790 | di->di_flags = 0; | 787 | di->di_flags = 0; |
791 | 788 | ||
792 | if (S_ISREG(mode)) { | 789 | if (S_ISREG(mode)) { |
793 | if ((dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA) || | 790 | if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) || |
794 | gfs2_tune_get(sdp, gt_new_files_jdata)) | 791 | gfs2_tune_get(sdp, gt_new_files_jdata)) |
795 | di->di_flags |= cpu_to_be32(GFS2_DIF_JDATA); | 792 | di->di_flags |= cpu_to_be32(GFS2_DIF_JDATA); |
796 | } else if (S_ISDIR(mode)) { | 793 | } else if (S_ISDIR(mode)) { |
797 | di->di_flags |= cpu_to_be32(dip->i_di.di_flags & | 794 | di->di_flags |= cpu_to_be32(dip->i_diskflags & |
798 | GFS2_DIF_INHERIT_JDATA); | 795 | GFS2_DIF_INHERIT_JDATA); |
799 | } | 796 | } |
800 | 797 | ||
@@ -1068,7 +1065,7 @@ int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, | |||
1068 | struct qstr dotname; | 1065 | struct qstr dotname; |
1069 | int error; | 1066 | int error; |
1070 | 1067 | ||
1071 | if (ip->i_di.di_entries != 2) { | 1068 | if (ip->i_entries != 2) { |
1072 | if (gfs2_consist_inode(ip)) | 1069 | if (gfs2_consist_inode(ip)) |
1073 | gfs2_dinode_print(ip); | 1070 | gfs2_dinode_print(ip); |
1074 | return -EIO; | 1071 | return -EIO; |
@@ -1168,7 +1165,7 @@ int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len) | |||
1168 | return error; | 1165 | return error; |
1169 | } | 1166 | } |
1170 | 1167 | ||
1171 | if (!ip->i_di.di_size) { | 1168 | if (!ip->i_disksize) { |
1172 | gfs2_consist_inode(ip); | 1169 | gfs2_consist_inode(ip); |
1173 | error = -EIO; | 1170 | error = -EIO; |
1174 | goto out; | 1171 | goto out; |
@@ -1178,7 +1175,7 @@ int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len) | |||
1178 | if (error) | 1175 | if (error) |
1179 | goto out; | 1176 | goto out; |
1180 | 1177 | ||
1181 | x = ip->i_di.di_size + 1; | 1178 | x = ip->i_disksize + 1; |
1182 | if (x > *len) { | 1179 | if (x > *len) { |
1183 | *buf = kmalloc(x, GFP_NOFS); | 1180 | *buf = kmalloc(x, GFP_NOFS); |
1184 | if (!*buf) { | 1181 | if (!*buf) { |
@@ -1242,7 +1239,6 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr) | |||
1242 | 1239 | ||
1243 | void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) | 1240 | void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) |
1244 | { | 1241 | { |
1245 | const struct gfs2_dinode_host *di = &ip->i_di; | ||
1246 | struct gfs2_dinode *str = buf; | 1242 | struct gfs2_dinode *str = buf; |
1247 | 1243 | ||
1248 | str->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC); | 1244 | str->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC); |
@@ -1256,7 +1252,7 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) | |||
1256 | str->di_uid = cpu_to_be32(ip->i_inode.i_uid); | 1252 | str->di_uid = cpu_to_be32(ip->i_inode.i_uid); |
1257 | str->di_gid = cpu_to_be32(ip->i_inode.i_gid); | 1253 | str->di_gid = cpu_to_be32(ip->i_inode.i_gid); |
1258 | str->di_nlink = cpu_to_be32(ip->i_inode.i_nlink); | 1254 | str->di_nlink = cpu_to_be32(ip->i_inode.i_nlink); |
1259 | str->di_size = cpu_to_be64(di->di_size); | 1255 | str->di_size = cpu_to_be64(ip->i_disksize); |
1260 | str->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode)); | 1256 | str->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode)); |
1261 | str->di_atime = cpu_to_be64(ip->i_inode.i_atime.tv_sec); | 1257 | str->di_atime = cpu_to_be64(ip->i_inode.i_atime.tv_sec); |
1262 | str->di_mtime = cpu_to_be64(ip->i_inode.i_mtime.tv_sec); | 1258 | str->di_mtime = cpu_to_be64(ip->i_inode.i_mtime.tv_sec); |
@@ -1264,17 +1260,17 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) | |||
1264 | 1260 | ||
1265 | str->di_goal_meta = cpu_to_be64(ip->i_goal); | 1261 | str->di_goal_meta = cpu_to_be64(ip->i_goal); |
1266 | str->di_goal_data = cpu_to_be64(ip->i_goal); | 1262 | str->di_goal_data = cpu_to_be64(ip->i_goal); |
1267 | str->di_generation = cpu_to_be64(di->di_generation); | 1263 | str->di_generation = cpu_to_be64(ip->i_generation); |
1268 | 1264 | ||
1269 | str->di_flags = cpu_to_be32(di->di_flags); | 1265 | str->di_flags = cpu_to_be32(ip->i_diskflags); |
1270 | str->di_height = cpu_to_be16(ip->i_height); | 1266 | str->di_height = cpu_to_be16(ip->i_height); |
1271 | str->di_payload_format = cpu_to_be32(S_ISDIR(ip->i_inode.i_mode) && | 1267 | str->di_payload_format = cpu_to_be32(S_ISDIR(ip->i_inode.i_mode) && |
1272 | !(ip->i_di.di_flags & GFS2_DIF_EXHASH) ? | 1268 | !(ip->i_diskflags & GFS2_DIF_EXHASH) ? |
1273 | GFS2_FORMAT_DE : 0); | 1269 | GFS2_FORMAT_DE : 0); |
1274 | str->di_depth = cpu_to_be16(ip->i_depth); | 1270 | str->di_depth = cpu_to_be16(ip->i_depth); |
1275 | str->di_entries = cpu_to_be32(di->di_entries); | 1271 | str->di_entries = cpu_to_be32(ip->i_entries); |
1276 | 1272 | ||
1277 | str->di_eattr = cpu_to_be64(di->di_eattr); | 1273 | str->di_eattr = cpu_to_be64(ip->i_eattr); |
1278 | str->di_atime_nsec = cpu_to_be32(ip->i_inode.i_atime.tv_nsec); | 1274 | str->di_atime_nsec = cpu_to_be32(ip->i_inode.i_atime.tv_nsec); |
1279 | str->di_mtime_nsec = cpu_to_be32(ip->i_inode.i_mtime.tv_nsec); | 1275 | str->di_mtime_nsec = cpu_to_be32(ip->i_inode.i_mtime.tv_nsec); |
1280 | str->di_ctime_nsec = cpu_to_be32(ip->i_inode.i_ctime.tv_nsec); | 1276 | str->di_ctime_nsec = cpu_to_be32(ip->i_inode.i_ctime.tv_nsec); |
@@ -1282,22 +1278,21 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) | |||
1282 | 1278 | ||
1283 | void gfs2_dinode_print(const struct gfs2_inode *ip) | 1279 | void gfs2_dinode_print(const struct gfs2_inode *ip) |
1284 | { | 1280 | { |
1285 | const struct gfs2_dinode_host *di = &ip->i_di; | ||
1286 | |||
1287 | printk(KERN_INFO " no_formal_ino = %llu\n", | 1281 | printk(KERN_INFO " no_formal_ino = %llu\n", |
1288 | (unsigned long long)ip->i_no_formal_ino); | 1282 | (unsigned long long)ip->i_no_formal_ino); |
1289 | printk(KERN_INFO " no_addr = %llu\n", | 1283 | printk(KERN_INFO " no_addr = %llu\n", |
1290 | (unsigned long long)ip->i_no_addr); | 1284 | (unsigned long long)ip->i_no_addr); |
1291 | printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size); | 1285 | printk(KERN_INFO " i_disksize = %llu\n", |
1286 | (unsigned long long)ip->i_disksize); | ||
1292 | printk(KERN_INFO " blocks = %llu\n", | 1287 | printk(KERN_INFO " blocks = %llu\n", |
1293 | (unsigned long long)gfs2_get_inode_blocks(&ip->i_inode)); | 1288 | (unsigned long long)gfs2_get_inode_blocks(&ip->i_inode)); |
1294 | printk(KERN_INFO " i_goal = %llu\n", | 1289 | printk(KERN_INFO " i_goal = %llu\n", |
1295 | (unsigned long long)ip->i_goal); | 1290 | (unsigned long long)ip->i_goal); |
1296 | printk(KERN_INFO " di_flags = 0x%.8X\n", di->di_flags); | 1291 | printk(KERN_INFO " i_diskflags = 0x%.8X\n", ip->i_diskflags); |
1297 | printk(KERN_INFO " i_height = %u\n", ip->i_height); | 1292 | printk(KERN_INFO " i_height = %u\n", ip->i_height); |
1298 | printk(KERN_INFO " i_depth = %u\n", ip->i_depth); | 1293 | printk(KERN_INFO " i_depth = %u\n", ip->i_depth); |
1299 | printk(KERN_INFO " di_entries = %u\n", di->di_entries); | 1294 | printk(KERN_INFO " i_entries = %u\n", ip->i_entries); |
1300 | printk(KERN_INFO " di_eattr = %llu\n", | 1295 | printk(KERN_INFO " i_eattr = %llu\n", |
1301 | (unsigned long long)di->di_eattr); | 1296 | (unsigned long long)ip->i_eattr); |
1302 | } | 1297 | } |
1303 | 1298 | ||