[GIT PULL] Block fixes for 4.18-rc4

2018-07-06 Thread Jens Axboe
Hi Linus,

Two minor fixes for this series:

- Add LOOP_SET_BLOCK_SIZE as compat ioctl (Evan Green)

- drbd use-after-free fix (Lars Ellenberg)

Please pull!


  git://git.kernel.dk/linux-block.git tags/for-linus-20180706



Evan Green (1):
  loop: Add LOOP_SET_BLOCK_SIZE in compat ioctl

Lars Ellenberg (1):
  drbd: fix access after free

 drivers/block/drbd/drbd_worker.c | 2 +-
 drivers/block/loop.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
Jens Axboe



Re: [PATCH blktests v2 3/3] Add tests for the SRP initiator and target drivers

2018-07-06 Thread Omar Sandoval
This might also be useful:

# /sbin/multipathd -d -s -v 3
start up
read /etc/multipath.conf
loading /lib64/multipath/libchecktur.so checker
loading /lib64/multipath/libprioconst.so prioritizer
foreign library "nvme" loaded successfully
set open fds limit to 1048576/1048576
path checkers start up
uxsock: startup listener
No configuration dir '/etc/multipath/conf.d'
sdb: udev property DEVLINKS whitelisted
sdb: mask = 0x1f
sdb: dev_t = 8:16
sdb: size = 65536
sdb: vendor = LIO-ORG
sdb: product = IBLOCK
sdb: rev = 4.0
sdb: h:b:t:l = 1:0:0:0
sdb: tgt_node_name =
sdb: path state = running
sdb: 1024 cyl, 2 heads, 32 sectors/track, start at 0
sdb: serial = 72616d6469736b310
sdb: get_state
sdb: detect_checker = yes (setting: multipath internal)
failed to issue vpd inquiry for pgc9
sdb: path_checker = tur (setting: storage device autodetected)
sdb: checker timeout = 30 s (setting: kernel sysfs)
sdb: tur state = up
sdb: uid_attribute = ID_SERIAL (setting: multipath internal)
sdb: uid = 3600140572616d6469736b310 (udev)
sdb: detect_prio = yes (setting: multipath internal)
failed to issue vpd inquiry for pgc9
loading /lib64/multipath/libpriosysfs.so prioritizer
sdb: prio = sysfs (setting: storage device autodetected)
sdb: prio args = "" (setting: storage device autodetected)
sdb: sysfs prio = 50
sdd: udev property DEVLINKS whitelisted
sdd: mask = 0x1f
sdd: dev_t = 8:48
sdd: size = 65536
sdd: vendor = LIO-ORG
sdd: product = IBLOCK
sdd: rev = 4.0
sdd: h:b:t:l = 1:0:0:1
sdd: tgt_node_name =
sdd: path state = running
sdd: 1024 cyl, 2 heads, 32 sectors/track, start at 0
sdd: serial = 72616d6469736b320
sdd: get_state
sdd: detect_checker = yes (setting: multipath internal)
failed to issue vpd inquiry for pgc9
sdd: path_checker = tur (setting: storage device autodetected)
sdd: checker timeout = 30 s (setting: kernel sysfs)
sdd: tur state = up
sdd: uid_attribute = ID_SERIAL (setting: multipath internal)
sdd: uid = 3600140572616d6469736b320 (udev)
sdd: detect_prio = yes (setting: multipath internal)
failed to issue vpd inquiry for pgc9
sdd: prio = sysfs (setting: storage device autodetected)
sdd: prio args = "" (setting: storage device autodetected)
sdd: sysfs prio = 50
sdc: udev property DEVLINKS whitelisted
sdc: mask = 0x1f
sdc: dev_t = 8:32
sdc: size = 65536
sdc: vendor = LIO-ORG
sdc: product = IBLOCK
sdc: rev = 4.0
sdc: h:b:t:l = 1:0:0:2
sdc: tgt_node_name =
sdc: path state = running
sdc: 1024 cyl, 2 heads, 32 sectors/track, start at 0
sdc: serial = 73637369646267000
sdc: get_state
sdc: detect_checker = yes (setting: multipath internal)
failed to issue vpd inquiry for pgc9
sdc: path_checker = tur (setting: storage device autodetected)
sdc: checker timeout = 30 s (setting: kernel sysfs)
sdc: tur state = up
sdc: uid_attribute = ID_SERIAL (setting: multipath internal)
sdc: uid = 3600140573637369646267000 (udev)
sdc: detect_prio = yes (setting: multipath internal)
failed to issue vpd inquiry for pgc9
sdc: prio = sysfs (setting: storage device autodetected)
sdc: prio args = "" (setting: storage device autodetected)
sdc: sysfs prio = 50
nvme0n1: udev property DEVLINKS whitelisted
nvme0n1: device node name whitelisted
nvme0n1: mask = 0x1f
nvme0n1: dev_t = 259:0
nvme0n1: size = 16777216
nvme0n1: vendor = NVME
nvme0n1: product = QEMU NVMe Ctrl
nvme0n1: serial = 1337
nvme0n1: rev = 1.0
nvme0n1: path state = live
nvme0n1: 8192 cyl, 64 heads, 32 sectors/track, start at 0
nvme0n1: get_state
nvme0n1: detect_checker = yes (setting: multipath internal)
nvme0n1: path_checker = none (setting: storage device configuration)
nvme0n1: checker timeout = 30 s (setting: multipath internal)
nvme0n1: none state = up
nvme0n1: uid_attribute = ID_WWN (setting: storage device configuration)
nvme0n1: uid = nvme.8086-3137-51454d55204e564d65204374726c-0001
(udev)
nvme0n1: detect_prio = yes (setting: multipath internal)
nvme0n1: prio = const (setting: multipath internal)
nvme0n1: prio args = "" (setting: multipath internal)
nvme0n1: const prio = 1
vda: udev property DEVLINKS whitelisted
vda: device node name blacklisted
vdb: udev property DEVLINKS whitelisted
vdb: device node name blacklisted
vdc: udev property DEVLINKS whitelisted
vdc: device node name blacklisted
vdd: udev property DEVLINKS whitelisted
vdd: device node name blacklisted
sda: udev property DEVLINKS whitelisted
sda: mask = 0x1f
sda: dev_t = 8:0
sda: size = 65536
sda: vendor = Linux
sda: product = scsi_debug
sda: rev = 0188
sda: h:b:t:l = 0:0:0:0
sda: tgt_node_name =
sda: path state = running
sda: 1024 cyl, 2 heads, 32 sectors/track, start at 0
sda: serial = 2000
sda: get_state
sda: detect_checker = yes (setting: multipath internal)
failed to issue vpd inquiry for pgc9
sda: path_checker = tur (setting: multipath internal)
sda: checker timeout = 30 s (setting: kernel sysfs)
sda: tur state = up
sda: uid_attribute = ID_SERIAL (setting: multipath internal)
sda: uid = 007d0 (udev)
sda: detect_prio = yes (setting: 

Re: [PATCH blktests v2 3/3] Add tests for the SRP initiator and target drivers

2018-07-06 Thread Omar Sandoval
On Fri, Jul 06, 2018 at 11:07:06PM +, Bart Van Assche wrote:
> On Fri, 2018-07-06 at 16:03 -0700, Omar Sandoval wrote:
> > Alright, I'm not getting the udev events at all (even after enabling
> > CONFIG_DM_UEVENT in addition to everything mentioned in the README). I
> > have no idea where to go from here.
> > 
> > After, e.g., srp/002 fails, this is the state of my system:
> > 
> > $ sudo multipath -l
> > $ ls /sys/class/block
> > nvme0n1  ram0  ram1  ram2  sda  sdb  sdc  sdd  vda  vda1  vdb  vdc  vdd
> > $ lsblk
> > NAMEMAJ:MIN RM SIZE RO TYPE MOUNTPOINT
> > sda   8:00  32M  0 disk
> > sdb   8:16   0  32M  0 disk
> > sdc   8:32   0  32M  0 disk
> > sdd   8:48   0  32M  0 disk
> > vda 254:00  16G  0 disk
> > └─vda1  254:10  16G  0 part /
> > vdb 254:16   0   8G  0 disk
> > vdc 254:32   0   8G  0 disk
> > vdd 254:48   0   8G  0 disk
> > nvme0n1 259:00   8G  0 disk
> > $ lsscsi
> > [0:0:0:0]diskLinuxscsi_debug   0188  /dev/sda
> > [1:0:0:0]diskLIO-ORG  IBLOCK   4.0   /dev/sdb
> > [1:0:0:1]diskLIO-ORG  IBLOCK   4.0   /dev/sdd
> > [1:0:0:2]diskLIO-ORG  IBLOCK   4.0   /dev/sdc
> 
> That's weird. If you want I can install Arch Linux myself and debug this
> further.

