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


Groups > linux.kernel > #1396045

[PATCH 07/28] lightnvm: calculate rrpc total blocks and sectors up front

From Matias Bjørling <m@bjorling.me>
Newsgroups linux.kernel
Subject [PATCH 07/28] lightnvm: calculate rrpc total blocks and sectors up front
Date 2016-05-06 20:20 +0200
Message-ID <rvSw2-1EJ-11@gated-at.bofh.it> (permalink)
References <rvSml-1A4-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Wenwei Tao <ww.tao0320@gmail.com>

Calculate rrpc total blocks and sectors up front, make sense
to use them. For example, we use rrpc->nr_sects to calculate rrpc
area size, but it makes no sense if we don't initialize it up front,
since it would be zero until we finish rrpc luns init.

Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/lightnvm/rrpc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index 3ab6495..c0e303c 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -1207,10 +1207,6 @@ static int rrpc_luns_init(struct rrpc *rrpc, int lun_begin, int lun_end)
 
 		INIT_WORK(&rlun->ws_gc, rrpc_lun_gc);
 		spin_lock_init(&rlun->lock);
-
-		rrpc->total_blocks += dev->blks_per_lun;
-		rrpc->nr_sects += dev->sec_per_lun;
-
 	}
 
 	return 0;
@@ -1388,6 +1384,8 @@ static void *rrpc_init(struct nvm_dev *dev, struct gendisk *tdisk,
 	INIT_WORK(&rrpc->ws_requeue, rrpc_requeue);
 
 	rrpc->nr_luns = lun_end - lun_begin + 1;
+	rrpc->total_blocks = (unsigned long)dev->blks_per_lun * rrpc->nr_luns;
+	rrpc->nr_sects = (unsigned long long)dev->sec_per_lun * rrpc->nr_luns;
 
 	/* simple round-robin strategy */
 	atomic_set(&rrpc->next_lun, -1);
-- 
2.1.4

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


Thread

[PATCH 00/28] LightNVM fixes for 4.7 Matias Bjørling <m@bjorling.me> - 2016-05-06 20:10 +0200
  [PATCH 04/28] lightnvm: add fpg_size and pfpg_size to struct nvm_dev Matias Bjørling <m@bjorling.me> - 2016-05-06 20:10 +0200
  [PATCH 11/28] lightnvm: introduce nvm_for_each_lun_ppa() macro Matias Bjørling <m@bjorling.me> - 2016-05-06 20:10 +0200
  [PATCH 05/28] lightnvm: move block fold outside of get_bb_tbl() Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 10/28] lightnvm: refactor dev->online_target to global nvm_targets Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 13/28] lightnvm: remove struct factory_blks Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 07/28] lightnvm: calculate rrpc total blocks and sectors up front Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 09/28] lightnvm: rename nvm_targets to nvm_tgt_type Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 06/28] lightnvm: avoid memory leak when lun_map kcalloc fails Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 02/28] lightnvm: handle submit_io failure Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 12/28] lightnvm: refactor device ops->get_bb_tbl() Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 03/28] lightnvm: implement nvm_submit_ppa_list Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 14/28] lightnvm: make nvm_set_rqd_ppalist() aware of vblks Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  [PATCH 01/28] lightnvm: fix "warning: ‘ret’ may be used uninitialized" Matias Bjørling <m@bjorling.me> - 2016-05-06 20:20 +0200
  Re: [PATCH 00/28] LightNVM fixes for 4.7 Jens Axboe <axboe@fb.com> - 2016-05-10 16:50 +0200

csiph-web