Skip to content

Commit 08c73a4

Browse files
committed
xfs: Fix comment on xfs_trans_ail_update_bulk()
This function doesn't take the AIL lock, but should be called with AIL lock held. Also (hopefuly) simplify the comment. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chandan Babu R <chandanbabu@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent fa8deae commit 08c73a4

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

fs/xfs/xfs_trans_ail.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -777,26 +777,28 @@ xfs_ail_update_finish(
777777
}
778778

779779
/*
780-
* xfs_trans_ail_update - bulk AIL insertion operation.
780+
* xfs_trans_ail_update_bulk - bulk AIL insertion operation.
781781
*
782-
* @xfs_trans_ail_update takes an array of log items that all need to be
782+
* @xfs_trans_ail_update_bulk takes an array of log items that all need to be
783783
* positioned at the same LSN in the AIL. If an item is not in the AIL, it will
784-
* be added. Otherwise, it will be repositioned by removing it and re-adding
785-
* it to the AIL. If we move the first item in the AIL, update the log tail to
786-
* match the new minimum LSN in the AIL.
784+
* be added. Otherwise, it will be repositioned by removing it and re-adding
785+
* it to the AIL.
787786
*
788-
* This function takes the AIL lock once to execute the update operations on
789-
* all the items in the array, and as such should not be called with the AIL
790-
* lock held. As a result, once we have the AIL lock, we need to check each log
791-
* item LSN to confirm it needs to be moved forward in the AIL.
787+
* If we move the first item in the AIL, update the log tail to match the new
788+
* minimum LSN in the AIL.
792789
*
793-
* To optimise the insert operation, we delete all the items from the AIL in
794-
* the first pass, moving them into a temporary list, then splice the temporary
795-
* list into the correct position in the AIL. This avoids needing to do an
796-
* insert operation on every item.
790+
* This function should be called with the AIL lock held.
797791
*
798-
* This function must be called with the AIL lock held. The lock is dropped
799-
* before returning.
792+
* To optimise the insert operation, we add all items to a temporary list, then
793+
* splice this list into the correct position in the AIL.
794+
*
795+
* Items that are already in the AIL are first deleted from their current
796+
* location before being added to the temporary list.
797+
*
798+
* This avoids needing to do an insert operation on every item.
799+
*
800+
* The AIL lock is dropped by xfs_ail_update_finish() before returning to
801+
* the caller.
800802
*/
801803
void
802804
xfs_trans_ail_update_bulk(

0 commit comments

Comments
 (0)