At this point, that might be easier.

> Something that would also help is if you could run the following
> commands as root and provide their output:
> 
> echo reconfigure | multipathd -k
> multipath -ll

# cat /etc/multipath.conf
defaults {
user_friendly_names yes
queue_without_daemonno
}
devices {
device {
vendor   "LIO-ORG|SCST_BIO|FUSIONIO"
product  ".*"
features "1 queue_if_no_path"
path_checker tur
}
}
blacklist {
device {
vendor  "ATA"
}
device {
vendor  "QEMU"
}
device {
vendor  "Linux"
product "scsi_debug"
}
devnode "^nullb.*"
}
blacklist_exceptions {
property".*"
devnode "^nvme"
}
# echo reconfigure | multipathd -k
multipathd> reconfigure
ok
multipathd>
# multipath -ll

So, no output.


Re: [PATCH blktests v2 3/3] Add tests for the SRP initiator and target drivers

2018-07-06 Thread Bart Van Assche
On Fri, 2018-07-06 at 16:03 -0700, Omar Sandoval wrote:
> Alright, I'm not getting the udev events at all (even after enabling
> CONFIG_DM_UEVENT in addition to everything mentioned in the README). I
> have no idea where to go from here.
> 
> After, e.g., srp/002 fails, this is the state of my system:
> 
> $ sudo multipath -l
> $ ls /sys/class/block
> nvme0n1  ram0  ram1  ram2  sda  sdb  sdc  sdd  vda  vda1  vdb  vdc  vdd
> $ lsblk
> NAMEMAJ:MIN RM SIZE RO TYPE MOUNTPOINT
> sda   8:00  32M  0 disk
> sdb   8:16   0  32M  0 disk
> sdc   8:32   0  32M  0 disk
> sdd   8:48   0  32M  0 disk
> vda 254:00  16G  0 disk
> └─vda1  254:10  16G  0 part /
> vdb 254:16   0   8G  0 disk
> vdc 254:32   0   8G  0 disk
> vdd 254:48   0   8G  0 disk
> nvme0n1 259:00   8G  0 disk
> $ lsscsi
> [0:0:0:0]diskLinuxscsi_debug   0188  /dev/sda
> [1:0:0:0]diskLIO-ORG  IBLOCK   4.0   /dev/sdb
> [1:0:0:1]diskLIO-ORG  IBLOCK   4.0   /dev/sdd
> [1:0:0:2]diskLIO-ORG  IBLOCK   4.0   /dev/sdc

