Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1283788

[PATCH] lightnvm: place unlock sentence in the common path

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Wenwei Tao <ww.tao0320@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] lightnvm: place unlock sentence in the common path
Date Fri, 04 Dec 2015 13:50:02 +0100
Message-ID <qBXYe-2HT-11@gated-at.bofh.it> (permalink)
X-Original-To mb@lightnvm.io
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=EsPR0iiNwqawkVCc080u5jej4vFfT/s0OYUn/QL2kmY=; b=rBnBorORYtPLQT2FdutBihvAh1pY2YUFvEekbZ3QMTc7PjPn0MJYiBsauhoiIFGLj6 5Io4iGF6QcIm8WIWmeiy9JIvWIYEEsplZPkmlnlqqDMG/UoohbjbS5/1Sroy602WAT0n LZODpd3rWs6mOKvUCrLdSNvaLG3FyW0h/l/9eMBS2h2aC6/L/Xrzk1LNDHumHr6cm8f2 8v4Ot9xQaxH51I+5AavkIKmYWta9XY9Ri8I0ZU+s5KCmkdx25byKkXsRolhgisxfjWcX L8i+3Wa5hXA3vYZrwdapsGw1iPuC5ifSJdvGlPsjTlf67sQtnQXdyID0aObkL4DRv5JR wJ3w==
X-Received by 10.98.75.83 with SMTP id y80mr20726853pfa.77.1449232694356; Fri, 04 Dec 2015 04:38:14 -0800 (PST)
X-Mailer git-send-email 2.5.1.windows.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 46
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
X-Original-Date Fri, 4 Dec 2015 20:37:52 +0800
X-Original-Message-ID <1449232672-3464-1-git-send-email-ww.tao0320@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1283788

Show key headers only | View raw


move spin_unlock(&vlun->lock) to common path to make
the code more clean.

Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
---
 drivers/lightnvm/gennvm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c
index 35dde84..ce60254 100644
--- a/drivers/lightnvm/gennvm.c
+++ b/drivers/lightnvm/gennvm.c
@@ -262,14 +262,11 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,
 	if (list_empty(&lun->free_list)) {
 		pr_err_ratelimited("gennvm: lun %u have no free pages available",
 								lun->vlun.id);
-		spin_unlock(&vlun->lock);
 		goto out;
 	}
 
-	while (!is_gc && lun->vlun.nr_free_blocks < lun->reserved_blocks) {
-		spin_unlock(&vlun->lock);
+	if (!is_gc && lun->vlun.nr_free_blocks < lun->reserved_blocks)
 		goto out;
-	}
 
 	blk = list_first_entry(&lun->free_list, struct nvm_block, list);
 	list_move_tail(&blk->list, &lun->used_list);
@@ -278,8 +275,8 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,
 	lun->vlun.nr_free_blocks--;
 	lun->vlun.nr_inuse_blocks++;
 
-	spin_unlock(&vlun->lock);
 out:
+	spin_unlock(&vlun->lock);
 	return blk;
 }
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] lightnvm: place unlock sentence in the common path Wenwei Tao <ww.tao0320@gmail.com> - 2015-12-04 13:50 +0100
  Re: [PATCH] lightnvm: place unlock sentence in the common path Matias Bjørling <mb@lightnvm.io> - 2015-12-04 14:00 +0100

csiph-web