diff options
author | Joel Becker <joel.becker@oracle.com> | 2009-02-13 06:54:22 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-04 19:08:13 -0400 |
commit | 5e404e9ed1b05cafb044bd46792e50197df805ed (patch) | |
tree | e3146e03f8a0fc12307db0cbea900728a36ffaac /fs/ocfs2 | |
parent | a1cf076ba93f9fdf3eb4195f9f43d1e7cb7550f2 (diff) |
ocfs2: Pass ocfs2_caching_info into ocfs_init_*_extent_tree().
With this commit, extent tree operations are divorced from inodes and
rely on ocfs2_caching_info. Phew!
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/alloc.c | 22 | ||||
-rw-r--r-- | fs/ocfs2/alloc.h | 8 | ||||
-rw-r--r-- | fs/ocfs2/aops.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 15 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/xattr.c | 8 |
6 files changed, 35 insertions, 30 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 4488685a7022..ab4d2b59b472 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -366,7 +366,7 @@ static struct ocfs2_extent_tree_operations ocfs2_dx_root_et_ops = { | |||
366 | }; | 366 | }; |
367 | 367 | ||
368 | static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, | 368 | static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, |
369 | struct inode *inode, | 369 | struct ocfs2_caching_info *ci, |
370 | struct buffer_head *bh, | 370 | struct buffer_head *bh, |
371 | ocfs2_journal_access_func access, | 371 | ocfs2_journal_access_func access, |
372 | void *obj, | 372 | void *obj, |
@@ -374,7 +374,7 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, | |||
374 | { | 374 | { |
375 | et->et_ops = ops; | 375 | et->et_ops = ops; |
376 | et->et_root_bh = bh; | 376 | et->et_root_bh = bh; |
377 | et->et_ci = INODE_CACHE(inode); | 377 | et->et_ci = ci; |
378 | et->et_root_journal_access = access; | 378 | et->et_root_journal_access = access; |
379 | if (!obj) | 379 | if (!obj) |
380 | obj = (void *)bh->b_data; | 380 | obj = (void *)bh->b_data; |
@@ -388,34 +388,34 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, | |||
388 | } | 388 | } |
389 | 389 | ||
390 | void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et, | 390 | void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et, |
391 | struct inode *inode, | 391 | struct ocfs2_caching_info *ci, |
392 | struct buffer_head *bh) | 392 | struct buffer_head *bh) |
393 | { | 393 | { |
394 | __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_di, | 394 | __ocfs2_init_extent_tree(et, ci, bh, ocfs2_journal_access_di, |
395 | NULL, &ocfs2_dinode_et_ops); | 395 | NULL, &ocfs2_dinode_et_ops); |
396 | } | 396 | } |
397 | 397 | ||
398 | void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, | 398 | void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, |
399 | struct inode *inode, | 399 | struct ocfs2_caching_info *ci, |
400 | struct buffer_head *bh) | 400 | struct buffer_head *bh) |
401 | { | 401 | { |
402 | __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_xb, | 402 | __ocfs2_init_extent_tree(et, ci, bh, ocfs2_journal_access_xb, |
403 | NULL, &ocfs2_xattr_tree_et_ops); | 403 | NULL, &ocfs2_xattr_tree_et_ops); |
404 | } | 404 | } |
405 | 405 | ||
406 | void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, | 406 | void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, |
407 | struct inode *inode, | 407 | struct ocfs2_caching_info *ci, |
408 | struct ocfs2_xattr_value_buf *vb) | 408 | struct ocfs2_xattr_value_buf *vb) |
409 | { | 409 | { |
410 | __ocfs2_init_extent_tree(et, inode, vb->vb_bh, vb->vb_access, vb, | 410 | __ocfs2_init_extent_tree(et, ci, vb->vb_bh, vb->vb_access, vb, |
411 | &ocfs2_xattr_value_et_ops); | 411 | &ocfs2_xattr_value_et_ops); |
412 | } | 412 | } |
413 | 413 | ||
414 | void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et, | 414 | void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et, |
415 | struct inode *inode, | 415 | struct ocfs2_caching_info *ci, |
416 | struct buffer_head *bh) | 416 | struct buffer_head *bh) |
417 | { | 417 | { |
418 | __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_dr, | 418 | __ocfs2_init_extent_tree(et, ci, bh, ocfs2_journal_access_dr, |
419 | NULL, &ocfs2_dx_root_et_ops); | 419 | NULL, &ocfs2_dx_root_et_ops); |
420 | } | 420 | } |
421 | 421 | ||
@@ -7241,7 +7241,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
7241 | * this proves to be false, we could always re-build | 7241 | * this proves to be false, we could always re-build |
7242 | * the in-inode data from our pages. | 7242 | * the in-inode data from our pages. |
7243 | */ | 7243 | */ |
7244 | ocfs2_init_dinode_extent_tree(&et, inode, di_bh); | 7244 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh); |
7245 | ret = ocfs2_insert_extent(handle, &et, 0, block, 1, 0, NULL); | 7245 | ret = ocfs2_insert_extent(handle, &et, 0, block, 1, 0, NULL); |
7246 | if (ret) { | 7246 | if (ret) { |
7247 | mlog_errno(ret); | 7247 | mlog_errno(ret); |
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h index abc66ce9d418..bcf6aa42ae53 100644 --- a/fs/ocfs2/alloc.h +++ b/fs/ocfs2/alloc.h | |||
@@ -68,17 +68,17 @@ struct ocfs2_extent_tree { | |||
68 | * specified object buffer. | 68 | * specified object buffer. |
69 | */ | 69 | */ |
70 | void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et, | 70 | void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et, |
71 | struct inode *inode, | 71 | struct ocfs2_caching_info *ci, |
72 | struct buffer_head *bh); | 72 | struct buffer_head *bh); |
73 | void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, | 73 | void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, |
74 | struct inode *inode, | 74 | struct ocfs2_caching_info *ci, |
75 | struct buffer_head *bh); | 75 | struct buffer_head *bh); |
76 | struct ocfs2_xattr_value_buf; | 76 | struct ocfs2_xattr_value_buf; |
77 | void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, | 77 | void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, |
78 | struct inode *inode, | 78 | struct ocfs2_caching_info *ci, |
79 | struct ocfs2_xattr_value_buf *vb); | 79 | struct ocfs2_xattr_value_buf *vb); |
80 | void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et, | 80 | void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et, |
81 | struct inode *inode, | 81 | struct ocfs2_caching_info *ci, |
82 | struct buffer_head *bh); | 82 | struct buffer_head *bh); |
83 | 83 | ||
84 | /* | 84 | /* |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 49eef2c6f4aa..15c594dfd951 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -1259,7 +1259,8 @@ static int ocfs2_write_cluster(struct address_space *mapping, | |||
1259 | goto out; | 1259 | goto out; |
1260 | } | 1260 | } |
1261 | } else if (unwritten) { | 1261 | } else if (unwritten) { |
1262 | ocfs2_init_dinode_extent_tree(&et, inode, wc->w_di_bh); | 1262 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), |
1263 | wc->w_di_bh); | ||
1263 | ret = ocfs2_mark_extent_written(inode, &et, | 1264 | ret = ocfs2_mark_extent_written(inode, &et, |
1264 | wc->w_handle, cpos, 1, phys, | 1265 | wc->w_handle, cpos, 1, phys, |
1265 | meta_ac, &wc->w_dealloc); | 1266 | meta_ac, &wc->w_dealloc); |
@@ -1726,7 +1727,8 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1726 | (long long)i_size_read(inode), le32_to_cpu(di->i_clusters), | 1727 | (long long)i_size_read(inode), le32_to_cpu(di->i_clusters), |
1727 | clusters_to_alloc, extents_to_split); | 1728 | clusters_to_alloc, extents_to_split); |
1728 | 1729 | ||
1729 | ocfs2_init_dinode_extent_tree(&et, inode, wc->w_di_bh); | 1730 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), |
1731 | wc->w_di_bh); | ||
1730 | ret = ocfs2_lock_allocators(inode, &et, | 1732 | ret = ocfs2_lock_allocators(inode, &et, |
1731 | clusters_to_alloc, extents_to_split, | 1733 | clusters_to_alloc, extents_to_split, |
1732 | &data_ac, &meta_ac); | 1734 | &data_ac, &meta_ac); |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index de490a6d76ba..28c3ec238796 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -2903,7 +2903,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
2903 | struct ocfs2_extent_tree dx_et; | 2903 | struct ocfs2_extent_tree dx_et; |
2904 | int did_quota = 0, bytes_allocated = 0; | 2904 | int did_quota = 0, bytes_allocated = 0; |
2905 | 2905 | ||
2906 | ocfs2_init_dinode_extent_tree(&et, dir, di_bh); | 2906 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(dir), di_bh); |
2907 | 2907 | ||
2908 | alloc = ocfs2_clusters_for_bytes(sb, bytes); | 2908 | alloc = ocfs2_clusters_for_bytes(sb, bytes); |
2909 | dx_alloc = 0; | 2909 | dx_alloc = 0; |
@@ -3125,7 +3125,9 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
3125 | ocfs2_dx_dir_index_root_block(dir, dx_root_bh, | 3125 | ocfs2_dx_dir_index_root_block(dir, dx_root_bh, |
3126 | dirdata_bh); | 3126 | dirdata_bh); |
3127 | } else { | 3127 | } else { |
3128 | ocfs2_init_dx_root_extent_tree(&dx_et, dir, dx_root_bh); | 3128 | ocfs2_init_dx_root_extent_tree(&dx_et, |
3129 | INODE_CACHE(dir), | ||
3130 | dx_root_bh); | ||
3129 | ret = ocfs2_insert_extent(handle, &dx_et, 0, | 3131 | ret = ocfs2_insert_extent(handle, &dx_et, 0, |
3130 | dx_insert_blkno, 1, 0, NULL); | 3132 | dx_insert_blkno, 1, 0, NULL); |
3131 | if (ret) | 3133 | if (ret) |
@@ -3345,7 +3347,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, | |||
3345 | spin_lock(&OCFS2_I(dir)->ip_lock); | 3347 | spin_lock(&OCFS2_I(dir)->ip_lock); |
3346 | if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) { | 3348 | if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) { |
3347 | spin_unlock(&OCFS2_I(dir)->ip_lock); | 3349 | spin_unlock(&OCFS2_I(dir)->ip_lock); |
3348 | ocfs2_init_dinode_extent_tree(&et, dir, parent_fe_bh); | 3350 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(dir), |
3351 | parent_fe_bh); | ||
3349 | num_free_extents = ocfs2_num_free_extents(osb, &et); | 3352 | num_free_extents = ocfs2_num_free_extents(osb, &et); |
3350 | if (num_free_extents < 0) { | 3353 | if (num_free_extents < 0) { |
3351 | status = num_free_extents; | 3354 | status = num_free_extents; |
@@ -3837,7 +3840,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3837 | (unsigned long long)OCFS2_I(dir)->ip_blkno, | 3840 | (unsigned long long)OCFS2_I(dir)->ip_blkno, |
3838 | (unsigned long long)leaf_blkno, insert_hash); | 3841 | (unsigned long long)leaf_blkno, insert_hash); |
3839 | 3842 | ||
3840 | ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh); | 3843 | ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh); |
3841 | 3844 | ||
3842 | dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data; | 3845 | dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data; |
3843 | /* | 3846 | /* |
@@ -4216,7 +4219,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir, | |||
4216 | 4219 | ||
4217 | /* This should never fail considering we start with an empty | 4220 | /* This should never fail considering we start with an empty |
4218 | * dx_root. */ | 4221 | * dx_root. */ |
4219 | ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh); | 4222 | ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh); |
4220 | ret = ocfs2_insert_extent(handle, &et, 0, insert_blkno, 1, 0, NULL); | 4223 | ret = ocfs2_insert_extent(handle, &et, 0, insert_blkno, 1, 0, NULL); |
4221 | if (ret) | 4224 | if (ret) |
4222 | mlog_errno(ret); | 4225 | mlog_errno(ret); |
@@ -4540,7 +4543,7 @@ int ocfs2_dx_dir_truncate(struct inode *dir, struct buffer_head *di_bh) | |||
4540 | if (ocfs2_dx_root_inline(dx_root)) | 4543 | if (ocfs2_dx_root_inline(dx_root)) |
4541 | goto remove_index; | 4544 | goto remove_index; |
4542 | 4545 | ||
4543 | ocfs2_init_dx_root_extent_tree(&et, dir, dx_root_bh); | 4546 | ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh); |
4544 | 4547 | ||
4545 | /* XXX: What if dr_clusters is too large? */ | 4548 | /* XXX: What if dr_clusters is too large? */ |
4546 | while (le32_to_cpu(dx_root->dr_clusters)) { | 4549 | while (le32_to_cpu(dx_root->dr_clusters)) { |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 891e2c1e625c..4921b4ee9431 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -515,7 +515,7 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb, | |||
515 | int ret; | 515 | int ret; |
516 | struct ocfs2_extent_tree et; | 516 | struct ocfs2_extent_tree et; |
517 | 517 | ||
518 | ocfs2_init_dinode_extent_tree(&et, inode, fe_bh); | 518 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), fe_bh); |
519 | ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset, | 519 | ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset, |
520 | clusters_to_add, mark_unwritten, | 520 | clusters_to_add, mark_unwritten, |
521 | data_ac, meta_ac, reason_ret); | 521 | data_ac, meta_ac, reason_ret); |
@@ -563,7 +563,7 @@ restart_all: | |||
563 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 563 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
564 | (long long)i_size_read(inode), le32_to_cpu(fe->i_clusters), | 564 | (long long)i_size_read(inode), le32_to_cpu(fe->i_clusters), |
565 | clusters_to_add); | 565 | clusters_to_add); |
566 | ocfs2_init_dinode_extent_tree(&et, inode, bh); | 566 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), bh); |
567 | status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0, | 567 | status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0, |
568 | &data_ac, &meta_ac); | 568 | &data_ac, &meta_ac); |
569 | if (status) { | 569 | if (status) { |
@@ -1394,7 +1394,7 @@ static int ocfs2_remove_inode_range(struct inode *inode, | |||
1394 | struct address_space *mapping = inode->i_mapping; | 1394 | struct address_space *mapping = inode->i_mapping; |
1395 | struct ocfs2_extent_tree et; | 1395 | struct ocfs2_extent_tree et; |
1396 | 1396 | ||
1397 | ocfs2_init_dinode_extent_tree(&et, inode, di_bh); | 1397 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh); |
1398 | ocfs2_init_dealloc_ctxt(&dealloc); | 1398 | ocfs2_init_dealloc_ctxt(&dealloc); |
1399 | 1399 | ||
1400 | if (byte_len == 0) | 1400 | if (byte_len == 0) |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 96f973a302fa..1bf12c453f99 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -602,7 +602,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode, | |||
602 | 602 | ||
603 | mlog(0, "(clusters_to_add for xattr= %u)\n", clusters_to_add); | 603 | mlog(0, "(clusters_to_add for xattr= %u)\n", clusters_to_add); |
604 | 604 | ||
605 | ocfs2_init_xattr_value_extent_tree(&et, inode, vb); | 605 | ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb); |
606 | 606 | ||
607 | status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh, | 607 | status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh, |
608 | OCFS2_JOURNAL_ACCESS_WRITE); | 608 | OCFS2_JOURNAL_ACCESS_WRITE); |
@@ -654,7 +654,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode, | |||
654 | handle_t *handle = ctxt->handle; | 654 | handle_t *handle = ctxt->handle; |
655 | struct ocfs2_extent_tree et; | 655 | struct ocfs2_extent_tree et; |
656 | 656 | ||
657 | ocfs2_init_xattr_value_extent_tree(&et, inode, vb); | 657 | ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb); |
658 | 658 | ||
659 | ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh, | 659 | ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh, |
660 | OCFS2_JOURNAL_ACCESS_WRITE); | 660 | OCFS2_JOURNAL_ACCESS_WRITE); |
@@ -4266,7 +4266,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode, | |||
4266 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 4266 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
4267 | prev_cpos, (unsigned long long)bucket_blkno(first)); | 4267 | prev_cpos, (unsigned long long)bucket_blkno(first)); |
4268 | 4268 | ||
4269 | ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh); | 4269 | ocfs2_init_xattr_tree_extent_tree(&et, INODE_CACHE(inode), root_bh); |
4270 | 4270 | ||
4271 | ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), root_bh, | 4271 | ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), root_bh, |
4272 | OCFS2_JOURNAL_ACCESS_WRITE); | 4272 | OCFS2_JOURNAL_ACCESS_WRITE); |
@@ -4841,7 +4841,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode, | |||
4841 | struct ocfs2_cached_dealloc_ctxt dealloc; | 4841 | struct ocfs2_cached_dealloc_ctxt dealloc; |
4842 | struct ocfs2_extent_tree et; | 4842 | struct ocfs2_extent_tree et; |
4843 | 4843 | ||
4844 | ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh); | 4844 | ocfs2_init_xattr_tree_extent_tree(&et, INODE_CACHE(inode), root_bh); |
4845 | 4845 | ||
4846 | ocfs2_init_dealloc_ctxt(&dealloc); | 4846 | ocfs2_init_dealloc_ctxt(&dealloc); |
4847 | 4847 | ||