@@ -718,36 +718,34 @@ ext2_try_to_allocate(struct super_block *sb, int group,
718
718
}
719
719
720
720
/**
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.
725
728
*
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.
728
731
*
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.
733
735
*
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.
735
741
*
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.
750
746
*
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.
751
749
*/
752
750
static int find_next_reservable_window (
753
751
struct ext2_reserve_window_node * search_head ,
@@ -835,41 +833,34 @@ static int find_next_reservable_window(
835
833
}
836
834
837
835
/**
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.
858
842
*
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.
860
847
*
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.
862
853
*
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.
868
857
*
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.
872
861
*
862
+ * Return: 0 on success, -1 if we failed to find a reservation window
863
+ * in this group
873
864
*/
874
865
static int alloc_new_reservation (struct ext2_reserve_window_node * my_rsv ,
875
866
ext2_grpblk_t grp_goal , struct super_block * sb ,
0 commit comments