diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/bmap.c | 4 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 5 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 13 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 40 |
4 files changed, 24 insertions, 38 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 2011dd27f8d6..30d718b3438f 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -1020,9 +1020,7 @@ static int trunc_end(struct gfs2_inode *ip) | |||
1020 | 1020 | ||
1021 | if (!ip->i_di.di_size) { | 1021 | if (!ip->i_di.di_size) { |
1022 | ip->i_height = 0; | 1022 | ip->i_height = 0; |
1023 | ip->i_di.di_goal_meta = | 1023 | ip->i_goal = ip->i_no_addr; |
1024 | ip->i_di.di_goal_data = | ||
1025 | ip->i_no_addr; | ||
1026 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); | 1024 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); |
1027 | } | 1025 | } |
1028 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; | 1026 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index b67e44baa73c..c50dcdf79929 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -241,8 +241,6 @@ enum { | |||
241 | struct gfs2_dinode_host { | 241 | struct gfs2_dinode_host { |
242 | u64 di_size; /* number of bytes in file */ | 242 | u64 di_size; /* number of bytes in file */ |
243 | u64 di_blocks; /* number of blocks in file */ | 243 | u64 di_blocks; /* number of blocks in file */ |
244 | u64 di_goal_meta; /* rgrp to alloc from next */ | ||
245 | u64 di_goal_data; /* data block goal */ | ||
246 | u64 di_generation; /* generation number for NFS */ | 244 | u64 di_generation; /* generation number for NFS */ |
247 | u32 di_flags; /* GFS2_DIF_... */ | 245 | u32 di_flags; /* GFS2_DIF_... */ |
248 | /* These only apply to directories */ | 246 | /* These only apply to directories */ |
@@ -262,8 +260,7 @@ struct gfs2_inode { | |||
262 | struct gfs2_holder i_iopen_gh; | 260 | struct gfs2_holder i_iopen_gh; |
263 | struct gfs2_holder i_gh; /* for prepare/commit_write only */ | 261 | struct gfs2_holder i_gh; /* for prepare/commit_write only */ |
264 | struct gfs2_alloc *i_alloc; | 262 | struct gfs2_alloc *i_alloc; |
265 | u64 i_last_rg_alloc; | 263 | u64 i_goal; /* goal block for allocations */ |
266 | |||
267 | struct rw_semaphore i_rw_mutex; | 264 | struct rw_semaphore i_rw_mutex; |
268 | u8 i_height; | 265 | u8 i_height; |
269 | u8 i_depth; | 266 | u8 i_depth; |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 65fdfee9ca9b..c3fe8aa03c4e 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -282,8 +282,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
282 | ip->i_inode.i_ctime.tv_sec = be64_to_cpu(str->di_ctime); | 282 | ip->i_inode.i_ctime.tv_sec = be64_to_cpu(str->di_ctime); |
283 | ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec); | 283 | ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec); |
284 | 284 | ||
285 | di->di_goal_meta = be64_to_cpu(str->di_goal_meta); | 285 | ip->i_goal = be64_to_cpu(str->di_goal_meta); |
286 | di->di_goal_data = be64_to_cpu(str->di_goal_data); | ||
287 | di->di_generation = be64_to_cpu(str->di_generation); | 286 | di->di_generation = be64_to_cpu(str->di_generation); |
288 | 287 | ||
289 | di->di_flags = be32_to_cpu(str->di_flags); | 288 | di->di_flags = be32_to_cpu(str->di_flags); |
@@ -1404,8 +1403,8 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) | |||
1404 | str->di_mtime = cpu_to_be64(ip->i_inode.i_mtime.tv_sec); | 1403 | str->di_mtime = cpu_to_be64(ip->i_inode.i_mtime.tv_sec); |
1405 | str->di_ctime = cpu_to_be64(ip->i_inode.i_ctime.tv_sec); | 1404 | str->di_ctime = cpu_to_be64(ip->i_inode.i_ctime.tv_sec); |
1406 | 1405 | ||
1407 | str->di_goal_meta = cpu_to_be64(di->di_goal_meta); | 1406 | str->di_goal_meta = cpu_to_be64(ip->i_goal); |
1408 | str->di_goal_data = cpu_to_be64(di->di_goal_data); | 1407 | str->di_goal_data = cpu_to_be64(ip->i_goal); |
1409 | str->di_generation = cpu_to_be64(di->di_generation); | 1408 | str->di_generation = cpu_to_be64(di->di_generation); |
1410 | 1409 | ||
1411 | str->di_flags = cpu_to_be32(di->di_flags); | 1410 | str->di_flags = cpu_to_be32(di->di_flags); |
@@ -1433,10 +1432,8 @@ void gfs2_dinode_print(const struct gfs2_inode *ip) | |||
1433 | printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size); | 1432 | printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size); |
1434 | printk(KERN_INFO " di_blocks = %llu\n", | 1433 | printk(KERN_INFO " di_blocks = %llu\n", |
1435 | (unsigned long long)di->di_blocks); | 1434 | (unsigned long long)di->di_blocks); |
1436 | printk(KERN_INFO " di_goal_meta = %llu\n", | 1435 | printk(KERN_INFO " i_goal = %llu\n", |
1437 | (unsigned long long)di->di_goal_meta); | 1436 | (unsigned long long)ip->i_goal); |
1438 | printk(KERN_INFO " di_goal_data = %llu\n", | ||
1439 | (unsigned long long)di->di_goal_data); | ||
1440 | printk(KERN_INFO " di_flags = 0x%.8X\n", di->di_flags); | 1437 | printk(KERN_INFO " di_flags = 0x%.8X\n", di->di_flags); |
1441 | printk(KERN_INFO " i_height = %u\n", ip->i_height); | 1438 | printk(KERN_INFO " i_height = %u\n", ip->i_height); |
1442 | printk(KERN_INFO " i_depth = %u\n", ip->i_depth); | 1439 | printk(KERN_INFO " i_depth = %u\n", ip->i_depth); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 3f10b1fafd66..66193b45e50b 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -915,24 +915,20 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked) | |||
915 | static struct gfs2_rgrpd *recent_rgrp_first(struct gfs2_sbd *sdp, | 915 | static struct gfs2_rgrpd *recent_rgrp_first(struct gfs2_sbd *sdp, |
916 | u64 rglast) | 916 | u64 rglast) |
917 | { | 917 | { |
918 | struct gfs2_rgrpd *rgd = NULL; | 918 | struct gfs2_rgrpd *rgd; |
919 | 919 | ||
920 | spin_lock(&sdp->sd_rindex_spin); | 920 | spin_lock(&sdp->sd_rindex_spin); |
921 | 921 | ||
922 | if (list_empty(&sdp->sd_rindex_recent_list)) | 922 | if (rglast) { |
923 | goto out; | 923 | list_for_each_entry(rgd, &sdp->sd_rindex_recent_list, rd_recent) { |
924 | 924 | if (rgrp_contains_block(rgd, rglast)) | |
925 | if (!rglast) | 925 | goto out; |
926 | goto first; | 926 | } |
927 | |||
928 | list_for_each_entry(rgd, &sdp->sd_rindex_recent_list, rd_recent) { | ||
929 | if (rgd->rd_addr == rglast) | ||
930 | goto out; | ||
931 | } | 927 | } |
932 | 928 | rgd = NULL; | |
933 | first: | 929 | if (!list_empty(&sdp->sd_rindex_recent_list)) |
934 | rgd = list_entry(sdp->sd_rindex_recent_list.next, struct gfs2_rgrpd, | 930 | rgd = list_entry(sdp->sd_rindex_recent_list.next, |
935 | rd_recent); | 931 | struct gfs2_rgrpd, rd_recent); |
936 | out: | 932 | out: |
937 | spin_unlock(&sdp->sd_rindex_spin); | 933 | spin_unlock(&sdp->sd_rindex_spin); |
938 | return rgd; | 934 | return rgd; |
@@ -1078,7 +1074,7 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1078 | 1074 | ||
1079 | /* Try recently successful rgrps */ | 1075 | /* Try recently successful rgrps */ |
1080 | 1076 | ||
1081 | rgd = recent_rgrp_first(sdp, ip->i_last_rg_alloc); | 1077 | rgd = recent_rgrp_first(sdp, ip->i_goal); |
1082 | 1078 | ||
1083 | while (rgd) { | 1079 | while (rgd) { |
1084 | rg_locked = 0; | 1080 | rg_locked = 0; |
@@ -1162,8 +1158,6 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1162 | } | 1158 | } |
1163 | 1159 | ||
1164 | out: | 1160 | out: |
1165 | ip->i_last_rg_alloc = rgd->rd_addr; | ||
1166 | |||
1167 | if (begin) { | 1161 | if (begin) { |
1168 | recent_rgrp_add(rgd); | 1162 | recent_rgrp_add(rgd); |
1169 | rgd = gfs2_rgrpd_get_next(rgd); | 1163 | rgd = gfs2_rgrpd_get_next(rgd); |
@@ -1425,8 +1419,8 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1425 | u32 goal, blk; | 1419 | u32 goal, blk; |
1426 | u64 block; | 1420 | u64 block; |
1427 | 1421 | ||
1428 | if (rgrp_contains_block(rgd, ip->i_di.di_goal_data)) | 1422 | if (rgrp_contains_block(rgd, ip->i_goal)) |
1429 | goal = ip->i_di.di_goal_data - rgd->rd_data0; | 1423 | goal = ip->i_goal - rgd->rd_data0; |
1430 | else | 1424 | else |
1431 | goal = rgd->rd_last_alloc_data; | 1425 | goal = rgd->rd_last_alloc_data; |
1432 | 1426 | ||
@@ -1435,7 +1429,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1435 | rgd->rd_last_alloc_data = blk; | 1429 | rgd->rd_last_alloc_data = blk; |
1436 | 1430 | ||
1437 | block = rgd->rd_data0 + blk; | 1431 | block = rgd->rd_data0 + blk; |
1438 | ip->i_di.di_goal_data = block; | 1432 | ip->i_goal = block; |
1439 | 1433 | ||
1440 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); | 1434 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); |
1441 | rgd->rd_rg.rg_free--; | 1435 | rgd->rd_rg.rg_free--; |
@@ -1470,8 +1464,8 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1470 | u32 goal, blk; | 1464 | u32 goal, blk; |
1471 | u64 block; | 1465 | u64 block; |
1472 | 1466 | ||
1473 | if (rgrp_contains_block(rgd, ip->i_di.di_goal_meta)) | 1467 | if (rgrp_contains_block(rgd, ip->i_goal)) |
1474 | goal = ip->i_di.di_goal_meta - rgd->rd_data0; | 1468 | goal = ip->i_goal - rgd->rd_data0; |
1475 | else | 1469 | else |
1476 | goal = rgd->rd_last_alloc_meta; | 1470 | goal = rgd->rd_last_alloc_meta; |
1477 | 1471 | ||
@@ -1480,7 +1474,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1480 | rgd->rd_last_alloc_meta = blk; | 1474 | rgd->rd_last_alloc_meta = blk; |
1481 | 1475 | ||
1482 | block = rgd->rd_data0 + blk; | 1476 | block = rgd->rd_data0 + blk; |
1483 | ip->i_di.di_goal_meta = block; | 1477 | ip->i_goal = block; |
1484 | 1478 | ||
1485 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); | 1479 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); |
1486 | rgd->rd_rg.rg_free--; | 1480 | rgd->rd_rg.rg_free--; |