Skip to content

Commit df1ae36

Browse files
Matthew Wilcox (Oracle)jankara
authored andcommitted
ext2: Fix kernel-doc warnings
Document a few parameters of ext2_alloc_blocks(). Redo the alloc_new_reservation() and find_next_reservable_window() kernel-doc entirely. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230818201121.2720451-1-willy@infradead.org>
1 parent 2ebc736 commit df1ae36

File tree

2 files changed

+56
-61
lines changed

2 files changed

+56
-61
lines changed

fs/ext2/balloc.c

Lines changed: 46 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -718,36 +718,34 @@ ext2_try_to_allocate(struct super_block *sb, int group,
718718
}
719719

720720
/**
721-
* find_next_reservable_window():
722-
* find a reservable space within the given range.
723-
* It does not allocate the reservation window for now:
724-
* alloc_new_reservation() will do the work later.
721+
* find_next_reservable_window - Find a reservable space within the given range.
722+
* @search_head: The list to search.
723+
* @my_rsv: The reservation we're currently using.
724+
* @sb: The super block.
725+
* @start_block: The first block we consider to start the real search from
726+
* @last_block: The maximum block number that our goal reservable space
727+
* could start from.
725728
*
726-
* @search_head: the head of the searching list;
727-
* This is not necessarily the list head of the whole filesystem
729+
* It does not allocate the reservation window: alloc_new_reservation()
730+
* will do the work later.
728731
*
729-
* We have both head and start_block to assist the search
730-
* for the reservable space. The list starts from head,
731-
* but we will shift to the place where start_block is,
732-
* then start from there, when looking for a reservable space.
732+
* We search the given range, rather than the whole reservation double
733+
* linked list, (start_block, last_block) to find a free region that is
734+
* of my size and has not been reserved.
733735
*
734-
* @sb: the super block.
736+
* @search_head is not necessarily the list head of the whole filesystem.
737+
* We have both head and @start_block to assist the search for the
738+
* reservable space. The list starts from head, but we will shift to
739+
* the place where start_block is, then start from there, when looking
740+
* for a reservable space.
735741
*
736-
* @start_block: the first block we consider to start the real search from
737-
*
738-
* @last_block:
739-
* the maximum block number that our goal reservable space
740-
* could start from. This is normally the last block in this
741-
* group. The search will end when we found the start of next
742-
* possible reservable space is out of this boundary.
743-
* This could handle the cross boundary reservation window
744-
* request.
745-
*
746-
* basically we search from the given range, rather than the whole
747-
* reservation double linked list, (start_block, last_block)
748-
* to find a free region that is of my size and has not
749-
* been reserved.
742+
* @last_block is normally the last block in this group. The search will end
743+
* when we found the start of next possible reservable space is out
744+
* of this boundary. This could handle the cross boundary reservation
745+
* window request.
750746
*
747+
* Return: -1 if we could not find a range of sufficient size. If we could,
748+
* return 0 and fill in @my_rsv with the range information.
751749
*/
752750
static int find_next_reservable_window(
753751
struct ext2_reserve_window_node *search_head,
@@ -835,41 +833,34 @@ static int find_next_reservable_window(
835833
}
836834

837835
/**
838-
* alloc_new_reservation()--allocate a new reservation window
839-
*
840-
* To make a new reservation, we search part of the filesystem
841-
* reservation list (the list that inside the group). We try to
842-
* allocate a new reservation window near the allocation goal,
843-
* or the beginning of the group, if there is no goal.
844-
*
845-
* We first find a reservable space after the goal, then from
846-
* there, we check the bitmap for the first free block after
847-
* it. If there is no free block until the end of group, then the
848-
* whole group is full, we failed. Otherwise, check if the free
849-
* block is inside the expected reservable space, if so, we
850-
* succeed.
851-
* If the first free block is outside the reservable space, then
852-
* start from the first free block, we search for next available
853-
* space, and go on.
854-
*
855-
* on succeed, a new reservation will be found and inserted into the list
856-
* It contains at least one free block, and it does not overlap with other
857-
* reservation windows.
836+
* alloc_new_reservation - Allocate a new reservation window.
837+
* @my_rsv: The reservation we're currently using.
838+
* @grp_goal: The goal block relative to the start of the group.
839+
* @sb: The super block.
840+
* @group: The group we are trying to allocate in.
841+
* @bitmap_bh: The block group block bitmap.
858842
*
859-
* failed: we failed to find a reservation window in this group
843+
* To make a new reservation, we search part of the filesystem reservation
844+
* list (the list inside the group). We try to allocate a new
845+
* reservation window near @grp_goal, or the beginning of the
846+
* group, if @grp_goal is negative.
860847
*
861-
* @my_rsv: the reservation
848+
* We first find a reservable space after the goal, then from there,
849+
* we check the bitmap for the first free block after it. If there is
850+
* no free block until the end of group, then the whole group is full,
851+
* we failed. Otherwise, check if the free block is inside the expected
852+
* reservable space, if so, we succeed.
862853
*
863-
* @grp_goal: The goal (group-relative). It is where the search for a
864-
* free reservable space should start from.
865-
* if we have a goal(goal >0 ), then start from there,
866-
* no goal(goal = -1), we start from the first block
867-
* of the group.
854+
* If the first free block is outside the reservable space, then start
855+
* from the first free block, we search for next available space, and
856+
* go on.
868857
*
869-
* @sb: the super block
870-
* @group: the group we are trying to allocate in
871-
* @bitmap_bh: the block group block bitmap
858+
* on succeed, a new reservation will be found and inserted into the
859+
* list. It contains at least one free block, and it does not overlap
860+
* with other reservation windows.
872861
*
862+
* Return: 0 on success, -1 if we failed to find a reservation window
863+
* in this group
873864
*/
874865
static int alloc_new_reservation(struct ext2_reserve_window_node *my_rsv,
875866
ext2_grpblk_t grp_goal, struct super_block *sb,

fs/ext2/inode.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,16 @@ ext2_blks_to_allocate(Indirect * branch, int k, unsigned long blks,
385385
}
386386

387387
/**
388-
* ext2_alloc_blocks: multiple allocate blocks needed for a branch
389-
* @indirect_blks: the number of blocks need to allocate for indirect
390-
* blocks
391-
* @blks: the number of blocks need to allocate for direct blocks
392-
* @new_blocks: on return it will store the new block numbers for
393-
* the indirect blocks(if needed) and the first direct block,
388+
* ext2_alloc_blocks: Allocate multiple blocks needed for a branch.
389+
* @inode: Owner.
390+
* @goal: Preferred place for allocation.
391+
* @indirect_blks: The number of blocks needed to allocate for indirect blocks.
392+
* @blks: The number of blocks need to allocate for direct blocks.
393+
* @new_blocks: On return it will store the new block numbers for
394+
* the indirect blocks(if needed) and the first direct block.
395+
* @err: Error pointer.
396+
*
397+
* Return: Number of blocks allocated.
394398
*/
395399
static int ext2_alloc_blocks(struct inode *inode,
396400
ext2_fsblk_t goal, int indirect_blks, int blks,

0 commit comments

Comments
 (0)