Skip to content

Commit 5e404e9

Browse files
author
Joel Becker
committed
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>
1 parent a1cf076 commit 5e404e9

6 files changed

Lines changed: 35 additions & 30 deletions

File tree

‎fs/ocfs2/alloc.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,15 @@ static struct ocfs2_extent_tree_operations ocfs2_dx_root_et_ops = {
366366
};
367367

368368
static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
369-
struct inode *inode,
369+
struct ocfs2_caching_info *ci,
370370
struct buffer_head *bh,
371371
ocfs2_journal_access_func access,
372372
void *obj,
373373
struct ocfs2_extent_tree_operations *ops)
374374
{
375375
et->et_ops = ops;
376376
et->et_root_bh = bh;
377-
et->et_ci = INODE_CACHE(inode);
377+
et->et_ci = ci;
378378
et->et_root_journal_access = access;
379379
if (!obj)
380380
obj = (void *)bh->b_data;
@@ -388,34 +388,34 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
388388
}
389389

390390
void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et,
391-
struct inode *inode,
391+
struct ocfs2_caching_info *ci,
392392
struct buffer_head *bh)
393393
{
394-
__ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_di,
394+
__ocfs2_init_extent_tree(et, ci, bh, ocfs2_journal_access_di,
395395
NULL, &ocfs2_dinode_et_ops);
396396
}
397397

398398
void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et,
399-
struct inode *inode,
399+
struct ocfs2_caching_info *ci,
400400
struct buffer_head *bh)
401401
{
402-
__ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_xb,
402+
__ocfs2_init_extent_tree(et, ci, bh, ocfs2_journal_access_xb,
403403
NULL, &ocfs2_xattr_tree_et_ops);
404404
}
405405

406406
void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et,
407-
struct inode *inode,
407+
struct ocfs2_caching_info *ci,
408408
struct ocfs2_xattr_value_buf *vb)
409409
{
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,
411411
&ocfs2_xattr_value_et_ops);
412412
}
413413

414414
void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et,
415-
struct inode *inode,
415+
struct ocfs2_caching_info *ci,
416416
struct buffer_head *bh)
417417
{
418-
__ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_dr,
418+
__ocfs2_init_extent_tree(et, ci, bh, ocfs2_journal_access_dr,
419419
NULL, &ocfs2_dx_root_et_ops);
420420
}
421421

@@ -7241,7 +7241,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
72417241
* this proves to be false, we could always re-build
72427242
* the in-inode data from our pages.
72437243
*/
7244-
ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
7244+
ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh);
72457245
ret = ocfs2_insert_extent(handle, &et, 0, block, 1, 0, NULL);
72467246
if (ret) {
72477247
mlog_errno(ret);

‎fs/ocfs2/alloc.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ struct ocfs2_extent_tree {
6868
* specified object buffer.
6969
*/
7070
void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et,
71-
struct inode *inode,
71+
struct ocfs2_caching_info *ci,
7272
struct buffer_head *bh);
7373
void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et,
74-
struct inode *inode,
74+
struct ocfs2_caching_info *ci,
7575
struct buffer_head *bh);
7676
struct ocfs2_xattr_value_buf;
7777
void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et,
78-
struct inode *inode,
78+
struct ocfs2_caching_info *ci,
7979
struct ocfs2_xattr_value_buf *vb);
8080
void ocfs2_init_dx_root_extent_tree(struct ocfs2_extent_tree *et,
81-
struct inode *inode,
81+
struct ocfs2_caching_info *ci,
8282
struct buffer_head *bh);
8383