That's weird. If you want I can install Arch Linux myself and debug this
further. Something that would also help is if you could run the following
commands as root and provide their output:

echo reconfigure | multipathd -k
multipath -ll

Thanks,

Bart.

Re: [PATCH blktests v2 3/3] Add tests for the SRP initiator and target drivers

2018-07-06 Thread Omar Sandoval
On Fri, Jul 06, 2018 at 02:21:44PM -0700, Omar Sandoval wrote:
> On Wed, Jul 04, 2018 at 04:24:42PM +, Bart Van Assche wrote:
> > On Tue, 2018-07-03 at 14:39 -0700, Omar Sandoval wrote:
> > > Alright, I installed multipath-tools from source and the segfaults are
> > > gone, but I still don't get these symlinks. Instead, they show up as
> > > 
> > > /dev/disk/by-id/scsi-3600140572616d6469736b320
> > > 
> > > Any ideas?
> > 
> > Hello Omar,
> > 
> > The dm-uuid symlink is created by a udev rule. Apparently that udev rule is 
> > not
> > in the same software package as multipathd. Can you run the following 
> > command to
> > check whether that udev rule is available on your setup?
> > 
> > grep -r dm-uuid /lib/udev/rules.d/
> 
> $ grep -r dm-uuid /lib/udev/rules.d/
> /lib/udev/rules.d/13-dm-disk.rules:ENV{DM_UUID}=="?*", 
> SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
> 
> 
> > The name of the package that includes the dm-uuid rule depends on the 
> > distro,
> > e.g. dmsetup or device-mapper. According to the git history of git 
> > repository
> > https://sourceware.org/git/?p=lvm2.git the dm-uuid udev rule was added to 
> > that
> > repository in August 2009, almost nine years ago.
> 
> Yup, it's in the device-mapper package for me on Arch Linux (and Arch
> has very up-to-date versions of everything). I'll try some udev
> debugging.

Alright, I'm not getting the udev events at all (even after enabling
CONFIG_DM_UEVENT in addition to everything mentioned in the README). I
have no idea where to go from here.

After, e.g., srp/002 fails, this is the state of my system:

$ sudo multipath -l
$ ls /sys/class/block
nvme0n1  ram0  ram1  ram2  sda  sdb  sdc  sdd  vda  vda1  vdb  vdc  vdd
$ lsblk
NAMEMAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda   8:00  32M  0 disk
sdb   8:16   0  32M  0 disk
sdc   8:32   0  32M  0 disk
sdd   8:48   0  32M  0 disk
vda 254:00  16G  0 disk
└─vda1  254:10  16G  0 part /
vdb 254:16   0   8G  0 disk
vdc 254:32   0   8G  0 disk
vdd 254:48   0   8G  0 disk
nvme0n1 259:00   8G  0 disk
$ lsscsi
[0:0:0:0]diskLinuxscsi_debug   0188  /dev/sda
[1:0:0:0]diskLIO-ORG  IBLOCK   4.0   /dev/sdb
[1:0:0:1]diskLIO-ORG  IBLOCK   4.0   /dev/sdd
[1:0:0:2]diskLIO-ORG  IBLOCK   4.0   /dev/sdc


