diff options
author | Bob Peterson <rpeterso@redhat.com> | 2007-12-10 15:13:27 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-01-25 03:08:25 -0500 |
commit | e9e1ef2b6ee401d7c1e1eb38052857b4b206d172 (patch) | |
tree | 68dff93cf4058eb06b162d800f08ff7752cd1a55 /fs/gfs2 | |
parent | 2066b58b0a038d7aedd24133677efb8856cac3a1 (diff) |
[GFS2] Remove function gfs2_get_block
This patch is just a cleanup. Function gfs2_get_block() just calls
function gfs2_block_map reversing the last two parameters. By
reversing the parameters, gfs2_block_map() may be called directly
and function gfs2_get_block may be eliminated altogether.
Since this function is done for every block operation,
this streamlines the code and makes it a little bit more efficient.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/bmap.c | 8 | ||||
-rw-r--r-- | fs/gfs2/bmap.h | 2 | ||||
-rw-r--r-- | fs/gfs2/log.c | 2 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 30 | ||||
-rw-r--r-- | fs/gfs2/ops_address.h | 2 | ||||
-rw-r--r-- | fs/gfs2/ops_file.c | 2 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 4 | ||||
-rw-r--r-- | fs/gfs2/recovery.c | 2 |
8 files changed, 17 insertions, 35 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 1cfd493e30fb..49486029edc2 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -452,8 +452,8 @@ static inline void bmap_unlock(struct inode *inode, int create) | |||
452 | * Returns: errno | 452 | * Returns: errno |
453 | */ | 453 | */ |
454 | 454 | ||
455 | int gfs2_block_map(struct inode *inode, u64 lblock, int create, | 455 | int gfs2_block_map(struct inode *inode, sector_t lblock, |
456 | struct buffer_head *bh_map) | 456 | struct buffer_head *bh_map, int create) |
457 | { | 457 | { |
458 | struct gfs2_inode *ip = GFS2_I(inode); | 458 | struct gfs2_inode *ip = GFS2_I(inode); |
459 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 459 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
@@ -559,7 +559,7 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi | |||
559 | BUG_ON(!new); | 559 | BUG_ON(!new); |
560 | 560 | ||
561 | bh.b_size = 1 << (inode->i_blkbits + 5); | 561 | bh.b_size = 1 << (inode->i_blkbits + 5); |
562 | ret = gfs2_block_map(inode, lblock, create, &bh); | 562 | ret = gfs2_block_map(inode, lblock, &bh, create); |
563 | *extlen = bh.b_size >> inode->i_blkbits; | 563 | *extlen = bh.b_size >> inode->i_blkbits; |
564 | *dblock = bh.b_blocknr; | 564 | *dblock = bh.b_blocknr; |
565 | if (buffer_new(&bh)) | 565 | if (buffer_new(&bh)) |
@@ -909,7 +909,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping) | |||
909 | err = 0; | 909 | err = 0; |
910 | 910 | ||
911 | if (!buffer_mapped(bh)) { | 911 | if (!buffer_mapped(bh)) { |
912 | gfs2_get_block(inode, iblock, bh, 0); | 912 | gfs2_block_map(inode, iblock, bh, 0); |
913 | /* unmapped? It's a hole - nothing to do */ | 913 | /* unmapped? It's a hole - nothing to do */ |
914 | if (!buffer_mapped(bh)) | 914 | if (!buffer_mapped(bh)) |
915 | goto unlock; | 915 | goto unlock; |
diff --git a/fs/gfs2/bmap.h b/fs/gfs2/bmap.h index ac2fd04370dc..4e6cde2943bd 100644 --- a/fs/gfs2/bmap.h +++ b/fs/gfs2/bmap.h | |||
@@ -15,7 +15,7 @@ struct gfs2_inode; | |||
15 | struct page; | 15 | struct page; |
16 | 16 | ||
17 | int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page); | 17 | int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page); |
18 | int gfs2_block_map(struct inode *inode, u64 lblock, int create, struct buffer_head *bh); | 18 | int gfs2_block_map(struct inode *inode, sector_t lblock, struct buffer_head *bh, int create); |
19 | int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen); | 19 | int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen); |
20 | 20 | ||
21 | int gfs2_truncatei(struct gfs2_inode *ip, u64 size); | 21 | int gfs2_truncatei(struct gfs2_inode *ip, u64 size); |
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 96dcf050e6c9..14333d81cf7d 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -344,7 +344,7 @@ static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) | |||
344 | struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; | 344 | struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; |
345 | 345 | ||
346 | bh_map.b_size = 1 << inode->i_blkbits; | 346 | bh_map.b_size = 1 << inode->i_blkbits; |
347 | error = gfs2_block_map(inode, lbn, 0, &bh_map); | 347 | error = gfs2_block_map(inode, lbn, &bh_map, 0); |
348 | if (error || !bh_map.b_blocknr) | 348 | if (error || !bh_map.b_blocknr) |
349 | printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, | 349 | printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, |
350 | (unsigned long long)bh_map.b_blocknr, lbn); | 350 | (unsigned long long)bh_map.b_blocknr, lbn); |
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 7353933483bb..8f94e306c862 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -59,22 +59,6 @@ static void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * gfs2_get_block - Fills in a buffer head with details about a block | ||
63 | * @inode: The inode | ||
64 | * @lblock: The block number to look up | ||
65 | * @bh_result: The buffer head to return the result in | ||
66 | * @create: Non-zero if we may add block to the file | ||
67 | * | ||
68 | * Returns: errno | ||
69 | */ | ||
70 | |||
71 | int gfs2_get_block(struct inode *inode, sector_t lblock, | ||
72 | struct buffer_head *bh_result, int create) | ||
73 | { | ||
74 | return gfs2_block_map(inode, lblock, create, bh_result); | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * gfs2_get_block_noalloc - Fills in a buffer head with details about a block | 62 | * gfs2_get_block_noalloc - Fills in a buffer head with details about a block |
79 | * @inode: The inode | 63 | * @inode: The inode |
80 | * @lblock: The block number to look up | 64 | * @lblock: The block number to look up |
@@ -89,7 +73,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock, | |||
89 | { | 73 | { |
90 | int error; | 74 | int error; |
91 | 75 | ||
92 | error = gfs2_block_map(inode, lblock, 0, bh_result); | 76 | error = gfs2_block_map(inode, lblock, bh_result, 0); |
93 | if (error) | 77 | if (error) |
94 | return error; | 78 | return error; |
95 | if (!buffer_mapped(bh_result)) | 79 | if (!buffer_mapped(bh_result)) |
@@ -100,7 +84,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock, | |||
100 | static int gfs2_get_block_direct(struct inode *inode, sector_t lblock, | 84 | static int gfs2_get_block_direct(struct inode *inode, sector_t lblock, |
101 | struct buffer_head *bh_result, int create) | 85 | struct buffer_head *bh_result, int create) |
102 | { | 86 | { |
103 | return gfs2_block_map(inode, lblock, 0, bh_result); | 87 | return gfs2_block_map(inode, lblock, bh_result, 0); |
104 | } | 88 | } |
105 | 89 | ||
106 | /** | 90 | /** |
@@ -504,7 +488,7 @@ static int __gfs2_readpage(void *file, struct page *page) | |||
504 | error = stuffed_readpage(ip, page); | 488 | error = stuffed_readpage(ip, page); |
505 | unlock_page(page); | 489 | unlock_page(page); |
506 | } else { | 490 | } else { |
507 | error = mpage_readpage(page, gfs2_get_block); | 491 | error = mpage_readpage(page, gfs2_block_map); |
508 | } | 492 | } |
509 | 493 | ||
510 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 494 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
@@ -598,7 +582,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, struct file_ra_state *ra_state, | |||
598 | * Any I/O we ignore at this time will be done via readpage later. | 582 | * Any I/O we ignore at this time will be done via readpage later. |
599 | * 2. We don't handle stuffed files here we let readpage do the honours. | 583 | * 2. We don't handle stuffed files here we let readpage do the honours. |
600 | * 3. mpage_readpages() does most of the heavy lifting in the common case. | 584 | * 3. mpage_readpages() does most of the heavy lifting in the common case. |
601 | * 4. gfs2_get_block() is relied upon to set BH_Boundary in the right places. | 585 | * 4. gfs2_block_map() is relied upon to set BH_Boundary in the right places. |
602 | */ | 586 | */ |
603 | 587 | ||
604 | static int gfs2_readpages(struct file *file, struct address_space *mapping, | 588 | static int gfs2_readpages(struct file *file, struct address_space *mapping, |
@@ -615,7 +599,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping, | |||
615 | if (unlikely(ret)) | 599 | if (unlikely(ret)) |
616 | goto out_uninit; | 600 | goto out_uninit; |
617 | if (!gfs2_is_stuffed(ip)) | 601 | if (!gfs2_is_stuffed(ip)) |
618 | ret = mpage_readpages(mapping, pages, nr_pages, gfs2_get_block); | 602 | ret = mpage_readpages(mapping, pages, nr_pages, gfs2_block_map); |
619 | gfs2_glock_dq(&gh); | 603 | gfs2_glock_dq(&gh); |
620 | out_uninit: | 604 | out_uninit: |
621 | gfs2_holder_uninit(&gh); | 605 | gfs2_holder_uninit(&gh); |
@@ -710,7 +694,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, | |||
710 | } | 694 | } |
711 | 695 | ||
712 | prepare_write: | 696 | prepare_write: |
713 | error = block_prepare_write(page, from, to, gfs2_get_block); | 697 | error = block_prepare_write(page, from, to, gfs2_block_map); |
714 | out: | 698 | out: |
715 | if (error == 0) | 699 | if (error == 0) |
716 | return 0; | 700 | return 0; |
@@ -923,7 +907,7 @@ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock) | |||
923 | return 0; | 907 | return 0; |
924 | 908 | ||
925 | if (!gfs2_is_stuffed(ip)) | 909 | if (!gfs2_is_stuffed(ip)) |
926 | dblock = generic_block_bmap(mapping, lblock, gfs2_get_block); | 910 | dblock = generic_block_bmap(mapping, lblock, gfs2_block_map); |
927 | 911 | ||
928 | gfs2_glock_dq_uninit(&i_gh); | 912 | gfs2_glock_dq_uninit(&i_gh); |
929 | 913 | ||
diff --git a/fs/gfs2/ops_address.h b/fs/gfs2/ops_address.h index d3b76d0cdc81..5da21285bba4 100644 --- a/fs/gfs2/ops_address.h +++ b/fs/gfs2/ops_address.h | |||
@@ -14,8 +14,6 @@ | |||
14 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | 16 | ||
17 | extern int gfs2_get_block(struct inode *inode, sector_t lblock, | ||
18 | struct buffer_head *bh_result, int create); | ||
19 | extern int gfs2_releasepage(struct page *page, gfp_t gfp_mask); | 17 | extern int gfs2_releasepage(struct page *page, gfp_t gfp_mask); |
20 | extern int gfs2_internal_read(struct gfs2_inode *ip, | 18 | extern int gfs2_internal_read(struct gfs2_inode *ip, |
21 | struct file_ra_state *ra_state, | 19 | struct file_ra_state *ra_state, |
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index 2569c13eb108..597f7ff2bc11 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -323,7 +323,7 @@ static int gfs2_allocate_page_backing(struct page *page) | |||
323 | do { | 323 | do { |
324 | bh.b_state = 0; | 324 | bh.b_state = 0; |
325 | bh.b_size = size; | 325 | bh.b_size = size; |
326 | gfs2_block_map(inode, lblock, 1, &bh); | 326 | gfs2_block_map(inode, lblock, &bh, 1); |
327 | if (!buffer_mapped(&bh)) | 327 | if (!buffer_mapped(&bh)) |
328 | return -EIO; | 328 | return -EIO; |
329 | size -= bh.b_size; | 329 | size -= bh.b_size; |
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 4996f0ef3007..8b4c20c49ca7 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -276,7 +276,7 @@ static int bh_get(struct gfs2_quota_data *qd) | |||
276 | offset = qd->qd_slot % sdp->sd_qc_per_block;; | 276 | offset = qd->qd_slot % sdp->sd_qc_per_block;; |
277 | 277 | ||
278 | bh_map.b_size = 1 << ip->i_inode.i_blkbits; | 278 | bh_map.b_size = 1 << ip->i_inode.i_blkbits; |
279 | error = gfs2_block_map(&ip->i_inode, block, 0, &bh_map); | 279 | error = gfs2_block_map(&ip->i_inode, block, &bh_map, 0); |
280 | if (error) | 280 | if (error) |
281 | goto fail; | 281 | goto fail; |
282 | error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh); | 282 | error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh); |
@@ -645,7 +645,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
645 | } | 645 | } |
646 | 646 | ||
647 | if (!buffer_mapped(bh)) { | 647 | if (!buffer_mapped(bh)) { |
648 | gfs2_get_block(inode, iblock, bh, 1); | 648 | gfs2_block_map(inode, iblock, bh, 1); |
649 | if (!buffer_mapped(bh)) | 649 | if (!buffer_mapped(bh)) |
650 | goto unlock; | 650 | goto unlock; |
651 | } | 651 | } |
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index beb6c7ac0086..27c994f2d1f0 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -391,7 +391,7 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header_host *hea | |||
391 | lblock = head->lh_blkno; | 391 | lblock = head->lh_blkno; |
392 | gfs2_replay_incr_blk(sdp, &lblock); | 392 | gfs2_replay_incr_blk(sdp, &lblock); |
393 | bh_map.b_size = 1 << ip->i_inode.i_blkbits; | 393 | bh_map.b_size = 1 << ip->i_inode.i_blkbits; |
394 | error = gfs2_block_map(&ip->i_inode, lblock, 0, &bh_map); | 394 | error = gfs2_block_map(&ip->i_inode, lblock, &bh_map, 0); |
395 | if (error) | 395 | if (error) |
396 | return error; | 396 | return error; |
397 | if (!bh_map.b_blocknr) { | 397 | if (!bh_map.b_blocknr) { |