From: "Matias Bjørling" <m@bjorling.me>
To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com
Cc: "Matias Bjørling" <m@bjorling.me>
Subject: [PATCH 2/3] null_blk: use device addressing mode
Date: Thu, 19 Nov 2015 12:50:09 +0100 [thread overview]
Message-ID: <1447933810-10267-3-git-send-email-m@bjorling.me> (raw)
In-Reply-To: <1447933810-10267-1-git-send-email-m@bjorling.me>
The linear addressing mode was removed in 7386af2. Make null_blk instead
expose the ppa format geometry and support the generic addressing mode.
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
drivers/block/null_blk.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 173ba24..6184b82 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -486,6 +486,7 @@ static int null_lnvm_submit_io(struct request_queue *q, struct nvm_rq *rqd)
static int null_lnvm_id(struct request_queue *q, struct nvm_id *id)
{
sector_t size = gb * 1024 * 1024 * 1024ULL;
+ sector_t blksize;
struct nvm_id_group *grp;
id->ver_id = 0x1;
@@ -493,17 +494,34 @@ static int null_lnvm_id(struct request_queue *q, struct nvm_id *id)
id->cgrps = 1;
id->cap = 0x3;
id->dom = 0x1;
- id->ppat = NVM_ADDRMODE_LINEAR;
+
+ id->ppaf.blk_offset = 0;
+ id->ppaf.blk_len = 16;
+ id->ppaf.pg_offset = 16;
+ id->ppaf.pg_len = 16;
+ id->ppaf.sect_offset = 32;
+ id->ppaf.sect_len = 8;
+ id->ppaf.pln_offset = 40;
+ id->ppaf.pln_len = 8;
+ id->ppaf.lun_offset = 48;
+ id->ppaf.lun_len = 8;
+ id->ppaf.ch_offset = 56;
+ id->ppaf.ch_len = 8;
do_div(size, bs); /* convert size to pages */
+ do_div(size, 256); /* concert size to pgs pr blk */
grp = &id->groups[0];
grp->mtype = 0;
- grp->fmtype = 1;
+ grp->fmtype = 0;
grp->num_ch = 1;
- grp->num_lun = 1;
- grp->num_pln = 1;
- grp->num_blk = size / 256;
grp->num_pg = 256;
+ blksize = size;
+ do_div(size, (1 << 16));
+ grp->num_lun = size + 1;
+ do_div(blksize, grp->num_lun);
+ grp->num_blk = blksize;
+ grp->num_pln = 1;
+
grp->fpg_sz = bs;
grp->csecs = bs;
grp->trdt = 25000;
--
2.1.4
next prev parent reply other threads:[~2015-11-19 11:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-19 11:50 [PATCH 0/3] null_blk patches for 4.4-rc2 Matias Bjørling
2015-11-19 11:50 ` [PATCH 1/3] null_blk: use ppa_cache pool Matias Bjørling
2015-11-19 11:50 ` Matias Bjørling [this message]
2015-11-19 11:50 ` [PATCH 3/3] null_blk: do not del gendisk with lightnvm Matias Bjørling
2015-11-19 20:06 ` [PATCH 0/3] null_blk patches for 4.4-rc2 Jens Axboe
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=1447933810-10267-3-git-send-email-m@bjorling.me \
--to=m@bjorling.me \
--cc=axboe@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®