From: Filipe Manana Date: Thu, 1 May 2025 11:54:03 +0000 (+0100) Subject: btrfs: raid56: use list_last_entry() at cache_rbio() X-Git-Tag: v6.16-rc1~214^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5d12d5b621258eb07f4106dc9196affed1c22d0;p=thirdparty%2Flinux.git btrfs: raid56: use list_last_entry() at cache_rbio() Instead of using list_entry() against the list's prev entry, use list_last_entry(), which removes the need to know the last member is accessed through the prev list pointer and the naming makes it easier to reason about what we are doing. Reviewed-by: Qu Wenruo Reviewed-by: Johannes Thumshirn Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 8d617075ad6a1..3ff2bedfb3a4c 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -577,9 +577,9 @@ static void cache_rbio(struct btrfs_raid_bio *rbio) if (table->cache_size > RBIO_CACHE_SIZE) { struct btrfs_raid_bio *found; - found = list_entry(table->stripe_cache.prev, - struct btrfs_raid_bio, - stripe_cache); + found = list_last_entry(&table->stripe_cache, + struct btrfs_raid_bio, + stripe_cache); if (found != rbio) __remove_rbio_from_cache(found);