diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-12-09 17:30:41 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:40:32 -0500 |
commit | d72cc72d57ecaf9047da51269dabd6880c1399ac (patch) | |
tree | ce272e0f7933fcdda4e87d2fd484ffad69a68e52 /fs | |
parent | 2a50a743bdaab104155bd9e988d2ba3bb4177263 (diff) |
ocfs2: Pull ocfs2_xattr_value_buf up from __ocfs2_remove_xattr_range().
Place an ocfs2_xattr_value_buf in __ocfs2_xattr_shrink_size() and pass
it down to __ocfs2_remove_xattr_range().
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/xattr.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 123d378aba9e..3b059cf2eb45 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -636,8 +636,7 @@ leave: | |||
636 | } | 636 | } |
637 | 637 | ||
638 | static int __ocfs2_remove_xattr_range(struct inode *inode, | 638 | static int __ocfs2_remove_xattr_range(struct inode *inode, |
639 | struct buffer_head *root_bh, | 639 | struct ocfs2_xattr_value_buf *vb, |
640 | struct ocfs2_xattr_value_root *xv, | ||
641 | u32 cpos, u32 phys_cpos, u32 len, | 640 | u32 cpos, u32 phys_cpos, u32 len, |
642 | struct ocfs2_xattr_set_ctxt *ctxt) | 641 | struct ocfs2_xattr_set_ctxt *ctxt) |
643 | { | 642 | { |
@@ -645,16 +644,11 @@ static int __ocfs2_remove_xattr_range(struct inode *inode, | |||
645 | u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos); | 644 | u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos); |
646 | handle_t *handle = ctxt->handle; | 645 | handle_t *handle = ctxt->handle; |
647 | struct ocfs2_extent_tree et; | 646 | struct ocfs2_extent_tree et; |
648 | struct ocfs2_xattr_value_buf vb = { | ||
649 | .vb_bh = root_bh, | ||
650 | .vb_xv = xv, | ||
651 | .vb_access = ocfs2_journal_access, | ||
652 | }; | ||
653 | 647 | ||
654 | ocfs2_init_xattr_value_extent_tree(&et, inode, &vb); | 648 | ocfs2_init_xattr_value_extent_tree(&et, inode, vb); |
655 | 649 | ||
656 | ret = vb.vb_access(handle, inode, vb.vb_bh, | 650 | ret = vb->vb_access(handle, inode, vb->vb_bh, |
657 | OCFS2_JOURNAL_ACCESS_WRITE); | 651 | OCFS2_JOURNAL_ACCESS_WRITE); |
658 | if (ret) { | 652 | if (ret) { |
659 | mlog_errno(ret); | 653 | mlog_errno(ret); |
660 | goto out; | 654 | goto out; |
@@ -667,9 +661,9 @@ static int __ocfs2_remove_xattr_range(struct inode *inode, | |||
667 | goto out; | 661 | goto out; |
668 | } | 662 | } |
669 | 663 | ||
670 | le32_add_cpu(&vb.vb_xv->xr_clusters, -len); | 664 | le32_add_cpu(&vb->vb_xv->xr_clusters, -len); |
671 | 665 | ||
672 | ret = ocfs2_journal_dirty(handle, vb.vb_bh); | 666 | ret = ocfs2_journal_dirty(handle, vb->vb_bh); |
673 | if (ret) { | 667 | if (ret) { |
674 | mlog_errno(ret); | 668 | mlog_errno(ret); |
675 | goto out; | 669 | goto out; |
@@ -693,6 +687,11 @@ static int ocfs2_xattr_shrink_size(struct inode *inode, | |||
693 | int ret = 0; | 687 | int ret = 0; |
694 | u32 trunc_len, cpos, phys_cpos, alloc_size; | 688 | u32 trunc_len, cpos, phys_cpos, alloc_size; |
695 | u64 block; | 689 | u64 block; |
690 | struct ocfs2_xattr_value_buf vb = { | ||
691 | .vb_bh = root_bh, | ||
692 | .vb_xv = xv, | ||
693 | .vb_access = ocfs2_journal_access, | ||
694 | }; | ||
696 | 695 | ||
697 | if (old_clusters <= new_clusters) | 696 | if (old_clusters <= new_clusters) |
698 | return 0; | 697 | return 0; |
@@ -701,7 +700,8 @@ static int ocfs2_xattr_shrink_size(struct inode *inode, | |||
701 | trunc_len = old_clusters - new_clusters; | 700 | trunc_len = old_clusters - new_clusters; |
702 | while (trunc_len) { | 701 | while (trunc_len) { |
703 | ret = ocfs2_xattr_get_clusters(inode, cpos, &phys_cpos, | 702 | ret = ocfs2_xattr_get_clusters(inode, cpos, &phys_cpos, |
704 | &alloc_size, &xv->xr_list); | 703 | &alloc_size, |
704 | &vb.vb_xv->xr_list); | ||
705 | if (ret) { | 705 | if (ret) { |
706 | mlog_errno(ret); | 706 | mlog_errno(ret); |
707 | goto out; | 707 | goto out; |
@@ -710,7 +710,7 @@ static int ocfs2_xattr_shrink_size(struct inode *inode, | |||
710 | if (alloc_size > trunc_len) | 710 | if (alloc_size > trunc_len) |
711 | alloc_size = trunc_len; | 711 | alloc_size = trunc_len; |
712 | 712 | ||
713 | ret = __ocfs2_remove_xattr_range(inode, root_bh, xv, cpos, | 713 | ret = __ocfs2_remove_xattr_range(inode, &vb, cpos, |
714 | phys_cpos, alloc_size, | 714 | phys_cpos, alloc_size, |
715 | ctxt); | 715 | ctxt); |
716 | if (ret) { | 716 | if (ret) { |