Skip to content

Commit c5d12d5

Browse files
fdmananakdave
authored andcommitted
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 <wqu@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent d26d16a commit c5d12d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/btrfs/raid56.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,9 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
577577
if (table->cache_size > RBIO_CACHE_SIZE) {
578578
struct btrfs_raid_bio *found;
579579

580-
found = list_entry(table->stripe_cache.prev,
581-
struct btrfs_raid_bio,
582-
stripe_cache);
580+
found = list_last_entry(&table->stripe_cache,
581+
struct btrfs_raid_bio,
582+
stripe_cache);
583583

584584
if (found != rbio)
585585
__remove_rbio_from_cache(found);

0 commit comments

Comments
 (0)