Re: [PATCH blktests v2 3/3] Add tests for the SRP initiator and target drivers

2018-07-06 Thread Omar Sandoval
On Wed, Jul 04, 2018 at 04:24:42PM +, Bart Van Assche wrote:
> On Tue, 2018-07-03 at 14:39 -0700, Omar Sandoval wrote:
> > Alright, I installed multipath-tools from source and the segfaults are
> > gone, but I still don't get these symlinks. Instead, they show up as
> > 
> > /dev/disk/by-id/scsi-3600140572616d6469736b320
> > 
> > Any ideas?
> 
> Hello Omar,
> 
> The dm-uuid symlink is created by a udev rule. Apparently that udev rule is 
> not
> in the same software package as multipathd. Can you run the following command 
> to
> check whether that udev rule is available on your setup?
> 
> grep -r dm-uuid /lib/udev/rules.d/

$ grep -r dm-uuid /lib/udev/rules.d/
/lib/udev/rules.d/13-dm-disk.rules:ENV{DM_UUID}=="?*", 
SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"


> The name of the package that includes the dm-uuid rule depends on the distro,
> e.g. dmsetup or device-mapper. According to the git history of git repository
> https://sourceware.org/git/?p=lvm2.git the dm-uuid udev rule was added to that
> repository in August 2009, almost nine years ago.

Yup, it's in the device-mapper package for me on Arch Linux (and Arch
has very up-to-date versions of everything). I'll try some udev
debugging.


Re: [PATCH blktests v2] dir-locals.el: fix indenation with Emacs

2018-07-06 Thread Omar Sandoval
On Fri, Jul 06, 2018 at 10:21:28AM +0200, Johannes Thumshirn wrote:
> A recent update of Emacs broke .dir-locals.el's shell indentation
> setting.
> 
> Also set 'sh-indendation' not just 'sh-basic-offset' for this.

Another typo ;) fixed and applied, thanks.