8484
/*

‎fs/ocfs2/aops.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,8 @@ static int ocfs2_write_cluster(struct address_space *mapping,
12591259
goto out;
12601260
}
12611261
} 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);
12631264
ret = ocfs2_mark_extent_written(inode, &et,
12641265
wc->w_handle, cpos, 1, phys,
12651266
meta_ac, &wc->w_dealloc);
@@ -1726,7 +1727,8 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
17261727
(long long)i_size_read(inode), le32_to_cpu(di->i_clusters),
17271728
clusters_to_alloc, extents_to_split);
17281729

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);
17301732
ret = ocfs2_lock_allocators(inode, &et,
17311733
clusters_to_alloc, extents_to_split,
17321734
&data_ac, &meta_ac);

‎fs/ocfs2/dir.c‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
29032903
struct ocfs2_extent_tree dx_et;
29042904
int did_quota = 0, bytes_allocated = 0;
29052905

2906-
ocfs2_init_dinode_extent_tree(&et, dir, di_bh);
2906+
ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(dir), di_bh);
29072907

29082908
alloc = ocfs2_clusters_for_bytes(sb, bytes);
29092909
dx_alloc = 0;
@@ -3125,7 +3125,9 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
31253125
ocfs2_dx_dir_index_root_block(dir, dx_root_bh,
31263126
dirdata_bh);
31273127
} 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);
31293131
ret = ocfs2_insert_extent(handle, &dx_et, 0,
31303132
dx_insert_blkno, 1, 0, NULL);
31313133
if (ret)
@@ -3345,7 +3347,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
33453347
spin_lock(&OCFS2_I(dir)->ip_lock);
33463348
if (dir_i_size == ocfs2_clusters_to_bytes(sb, OCFS2_I(dir)->ip_clusters)) {
33473349
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);
33493352
num_free_extents = ocfs2_num_free_extents(osb, &et);
33503353
if (num_free_extents < 0) {
33513354
status = num_free_extents;
@@ -3837,7 +3840,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
38373840
(unsigned long long)OCFS2_I(dir)->ip_blkno,
38383841
(unsigned long long)leaf_blkno, insert_hash);
38393842

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);
38413844

38423845
dx_root = (struct ocfs2_dx_root_block *)dx_root_bh->b_data;
38433846
/*
@@ -4216,7 +4219,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir,
42164219

42174220
/* This should never fail considering we start with an empty
42184221
* 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);
42204223
ret = ocfs2_insert_extent(handle, &et, 0, insert_blkno, 1, 0, NULL);
42214224
if (ret)
42224225
mlog_errno(ret);
@@ -4540,7 +4543,7 @@ int ocfs2_dx_dir_truncate(struct inode *dir, struct buffer_head *di_bh)
45404543
if (ocfs2_dx_root_inline(dx_root))
45414544
goto remove_index;
45424545

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);
45444547

45454548
/* XXX: What if dr_clusters is too large? */
45464549
while (le32_to_cpu(dx_root->dr_clusters)) {

‎fs/ocfs2/file.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
515515
int ret;
516516
struct ocfs2_extent_tree et;
517517

518-
ocfs2_init_dinode_extent_tree(&et, inode, fe_bh);
518+
ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), fe_bh);
519519
ret = ocfs2_add_clusters_in_btree(handle, &et, logical_offset,
520520
clusters_to_add, mark_unwritten,
521521
data_ac, meta_ac, reason_ret);
@@ -563,7 +563,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
563563
(unsigned long long)OCFS2_I(inode)->ip_blkno,
564564
(long long)i_size_read(inode), le32_to_cpu(fe->i_clusters),
565565
clusters_to_add);
566-
ocfs2_init_dinode_extent_tree(&et, inode, bh);
566+
ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), bh);
567567
status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0,
568568
&data_ac, &meta_ac);
569569
if (status) {
@@ -1394,7 +1394,7 @@ static int ocfs2_remove_inode_range(struct inode *inode,
13941394
struct address_space *mapping = inode->i_mapping;
13951395
struct ocfs2_extent_tree et;
13961396

1397-
ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
1397+
ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh);
13981398
ocfs2_init_dealloc_ctxt(&dealloc);
13991399

14001400
if (byte_len == 0)

‎fs/ocfs2/xattr.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
602602

603603
mlog(0, "(clusters_to_add for xattr= %u)\n", clusters_to_add);
604604

605-
ocfs2_init_xattr_value_extent_tree(&et, inode, vb);
605+
ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb);
606606

607607
status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
608608
OCFS2_JOURNAL_ACCESS_WRITE);
@@ -654,7 +654,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
654654
handle_t *handle = ctxt->handle;
655655
struct ocfs2_extent_tree et;
656656

657-
ocfs2_init_xattr_value_extent_tree(&et, inode, vb);
657+
ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb);
658658

659659
ret = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
660660
OCFS2_JOURNAL_ACCESS_WRITE);
@@ -4266,7 +4266,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
42664266
(unsigned long long)OCFS2_I(inode)->ip_blkno,
42674267
prev_cpos, (unsigned long long)bucket_blkno(first));
42684268

4269-
ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
4269+
ocfs2_init_xattr_tree_extent_tree(&et, INODE_CACHE(inode), root_bh);
42704270

42714271
ret = ocfs2_journal_access_xb(handle, INODE_CACHE(inode), root_bh,
42724272
OCFS2_JOURNAL_ACCESS_WRITE);
@@ -4841,7 +4841,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,
48414841
struct ocfs2_cached_dealloc_ctxt dealloc;
48424842
struct ocfs2_extent_tree et;
48434843

4844-
ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
4844+
ocfs2_init_xattr_tree_extent_tree(&et, INODE_CACHE(inode), root_bh);
48454845

48464846
ocfs2_init_dealloc_ctxt(&dealloc);
48474847

0 commit comments

Comments
 (0)