Skip to content

Commit a57c8fd

Browse files
Mark FashehJoel Becker
authored andcommitted
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>
1 parent 33d5d38 commit a57c8fd

2 files changed

Lines changed: 1 addition & 56 deletions

File tree

‎fs/ocfs2/localalloc.c‎

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -479,46 +479,6 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb,
479479
return status;
480480
}
481481

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-
522482
/*
523483
* make sure we've got at least bits_wanted contiguous bits in the
524484
* local alloc. You lose them when you drop i_mutex.
@@ -611,17 +571,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
611571
mlog(0, "Calling in_range for max block %llu\n",
612572
(unsigned long long)ac->ac_max_block);
613573

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-
625574
ac->ac_inode = local_alloc_inode;
626575
/* We should never use localalloc from another slot */
627576
ac->ac_alloc_slot = osb->slot_num;

‎fs/ocfs2/suballoc.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -941,11 +941,7 @@ static int ocfs2_reserve_clusters_with_limit(struct ocfs2_super *osb,
941941
status = ocfs2_reserve_local_alloc_bits(osb,
942942
bits_wanted,
943943
*ac);
944-
if (status == -EFBIG) {
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)) {
944+
if ((status < 0) && (status != -ENOSPC)) {
949945
mlog_errno(status);
950946
goto bail;
951947
}

0 commit comments

Comments
 (0)