> Signed-off-by: Johannes Thumshirn 
> Reviewed-by: Bart Van Assche 
> 
> ---
> Changes to v1:
> - Fix spelling and subject prefix
> - Add Bart's R-b
> ---
>  .dir-locals.el | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/.dir-locals.el b/.dir-locals.el
> index f64c48202910..46961929fac9 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -1,3 +1,4 @@
>  ((sh-mode . ((sh-basic-offset . 8)
> +  (sh-indentation . 8)
>(fill-column . 80)
>(indent-tabs-mode . t
> -- 
> 2.16.4
> 


Re: [PATCH v3] lightnvm: pblk: add asynchronous partial read

2018-07-06 Thread Igor Konopko




On 06.07.2018 05:18, Matias Bjørling wrote:

On 07/06/2018 12:12 PM, Heiner Litz wrote:

In the read path, partial reads are currently performed synchronously
which affects performance for workloads that generate many partial
reads. This patch adds an asynchronous partial read path as well as
the required partial read ctx.

Signed-off-by: Heiner Litz 

---

v3: rebase to head, incorporate 64-bit read bitmap

---
  drivers/lightnvm/pblk-read.c | 183 
---

  drivers/lightnvm/pblk.h  |  10 +++
  2 files changed, 130 insertions(+), 63 deletions(-)

diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 9c9362b..4a44076 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -231,74 +231,36 @@ static void pblk_end_io_read(struct nvm_rq *rqd)
  __pblk_end_io_read(pblk, rqd, true);
  }
-static int pblk_partial_read(struct pblk *pblk, struct nvm_rq *rqd,
- struct bio *orig_bio, unsigned int bio_init_idx,
- unsigned long *read_bitmap)
+static void pblk_end_partial_read(struct nvm_rq *rqd)
  {
-    struct pblk_sec_meta *meta_list = rqd->meta_list;
-    struct bio *new_bio;
+    struct pblk *pblk = rqd->private;
+    struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
+    struct pblk_pr_ctx *pr_ctx = r_ctx->private;
+    struct bio *new_bio = rqd->bio;
+    struct bio *bio = pr_ctx->orig_bio;
  struct bio_vec src_bv, dst_bv;
-    void *ppa_ptr = NULL;
-    void *src_p, *dst_p;
-    dma_addr_t dma_ppa_list = 0;
-    __le64 *lba_list_mem, *lba_list_media;
-    int nr_secs = rqd->nr_ppas;
+    struct pblk_sec_meta *meta_list = rqd->meta_list;
+    int bio_init_idx = pr_ctx->bio_init_idx;
+    unsigned long *read_bitmap = _ctx->bitmap;
+    int nr_secs = pr_ctx->orig_nr_secs;
  int nr_holes = nr_secs - bitmap_weight(read_bitmap, nr_secs);
-    int i, ret, hole;
-
-    /* Re-use allocated memory for intermediate lbas */
-    lba_list_mem = (((void *)rqd->ppa_list) + pblk_dma_ppa_size);
-    lba_list_media = (((void *)rqd->ppa_list) + 2 * pblk_dma_ppa_size);
-
-    new_bio = bio_alloc(GFP_KERNEL, nr_holes);
-
-    if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes))
-    goto fail_add_pages;
-
-    if (nr_holes != new_bio->bi_vcnt) {
-    pblk_err(pblk, "malformed bio\n");
-    goto fail;
-    }
-
-    for (i = 0; i < nr_secs; i++)
-    lba_list_mem[i] = meta_list[i].lba;
-
-    new_bio->bi_iter.bi_sector = 0; /* internal bio */
-    bio_set_op_attrs(new_bio, REQ_OP_READ, 0);
-
-    rqd->bio = new_bio;
-    rqd->nr_ppas = nr_holes;
-    rqd->flags = pblk_set_read_mode(pblk, PBLK_READ_RANDOM);
-
-    if (unlikely(nr_holes == 1)) {
-    ppa_ptr = rqd->ppa_list;
-    dma_ppa_list = rqd->dma_ppa_list;
-    rqd->ppa_addr = rqd->ppa_list[0];
-    }
-
-    ret = pblk_submit_io_sync(pblk, rqd);
-    if (ret) {
-    bio_put(rqd->bio);
-    pblk_err(pblk, "sync read IO submission failed\n");
-    goto fail;
-    }
-
-    if (rqd->error) {
-    atomic_long_inc(>read_failed);
-#ifdef CONFIG_NVM_PBLK_DEBUG
-    pblk_print_failed_rqd(pblk, rqd, rqd->error);
-#endif
-    }
+    __le64 *lba_list_mem, *lba_list_media;
+    void *src_p, *dst_p;
+    int hole, i;
  if (unlikely(nr_holes == 1)) {
  struct ppa_addr ppa;
  ppa = rqd->ppa_addr;
-    rqd->ppa_list = ppa_ptr;
-    rqd->dma_ppa_list = dma_ppa_list;
+    rqd->ppa_list = pr_ctx->ppa_ptr;
+    rqd->dma_ppa_list = pr_ctx->dma_ppa_list;
  rqd->ppa_list[0] = ppa;
  }
+    /* Re-use allocated memory for intermediate lbas */
+    lba_list_mem = (((void *)rqd->ppa_list) + pblk_dma_ppa_size);
+    lba_list_media = (((void *)rqd->ppa_list) + 2 * pblk_dma_ppa_size);
+
  for (i = 0; i < nr_secs; i++) {
  lba_list_media[i] = meta_list[i].lba;
  meta_list[i].lba = lba_list_mem[i];
@@ -316,7 +278,7 @@ static int pblk_partial_read(struct pblk *pblk, 
struct nvm_rq *rqd,

  meta_list[hole].lba = lba_list_media[i];
  src_bv = new_bio->bi_io_vec[i++];
-    dst_bv = orig_bio->bi_io_vec[bio_init_idx + hole];
+    dst_bv = bio->bi_io_vec[bio_init_idx + hole];
  src_p = kmap_atomic(src_bv.bv_page);
  dst_p = kmap_atomic(dst_bv.bv_page);
@@ -334,19 +296,107 @@ static int pblk_partial_read(struct pblk *pblk, 
struct nvm_rq *rqd,

  } while (hole < nr_secs);
  bio_put(new_bio);
+    kfree(pr_ctx);
  /* restore original request */
  rqd->bio = NULL;
  rqd->nr_ppas = nr_secs;
+    bio_endio(bio);
  __pblk_end_io_read(pblk, rqd, false);
-    return NVM_IO_DONE;
+}
-fail:
-    /* Free allocated pages in new bio */
+static int pblk_setup_partial_read(struct pblk *pblk, struct nvm_rq 
*rqd,

+    unsigned int bio_init_idx,
+    unsigned long *read_bitmap,
+    int nr_holes)
+{
+    struct pblk_sec_meta *meta_list = rqd->meta_list;
+    struct pblk_g_ctx *r_ctx 

Re: [PATCH] null_blk: remove NULLB_DEV_FL_CONFIGURED on turning off nullb device

2018-07-06 Thread Jens Axboe
On 7/5/18 1:07 PM, Liu Bo wrote:
> Currently mbps knob could only be set once before switching power knob to
> on, after power knob has been set at least once, there is no way to set
> mbps knob again due to -EBUSY.
> 
> As nullb is mainly used for testing, in order to make it flexible, this
> removes the flag NULLB_DEV_FL_CONFIGURED so that mbps knob can be reset
> when power knob is off, e.g.
> 
> echo 0 > /config/nullb/a/power
> echo 40 > /config/nullb/a/mbps
> echo 1 > /config/nullb/a/power
> 
> So does other knobs under /config/nullb/a.

Applied for 4.19, thanks.

-- 
Jens Axboe



Re: [PATCH v3] lightnvm: pblk: add asynchronous partial read

2018-07-06 Thread Matias Bjørling

On 07/06/2018 12:12 PM, Heiner Litz wrote:

In the read path, partial reads are currently performed synchronously
which affects performance for workloads that generate many partial
reads. This patch adds an asynchronous partial read path as well as
the required partial read ctx.

Signed-off-by: Heiner Litz 

---

v3: rebase to head, incorporate 64-bit read bitmap

---
  drivers/lightnvm/pblk-read.c | 183 ---
  drivers/lightnvm/pblk.h  |  10 +++
  2 files changed, 130 insertions(+), 63 deletions(-)

diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 9c9362b..4a44076 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -231,74 +231,36 @@ static void pblk_end_io_read(struct nvm_rq *rqd)
__pblk_end_io_read(pblk, rqd, true);
  }
  
-static int pblk_partial_read(struct pblk *pblk, struct nvm_rq *rqd,

-struct bio *orig_bio, unsigned int bio_init_idx,
-unsigned long *read_bitmap)
+static void pblk_end_partial_read(struct nvm_rq *rqd)
  {
-   struct pblk_sec_meta *meta_list = rqd->meta_list;
-   struct bio *new_bio;
+   struct pblk *pblk = rqd->private;
+   struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
+   struct pblk_pr_ctx *pr_ctx = r_ctx->private;
+   struct bio *new_bio = rqd->bio;
+   struct bio *bio = pr_ctx->orig_bio;
struct bio_vec src_bv, dst_bv;
-   void *ppa_ptr = NULL;
-   void *src_p, *dst_p;
-   dma_addr_t dma_ppa_list = 0;
-   __le64 *lba_list_mem, *lba_list_media;
-   int nr_secs = rqd->nr_ppas;
+   struct pblk_sec_meta *meta_list = rqd->meta_list;
+   int bio_init_idx = pr_ctx->bio_init_idx;
+   unsigned long *read_bitmap = _ctx->bitmap;
+   int nr_secs = pr_ctx->orig_nr_secs;
int nr_holes = nr_secs - bitmap_weight(read_bitmap, nr_secs);
-   int i, ret, hole;
-
-   /* Re-use allocated memory for intermediate lbas */
-   lba_list_mem = (((void *)rqd->ppa_list) + pblk_dma_ppa_size);
-   lba_list_media = (((void *)rqd->ppa_list) + 2 * pblk_dma_ppa_size);
-
-   new_bio = bio_alloc(GFP_KERNEL, nr_holes);
-
-   if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes))
-   goto fail_add_pages;
-
-   if (nr_holes != new_bio->bi_vcnt) {
-   pblk_err(pblk, "malformed bio\n");
-   goto fail;
-   }
-
-   for (i = 0; i < nr_secs; i++)
-   lba_list_mem[i] = meta_list[i].lba;
-
-   new_bio->bi_iter.bi_sector = 0; /* internal bio */
-   bio_set_op_attrs(new_bio, REQ_OP_READ, 0);
-
-   rqd->bio = new_bio;
-   rqd->nr_ppas = nr_holes;
-   rqd->flags = pblk_set_read_mode(pblk, PBLK_READ_RANDOM);
-
-   if (unlikely(nr_holes == 1)) {
-   ppa_ptr = rqd->ppa_list;
-   dma_ppa_list = rqd->dma_ppa_list;
-   rqd->ppa_addr = rqd->ppa_list[0];
-   }
-
-   ret = pblk_submit_io_sync(pblk, rqd);
-   if (ret) {
-   bio_put(rqd->bio);
-   pblk_err(pblk, "sync read IO submission failed\n");
-   goto fail;
-   }
-
-   if (rqd->error) {
-   atomic_long_inc(>read_failed);
-#ifdef CONFIG_NVM_PBLK_DEBUG
-   pblk_print_failed_rqd(pblk, rqd, rqd->error);
-#endif
-   }
+   __le64 *lba_list_mem, *lba_list_media;
+   void *src_p, *dst_p;
+   int hole, i;
  
  	if (unlikely(nr_holes == 1)) {

struct ppa_addr ppa;
  
  		ppa = rqd->ppa_addr;

-   rqd->ppa_list = ppa_ptr;
-   rqd->dma_ppa_list = dma_ppa_list;
+   rqd->ppa_list = pr_ctx->ppa_ptr;
+   rqd->dma_ppa_list = pr_ctx->dma_ppa_list;
rqd->ppa_list[0] = ppa;
}
  
+	/* Re-use allocated memory for intermediate lbas */

+   lba_list_mem = (((void *)rqd->ppa_list) + pblk_dma_ppa_size);
+   lba_list_media = (((void *)rqd->ppa_list) + 2 * pblk_dma_ppa_size);
+
for (i = 0; i < nr_secs; i++) {
lba_list_media[i] = meta_list[i].lba;
meta_list[i].lba = lba_list_mem[i];
@@ -316,7 +278,7 @@ static int pblk_partial_read(struct pblk *pblk, struct 
nvm_rq *rqd,
meta_list[hole].lba = lba_list_media[i];
  
  		src_bv = new_bio->bi_io_vec[i++];

-   dst_bv = orig_bio->bi_io_vec[bio_init_idx + hole];
+   dst_bv = bio->bi_io_vec[bio_init_idx + hole];
  
  		src_p = kmap_atomic(src_bv.bv_page);

dst_p = kmap_atomic(dst_bv.bv_page);
@@ -334,19 +296,107 @@ static int pblk_partial_read(struct pblk *pblk, struct 
nvm_rq *rqd,
} while (hole < nr_secs);
  
  	bio_put(new_bio);

+   kfree(pr_ctx);
  
  	/* restore original request */

rqd->bio = NULL;
rqd->nr_ppas = nr_secs;
  
+	bio_endio(bio);

__pblk_end_io_read(pblk, rqd, false);
-   return NVM_IO_DONE;
+}
  
-fail:

-   /* Free allocated pages in new 

[PATCH v3] lightnvm: pblk: add asynchronous partial read

2018-07-06 Thread Heiner Litz
In the read path, partial reads are currently performed synchronously
which affects performance for workloads that generate many partial
reads. This patch adds an asynchronous partial read path as well as
the required partial read ctx.

Signed-off-by: Heiner Litz 

---

v3: rebase to head, incorporate 64-bit read bitmap

---
 drivers/lightnvm/pblk-read.c | 183 ---
 drivers/lightnvm/pblk.h  |  10 +++
 2 files changed, 130 insertions(+), 63 deletions(-)

diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 9c9362b..4a44076 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -231,74 +231,36 @@ static void pblk_end_io_read(struct nvm_rq *rqd)
__pblk_end_io_read(pblk, rqd, true);
 }
 
-static int pblk_partial_read(struct pblk *pblk, struct nvm_rq *rqd,
-struct bio *orig_bio, unsigned int bio_init_idx,
-unsigned long *read_bitmap)
+static void pblk_end_partial_read(struct nvm_rq *rqd)
 {
-   struct pblk_sec_meta *meta_list = rqd->meta_list;
-   struct bio *new_bio;
+   struct pblk *pblk = rqd->private;
+   struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
+   struct pblk_pr_ctx *pr_ctx = r_ctx->private;
+   struct bio *new_bio = rqd->bio;
+   struct bio *bio = pr_ctx->orig_bio;
struct bio_vec src_bv, dst_bv;
-   void *ppa_ptr = NULL;
-   void *src_p, *dst_p;
-   dma_addr_t dma_ppa_list = 0;
-   __le64 *lba_list_mem, *lba_list_media;
-   int nr_secs = rqd->nr_ppas;
+   struct pblk_sec_meta *meta_list = rqd->meta_list;
+   int bio_init_idx = pr_ctx->bio_init_idx;
+   unsigned long *read_bitmap = _ctx->bitmap;
+   int nr_secs = pr_ctx->orig_nr_secs;
int nr_holes = nr_secs - bitmap_weight(read_bitmap, nr_secs);
-   int i, ret, hole;
-
-   /* Re-use allocated memory for intermediate lbas */
-   lba_list_mem = (((void *)rqd->ppa_list) + pblk_dma_ppa_size);
-   lba_list_media = (((void *)rqd->ppa_list) + 2 * pblk_dma_ppa_size);
-
-   new_bio = bio_alloc(GFP_KERNEL, nr_holes);
-
-   if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes))
-   goto fail_add_pages;
-
-   if (nr_holes != new_bio->bi_vcnt) {
-   pblk_err(pblk, "malformed bio\n");
-   goto fail;
-   }
-
-   for (i = 0; i < nr_secs; i++)
-   lba_list_mem[i] = meta_list[i].lba;
-
-   new_bio->bi_iter.bi_sector = 0; /* internal bio */
-   bio_set_op_attrs(new_bio, REQ_OP_READ, 0);
-
-   rqd->bio = new_bio;
-   rqd->nr_ppas = nr_holes;
-   rqd->flags = pblk_set_read_mode(pblk, PBLK_READ_RANDOM);
-
-   if (unlikely(nr_holes == 1)) {
-   ppa_ptr = rqd->ppa_list;
-   dma_ppa_list = rqd->dma_ppa_list;
-   rqd->ppa_addr = rqd->ppa_list[0];
-   }
-
-   ret = pblk_submit_io_sync(pblk, rqd);
-   if (ret) {
-   bio_put(rqd->bio);
-   pblk_err(pblk, "sync read IO submission failed\n");
-   goto fail;
-   }
-
-   if (rqd->error) {
-   atomic_long_inc(>read_failed);
-#ifdef CONFIG_NVM_PBLK_DEBUG
-   pblk_print_failed_rqd(pblk, rqd, rqd->error);
-#endif
-   }
+   __le64 *lba_list_mem, *lba_list_media;
+   void *src_p, *dst_p;
+   int hole, i;
 
if (unlikely(nr_holes == 1)) {
struct ppa_addr ppa;
 
ppa = rqd->ppa_addr;
-   rqd->ppa_list = ppa_ptr;
-   rqd->dma_ppa_list = dma_ppa_list;
+   rqd->ppa_list = pr_ctx->ppa_ptr;
+   rqd->dma_ppa_list = pr_ctx->dma_ppa_list;
rqd->ppa_list[0] = ppa;
}
 
+   /* Re-use allocated memory for intermediate lbas */
+   lba_list_mem = (((void *)rqd->ppa_list) + pblk_dma_ppa_size);
+   lba_list_media = (((void *)rqd->ppa_list) + 2 * pblk_dma_ppa_size);
+
for (i = 0; i < nr_secs; i++) {
lba_list_media[i] = meta_list[i].lba;
meta_list[i].lba = lba_list_mem[i];
@@ -316,7 +278,7 @@ static int pblk_partial_read(struct pblk *pblk, struct 
nvm_rq *rqd,
meta_list[hole].lba = lba_list_media[i];
 
src_bv = new_bio->bi_io_vec[i++];
-   dst_bv = orig_bio->bi_io_vec[bio_init_idx + hole];
+   dst_bv = bio->bi_io_vec[bio_init_idx + hole];
 
src_p = kmap_atomic(src_bv.bv_page);
dst_p = kmap_atomic(dst_bv.bv_page);
@@ -334,19 +296,107 @@ static int pblk_partial_read(struct pblk *pblk, struct 
nvm_rq *rqd,
} while (hole < nr_secs);
 
bio_put(new_bio);
+   kfree(pr_ctx);
 
/* restore original request */
rqd->bio = NULL;
rqd->nr_ppas = nr_secs;
 
+   bio_endio(bio);
__pblk_end_io_read(pblk, rqd, false);
-   return NVM_IO_DONE;
+}
 
-fail:
-   /* Free allocated pages in new bio */

Re: [PATCH blktests] dir-locals: fix indenation with Emacs

2018-07-06 Thread Johannes Thumshirn
On Thu, Jul 05, 2018 at 11:13:48AM -0700, Bart Van Assche wrote:
> On 07/04/18 04:59, Johannes Thumshirn wrote:
> > A recent update of Emacs broke .dir-locals.el's shell indendation
> > setting.
> 
> Please fix the spelling of "indentation" in the subject and in the above
> sentence. Additionally, the previous patch for this file had
> "dir-locals.el:" as subject-prefix. Should this patch have the same subject
> prefix?

Yup, done.

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850


[PATCH blktests v2] dir-locals.el: fix indenation with Emacs

2018-07-06 Thread Johannes Thumshirn
A recent update of Emacs broke .dir-locals.el's shell indentation
setting.

Also set 'sh-indendation' not just 'sh-basic-offset' for this.

Signed-off-by: Johannes Thumshirn 
Reviewed-by: Bart Van Assche 

---
Changes to v1:
- Fix spelling and subject prefix
- Add Bart's R-b
---
 .dir-locals.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.dir-locals.el b/.dir-locals.el
index f64c48202910..46961929fac9 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,3 +1,4 @@
 ((sh-mode . ((sh-basic-offset . 8)
+(sh-indentation . 8)
 (fill-column . 80)
 (indent-tabs-mode . t
-- 
2.16.4