Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: David Sterba <dsterba@suse.com>
Cc: Linux BTRFS Mailinglist <linux-btrfs@vger.kernel.org>,
	Johannes Thumshirn <jthumshirn@suse.de>
Subject: [PATCH 2/4] btrfs: remove pointless local variable in lock_stripe_add()
Date: Fri, 18 Oct 2019 11:58:21 +0200	[thread overview]
Message-ID: <20191018095823.15282-3-jthumshirn@suse.de> (raw)
In-Reply-To: <20191018095823.15282-1-jthumshirn@suse.de>

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.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 fs/btrfs/raid56.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 9e8a6c447e51..530719ff8185 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -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)
 {
-	int bucket = rbio_bucket(rbio);
-	struct btrfs_stripe_hash *h = rbio->fs_info->stripe_hash_table->table + bucket;
+	struct btrfs_stripe_hash *h;
 	struct btrfs_raid_bio *cur;
 	struct btrfs_raid_bio *pending;
 	unsigned long flags;
@@ -680,6 +679,8 @@ static noinline int lock_stripe_add(struct btrfs_raid_bio *rbio)
 	struct btrfs_raid_bio *cache_drop = NULL;
 	int ret = 0;
 
+	h = rbio->fs_info->stripe_hash_table->table + rbio_bucket(rbio);
+
 	spin_lock_irqsave(&h->lock, flags);
 	list_for_each_entry(cur, &h->hash_list, hash_list) {
 		if (cur->bbio->raid_map[0] != rbio->bbio->raid_map[0])
-- 
2.16.4


  parent reply	other threads:[~2019-10-18  9:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  9:58 [PATCH 0/4] Small coding style cleanups Johannes Thumshirn
2019-10-18  9:58 ` [PATCH 1/4] btrfs: reduce indentation in lock_stripe_add Johannes Thumshirn
2019-10-21 12:45   ` Nikolay Borisov
2019-10-21 13:30   ` David Sterba
2019-10-18  9:58 ` Johannes Thumshirn [this message]
2019-10-18  9:58 ` [PATCH 3/4] btrfs: reduce indentation in btrfs_may_alloc_data_chunk Johannes Thumshirn
2019-10-18  9:58 ` [PATCH 4/4] btrfs: remove pointless indentation in btrfs_read_sys_array() Johannes Thumshirn
2019-10-18 12:02 ` [PATCH 0/4] Small coding style cleanups Nikolay Borisov
2019-10-21  8:06   ` Johannes Thumshirn
2019-10-21 12:32     ` Nikolay Borisov
2019-10-21 12:42       ` Johannes Thumshirn
2019-10-21 13:38 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018095823.15282-3-jthumshirn@suse.de \
    --to=jthumshirn@suse.de \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox