aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/suballoc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2010-05-06 01:59:06 -0400
committerTao Ma <tao.ma@oracle.com>2010-05-06 01:59:06 -0400
commit1ed9b777f77929ae961d6f9cdf828a07200ba71c (patch)
treea0bb6c9e9be1f5d3d46d6cdac0a4397303e22795 /fs/ocfs2/suballoc.c
parent13e434cf0cacd2f03a7f4cd077e3e995ef5ef710 (diff)
ocfs2: ocfs2_claim_*() don't need an ocfs2_super argument.
They all take an ocfs2_alloc_context, which has the allocation inode. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Tao Ma <tao.ma@oracle.com>
Diffstat (limited to 'fs/ocfs2/suballoc.c')
-rw-r--r--fs/ocfs2/suballoc.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index c9661c47786..3f620177778 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -439,7 +439,7 @@ ocfs2_block_group_alloc_contig(struct ocfs2_super *osb, handle_t *handle,
439 struct buffer_head *bg_bh; 439 struct buffer_head *bg_bh;
440 unsigned int alloc_rec = ocfs2_find_smallest_chain(cl); 440 unsigned int alloc_rec = ocfs2_find_smallest_chain(cl);
441 441
442 status = ocfs2_claim_clusters(osb, handle, ac, 442 status = ocfs2_claim_clusters(handle, ac,
443 le16_to_cpu(cl->cl_cpg), &bit_off, 443 le16_to_cpu(cl->cl_cpg), &bit_off,
444 &num_bits); 444 &num_bits);
445 if (status < 0) { 445 if (status < 0) {
@@ -481,7 +481,7 @@ static int ocfs2_block_group_claim_bits(struct ocfs2_super *osb,
481 int status; 481 int status;
482 482
483 while (min_bits) { 483 while (min_bits) {
484 status = ocfs2_claim_clusters(osb, handle, ac, min_bits, 484 status = ocfs2_claim_clusters(handle, ac, min_bits,
485 bit_off, num_bits); 485 bit_off, num_bits);
486 if (status != -ENOSPC) 486 if (status != -ENOSPC)
487 break; 487 break;
@@ -1919,8 +1919,7 @@ bail:
1919 return status; 1919 return status;
1920} 1920}
1921 1921
1922int ocfs2_claim_metadata(struct ocfs2_super *osb, 1922int ocfs2_claim_metadata(handle_t *handle,
1923 handle_t *handle,
1924 struct ocfs2_alloc_context *ac, 1923 struct ocfs2_alloc_context *ac,
1925 u32 bits_wanted, 1924 u32 bits_wanted,
1926 u16 *suballoc_bit_start, 1925 u16 *suballoc_bit_start,
@@ -1943,7 +1942,7 @@ int ocfs2_claim_metadata(struct ocfs2_super *osb,
1943 mlog_errno(status); 1942 mlog_errno(status);
1944 goto bail; 1943 goto bail;
1945 } 1944 }
1946 atomic_inc(&osb->alloc_stats.bg_allocs); 1945 atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs);
1947 1946
1948 *suballoc_bit_start = res.sr_bit_offset; 1947 *suballoc_bit_start = res.sr_bit_offset;
1949 *blkno_start = res.sr_bg_blkno + (u64)(res.sr_bit_offset); 1948 *blkno_start = res.sr_bg_blkno + (u64)(res.sr_bit_offset);
@@ -1986,8 +1985,7 @@ static inline void ocfs2_save_inode_ac_group(struct inode *dir,
1986 OCFS2_I(dir)->ip_last_used_slot = ac->ac_alloc_slot; 1985 OCFS2_I(dir)->ip_last_used_slot = ac->ac_alloc_slot;
1987} 1986}
1988 1987
1989int ocfs2_claim_new_inode(struct ocfs2_super *osb, 1988int ocfs2_claim_new_inode(handle_t *handle,
1990 handle_t *handle,
1991 struct inode *dir, 1989 struct inode *dir,
1992 struct buffer_head *parent_fe_bh, 1990 struct buffer_head *parent_fe_bh,
1993 struct ocfs2_alloc_context *ac, 1991 struct ocfs2_alloc_context *ac,
@@ -2015,7 +2013,7 @@ int ocfs2_claim_new_inode(struct ocfs2_super *osb,
2015 mlog_errno(status); 2013 mlog_errno(status);
2016 goto bail; 2014 goto bail;
2017 } 2015 }
2018 atomic_inc(&osb->alloc_stats.bg_allocs); 2016 atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs);
2019 2017
2020 BUG_ON(res.sr_bits != 1); 2018 BUG_ON(res.sr_bits != 1);
2021 2019
@@ -2090,8 +2088,7 @@ static inline void ocfs2_block_to_cluster_group(struct inode *inode,
2090 * contig. allocation, set to '1' to indicate we can deal with extents 2088 * contig. allocation, set to '1' to indicate we can deal with extents
2091 * of any size. 2089 * of any size.
2092 */ 2090 */
2093int __ocfs2_claim_clusters(struct ocfs2_super *osb, 2091int __ocfs2_claim_clusters(handle_t *handle,
2094 handle_t *handle,
2095 struct ocfs2_alloc_context *ac, 2092 struct ocfs2_alloc_context *ac,
2096 u32 min_clusters, 2093 u32 min_clusters,
2097 u32 max_clusters, 2094 u32 max_clusters,
@@ -2101,6 +2098,7 @@ int __ocfs2_claim_clusters(struct ocfs2_super *osb,
2101 int status; 2098 int status;
2102 unsigned int bits_wanted = max_clusters; 2099 unsigned int bits_wanted = max_clusters;
2103 struct ocfs2_suballoc_result res; 2100 struct ocfs2_suballoc_result res;
2101 struct ocfs2_super *osb = OCFS2_SB(ac->ac_inode->i_sb);
2104 2102
2105 mlog_entry_void(); 2103 mlog_entry_void();
2106 2104
@@ -2161,8 +2159,7 @@ bail:
2161 return status; 2159 return status;
2162} 2160}
2163 2161
2164int ocfs2_claim_clusters(struct ocfs2_super *osb, 2162int ocfs2_claim_clusters(handle_t *handle,
2165 handle_t *handle,
2166 struct ocfs2_alloc_context *ac, 2163 struct ocfs2_alloc_context *ac,
2167 u32 min_clusters, 2164 u32 min_clusters,
2168 u32 *cluster_start, 2165 u32 *cluster_start,
@@ -2170,7 +2167,7 @@ int ocfs2_claim_clusters(struct ocfs2_super *osb,
2170{ 2167{
2171 unsigned int bits_wanted = ac->ac_bits_wanted - ac->ac_bits_given; 2168 unsigned int bits_wanted = ac->ac_bits_wanted - ac->ac_bits_given;
2172 2169
2173 return __ocfs2_claim_clusters(osb, handle, ac, min_clusters, 2170 return __ocfs2_claim_clusters(handle, ac, min_clusters,
2174 bits_wanted, cluster_start, num_clusters); 2171 bits_wanted, cluster_start, num_clusters);
2175} 2172}
2176 2173