Re: [PATCH] block: copy ioprio in __bio_clone_fast()

2018-08-01 Thread Johannes Thumshirn
Good catch,
Reviewed-by: Johannes Thumshirn 
-- 
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] block: copy ioprio in __bio_clone_fast()

2018-08-01 Thread Hannes Reinecke
We need to copy the io priority, too; otherwise the clone will run
with a different priority than the original one.

Fixes: 43b62ce3ff0a ("block: move bio io prio to a new field")
Signed-off-by: Hannes Reinecke 
---
 block/bio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/bio.c b/block/bio.c
index 8ecc95615941..88129f20623d 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -608,6 +608,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
bio->bi_write_hint = bio_src->bi_write_hint;
bio->bi_iter = bio_src->bi_iter;
bio->bi_io_vec = bio_src->bi_io_vec;
+   bio->bi_ioprio = bio_src->bi_ioprio;
 
bio_clone_blkcg_association(bio, bio_src);
 }
@@ -692,6 +693,7 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t 
gfp_mask,
bio->bi_write_hint  = bio_src->bi_write_hint;
bio->bi_iter.bi_sector  = bio_src->bi_iter.bi_sector;
bio->bi_iter.bi_size= bio_src->bi_iter.bi_size;
+   bio->bi_ioprio  = bio_src->bi_ioprio;
 
switch (bio_op(bio)) {
case REQ_OP_DISCARD:
-- 
2.12.3



Re: [PATCH] block: copy ioprio in __bio_clone_fast()

2018-02-26 Thread Hannes Reinecke
On 02/26/2018 11:55 AM, Hannes Reinecke wrote:
> We need to copy the io priority, too; otherwise the clone will run
> with a different priority than the original one.
> 
> Fixes: 43b62ce3ff0a ("block: move bio io prio to a new field")
> Signed-off-by: Hannes Reinecke 
> ---
>  block/bio.c  |   1 +
>  drivers/vhost/npiv.c | 379 
> +--
>  2 files changed, 37 insertions(+), 343 deletions(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index e1708db48258..e079911c640f 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -605,6 +605,7 @@ void __bio_clone_fast(struct bio *bio, struct bio 
> *bio_src)
>   bio->bi_write_hint = bio_src->bi_write_hint;
>   bio->bi_iter = bio_src->bi_iter;
>   bio->bi_io_vec = bio_src->bi_io_vec;
> + bio->bi_ioprio = bio_src->bi_ioprio;
>  
>   bio_clone_blkcg_association(bio, bio_src);
>  }
> diff --git a/drivers/vhost/npiv.c b/drivers/vhost/npiv.c
> index 20e2a66e332d..3527996aab3f 100644
> --- a/drivers/vhost/npiv.c
> +++ b/drivers/vhost/npiv.c
> @@ -13,7 +13,7 @@

Gnaa.
Please ignore.

Will be sending the correct patch.

-- 
Dr. Hannes ReineckezSeries & Storage
h...@suse.com  +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


[PATCH] block: copy ioprio in __bio_clone_fast()

2018-02-26 Thread Hannes Reinecke
We need to copy the io priority, too; otherwise the clone will run
with a different priority than the original one.

Fixes: 43b62ce3ff0a ("block: move bio io prio to a new field")
Signed-off-by: Hannes Reinecke 
---
 block/bio.c  |   1 +
 drivers/vhost/npiv.c | 379 +--
 2 files changed, 37 insertions(+), 343 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index e1708db48258..e079911c640f 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -605,6 +605,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
bio->bi_write_hint = bio_src->bi_write_hint;
bio->bi_iter = bio_src->bi_iter;
bio->bi_io_vec = bio_src->bi_io_vec;
+   bio->bi_ioprio = bio_src->bi_ioprio;
 
bio_clone_blkcg_association(bio, bio_src);
 }
