提交 721860d5 编写于 作者: J Johannes Thumshirn 提交者: David Sterba

btrfs: remove pointless local variable in lock_stripe_add()

In lock_stripe_add() we're caching the bucket for the stripe hash table
just for a single call to dereference the stripe hash.

If we just directly call rbio_bucket() we can safe the pointless local
variable.

Also move the dereferencing of the stripe hash outside of the variable
declaration block to not break over the 80 characters limit.
Reviewed-by: NNikolay Borisov <nborisov@suse.com>
Signed-off-by: NJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 9d6cb1b0
...@@ -671,8 +671,7 @@ static struct page *rbio_qstripe_page(struct btrfs_raid_bio *rbio, int index) ...@@ -671,8 +671,7 @@ static struct page *rbio_qstripe_page(struct btrfs_raid_bio *rbio, int index)
*/ */
static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio) static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
{ {
int bucket = rbio_bucket(rbio); struct btrfs_stripe_hash *h;
struct btrfs_stripe_hash *h = rbio->fs_info->stripe_hash_table->table + bucket;
struct btrfs_raid_bio *cur; struct btrfs_raid_bio *cur;
struct btrfs_raid_bio *pending; struct btrfs_raid_bio *pending;
unsigned long flags; unsigned long flags;
...@@ -680,6 +679,8 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio) ...@@ -680,6 +679,8 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
struct btrfs_raid_bio *cache_drop = NULL; struct btrfs_raid_bio *cache_drop = NULL;
int ret = 0; int ret = 0;
h = rbio->fs_info->stripe_hash_table->table + rbio_bucket(rbio);
spin_lock_irqsave(&h->lock, flags); spin_lock_irqsave(&h->lock, flags);
list_for_each_entry(cur, &h->hash_list, hash_list) { list_for_each_entry(cur, &h->hash_list, hash_list) {
if (cur->bbio->raid_map[0] != rbio->bbio->raid_map[0]) if (cur->bbio->raid_map[0] != rbio->bbio->raid_map[0])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册