diff options
author | Mark Fasheh <mfasheh@suse.com> | 2010-03-17 00:01:00 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-05-05 21:17:31 -0400 |
commit | a57c8fd2ad238258cc983049008aea5f985804b2 (patch) | |
tree | 2d9142401ca7a03df6edaefcc3fd937f2f24fc8d /fs/ocfs2 | |
parent | 33d5d380d667ad264675cfdb297dfc3c5b6542cc (diff) |
ocfs2: remove ocfs2_local_alloc_in_range()
Inodes are always allocated from the global bitmap now so we don't need this
any more. Also, the existing implementation bounces reservations around
needlessly.
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/localalloc.c | 51 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.c | 6 |
2 files changed, 1 insertions, 56 deletions
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 7fe8149a0002..880e4bc827be 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -479,46 +479,6 @@ out: | |||
479 | return status; | 479 | return status; |
480 | } | 480 | } |
481 | 481 | ||
482 | /* Check to see if the local alloc window is within ac->ac_max_block */ | ||
483 | static int ocfs2_local_alloc_in_range(struct inode *inode, | ||
484 | struct ocfs2_alloc_context *ac, | ||
485 | u32 bits_wanted) | ||
486 | { | ||
487 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
488 | struct ocfs2_dinode *alloc; | ||
489 | struct ocfs2_local_alloc *la; | ||
490 | int start; | ||
491 | u64 block_off; | ||
492 | |||
493 | if (!ac->ac_max_block) | ||
494 | return 1; | ||
495 | |||
496 | alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; | ||
497 | la = OCFS2_LOCAL_ALLOC(alloc); | ||
498 | |||
499 | start = ocfs2_local_alloc_find_clear_bits(osb, alloc, &bits_wanted, NULL); | ||
500 | if (start == -1) { | ||
501 | mlog_errno(-ENOSPC); | ||
502 | return 0; | ||
503 | } | ||
504 | |||
505 | /* | ||
506 | * Converting (bm_off + start + bits_wanted) to blocks gives us | ||
507 | * the blkno just past our actual allocation. This is perfect | ||
508 | * to compare with ac_max_block. | ||
509 | */ | ||
510 | block_off = ocfs2_clusters_to_blocks(inode->i_sb, | ||
511 | le32_to_cpu(la->la_bm_off) + | ||
512 | start + bits_wanted); | ||
513 | mlog(0, "Checking %llu against %llu\n", | ||
514 | (unsigned long long)block_off, | ||
515 | (unsigned long long)ac->ac_max_block); | ||
516 | if (block_off > ac->ac_max_block) | ||
517 | return 0; | ||
518 | |||
519 | return 1; | ||
520 | } | ||
521 | |||
522 | /* | 482 | /* |
523 | * make sure we've got at least bits_wanted contiguous bits in the | 483 | * make sure we've got at least bits_wanted contiguous bits in the |
524 | * local alloc. You lose them when you drop i_mutex. | 484 | * local alloc. You lose them when you drop i_mutex. |
@@ -611,17 +571,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, | |||
611 | mlog(0, "Calling in_range for max block %llu\n", | 571 | mlog(0, "Calling in_range for max block %llu\n", |
612 | (unsigned long long)ac->ac_max_block); | 572 | (unsigned long long)ac->ac_max_block); |
613 | 573 | ||
614 | if (!ocfs2_local_alloc_in_range(local_alloc_inode, ac, | ||
615 | bits_wanted)) { | ||
616 | /* | ||
617 | * The window is outside ac->ac_max_block. | ||
618 | * This errno tells the caller to keep localalloc enabled | ||
619 | * but to get the allocation from the main bitmap. | ||
620 | */ | ||
621 | status = -EFBIG; | ||
622 | goto bail; | ||
623 | } | ||
624 | |||
625 | ac->ac_inode = local_alloc_inode; | 574 | ac->ac_inode = local_alloc_inode; |
626 | /* We should never use localalloc from another slot */ | 575 | /* We should never use localalloc from another slot */ |
627 | ac->ac_alloc_slot = osb->slot_num; | 576 | ac->ac_alloc_slot = osb->slot_num; |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index df95707c8b10..667d622b3659 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -941,11 +941,7 @@ static int ocfs2_reserve_clusters_with_limit(struct ocfs2_super *osb, | |||
941 | status = ocfs2_reserve_local_alloc_bits(osb, | 941 | status = ocfs2_reserve_local_alloc_bits(osb, |
942 | bits_wanted, | 942 | bits_wanted, |
943 | *ac); | 943 | *ac); |
944 | if (status == -EFBIG) { | 944 | if ((status < 0) && (status != -ENOSPC)) { |
945 | /* The local alloc window is outside ac_max_block. | ||
946 | * use the main bitmap. */ | ||
947 | status = -ENOSPC; | ||
948 | } else if ((status < 0) && (status != -ENOSPC)) { | ||
949 | mlog_errno(status); | 945 | mlog_errno(status); |
950 | goto bail; | 946 | goto bail; |
951 | } | 947 | } |