diff --git a/drivers/vhost/npiv.c b/drivers/vhost/npiv.c
index 20e2a66e332d..3527996aab3f 100644
--- a/drivers/vhost/npiv.c
+++ b/drivers/vhost/npiv.c
@@ -13,7 +13,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- /
+ */
 
 #include 
 #include 
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -87,8 +88,6 @@ struct vhost_npiv_cmd {
struct vhost_virtqueue *tvc_vq;
/* Pointer to vhost nexus memory */
struct vhost_npiv_nexus *tvc_nexus;
-   /* The TCM I/O descriptor that is accessed via container_of() */
-   struct se_cmd tvc_se_cmd;
/* work item used for cmwq dispatch to vhost_npiv_submission_work() */
struct work_struct work;
/* Copy of the incoming SCSI command descriptor block (CDB) */
@@ -101,11 +100,6 @@ struct vhost_npiv_cmd {
struct vhost_npiv_inflight *inflight;
 };
 
-struct vhost_npiv_nexus {
-   /* Pointer to TCM session for I_T Nexus */
-   struct se_session *tvn_se_sess;
-};
-
 struct vhost_npiv_tpg {
/* Vhost port target portal group tag for TCM */
u16 tport_tpgt;
@@ -121,25 +115,10 @@ struct vhost_npiv_tpg {
struct mutex tv_tpg_mutex;
/* Pointer to the TCM VHost I_T Nexus for this TPG endpoint */
struct vhost_npiv_nexus *tpg_nexus;
-   /* Pointer back to vhost_npiv_tport */
-   struct vhost_npiv_tport *tport;
-   /* Returned by vhost_npiv_make_tpg() */
-   struct se_portal_group se_tpg;
/* Pointer back to vhost_npiv, protected by tv_tpg_mutex */
struct vhost_npiv *vhost_npiv;
 };
 
-struct vhost_npiv_tport {
-   /* SCSI protocol the tport is providing */
-   u8 tport_proto_id;
-   /* Binary World Wide unique Port Name for Vhost Target port */
-   u64 tport_wwpn;
-   /* ASCII formatted WWPN for Vhost Target port */
-   char tport_name[VHOST_NPIV_NAMELEN];
-   /* Returned by vhost_npiv_make_tport() */
-   struct se_wwn tport_wwn;
-};
-
 struct vhost_npiv_evt {
/* event to be sent to guest */
struct virtio_scsi_event event;
@@ -195,6 +174,7 @@ struct vhost_npiv {
 };
 
 static struct workqueue_struct *vhost_npiv_workqueue;
+static struct mempool *vhost_npiv_cmd_pool;
 
 /* Global spinlock to protect vhost_npiv TPG list for vhost IOCTL access */
 static DEFINE_MUTEX(vhost_npiv_mutex);
@@ -253,132 +233,6 @@ static void vhost_npiv_put_inflight(struct 
vhost_npiv_inflight *inflight)
kref_put(>kref, vhost_npiv_done_inflight);
 }
 
-static int vhost_npiv_check_true(struct se_portal_group *se_tpg)
-{
-   return 1;
-}
-
-static int vhost_npiv_check_false(struct se_portal_group *se_tpg)
-{
-   return 0;
-}
-
-static char *vhost_npiv_get_fabric_name(void)
-{
-   return "vhost";
-}
-
-static char *vhost_npiv_get_fabric_wwn(struct se_portal_group *se_tpg)
-{
-   struct vhost_npiv_tpg *tpg = container_of(se_tpg,
-   struct vhost_npiv_tpg, se_tpg);
-   struct vhost_npiv_tport *tport = tpg->tport;
-
-   return >tport_name[0];
-}
-
-static u16 vhost_npiv_get_tpgt(struct se_portal_group *se_tpg)
-{
-   struct vhost_npiv_tpg *tpg = container_of(se_tpg,
-   struct vhost_npiv_tpg, se_tpg);
-   return tpg->tport_tpgt;
-}
-
-static int vhost_npiv_check_prot_fabric_only(struct se_portal_group *se_tpg)
-{
-   struct vhost_npiv_tpg *tpg = container_of(se_tpg,
-   struct vhost_npiv_tpg, se_tpg);
-
-   return tpg->tv_fabric_prot_type;
-}
-
-static u32 vhost_npiv_tpg_get_inst_index(struct se_portal_group *se_tpg)
-{
-   return 1;
-}
-
-static void vhost_npiv_release_cmd(struct se_cmd *se_cmd)
-{
-   struct vhost_npiv_cmd *tv_cmd = container_of(se_cmd,
-   struct vhost_npiv_cmd, tvc_se_cmd);
-   struct se_session *se_sess = tv_cmd->tvc_nexus->tvn_se_sess;
-   int i;
-
-   if (tv_cmd->tvc_sgl_count) {
-   for (i = 0; i <