Re: [PATCH 2/8] blk-mq: protect completion path with RCU

2018-01-08 Thread Hannes Reinecke
On 01/08/2018 08:15 PM, Tejun Heo wrote:
> Currently, blk-mq protects only the issue path with RCU.  This patch
> puts the completion path under the same RCU protection.  This will be
> used to synchronize issue/completion against timeout by later patches,
> which will also add the comments.
> 
> Signed-off-by: Tejun Heo <t...@kernel.org>
> ---
>  block/blk-mq.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index ddc9261..6741c3e 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -584,11 +584,16 @@ static void hctx_lock(struct blk_mq_hw_ctx *hctx, int 
> *srcu_idx)
>  void blk_mq_complete_request(struct request *rq)
>  {
>   struct request_queue *q = rq->q;
> + struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, rq->mq_ctx->cpu);
> + int srcu_idx;
>  
>   if (unlikely(blk_should_fake_timeout(q)))
>   return;
> +
> + hctx_lock(hctx, _idx);
>   if (!blk_mark_rq_complete(rq))
>   __blk_mq_complete_request(rq);
> + hctx_unlock(hctx, srcu_idx);
>  }
>  EXPORT_SYMBOL(blk_mq_complete_request);
>  
> 
Hmm. Why do we need to call blk_mq_map_queue() here?
Is there a chance that we end up with a _different_ hctx on completion
than that one used for submission?
If not, why can't we just keep a pointer to the hctx in struct request?

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 28/45] target: use bio op accessors

2016-06-06 Thread Hannes Reinecke

On 06/06/2016 05:40 PM, Mike Christie wrote:

On 06/06/2016 01:46 AM, Hannes Reinecke wrote:

On 06/05/2016 09:32 PM, mchri...@redhat.com wrote:

From: Mike Christie <mchri...@redhat.com>

Separate the op from the rq_flag_bits and have the target layer
set/get the bio using bio_set_op_attrs/bio_op.

Signed-off-by: Mike Christie <mchri...@redhat.com>
---
  drivers/target/target_core_iblock.c | 29 ++---
  drivers/target/target_core_pscsi.c  |  2 +-
  2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/target/target_core_iblock.c 
b/drivers/target/target_core_iblock.c
index c25109c..22af12f 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c

[ .. ]

@@ -689,18 +690,15 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist 
*sgl, u32 sgl_nents,
 * Force writethrough using WRITE_FUA if a volatile write cache
 * is not enabled, or if initiator set the Force Unit Access 
bit.
 */
+   op = REQ_OP_WRITE;
if (test_bit(QUEUE_FLAG_FUA, >queue_flags)) {
if (cmd->se_cmd_flags & SCF_FUA)
-   rw = WRITE_FUA;
+   op_flags = WRITE_FUA;
else if (!test_bit(QUEUE_FLAG_WC, >queue_flags))
-   rw = WRITE_FUA;
-   else
-   rw = WRITE;
-   } else {
-   rw = WRITE;
+   op_flags = WRITE_FUA;
}

Wrong intendation.


It should be ok. That line is for the QUEUE_FLAG_WC test. We end up with:

op = REQ_OP_WRITE;
if (test_bit(QUEUE_FLAG_FUA, >queue_flags)) {
if (cmd->se_cmd_flags & SCF_FUA)
op_flags = WRITE_FUA;
else if (!test_bit(QUEUE_FLAG_WC, >queue_flags))
op_flags = WRITE_FUA;
}





Indeed, you are correct.

Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 42/45] block, fs, drivers: remove REQ_OP compat defs and related code

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:32 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> This patch drops the compat definition of req_op where it matches
> the rq_flag_bits definitions, and drops the related old and compat
> code that allowed users to set either the op or flags for the operation.
> 
> We also then store the operation in the bi_rw/cmd_flags field similar
> to how we used to store the bio ioprio where it sat in the upper bits
> of the field.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
>  drivers/scsi/sd.c   |  2 +-
>  include/linux/bio.h |  3 ---
>  include/linux/blk_types.h   | 52 
> +
>  include/linux/blkdev.h  | 14 
>  include/linux/fs.h  | 37 +---
>  include/trace/events/f2fs.h |  1 -
>  6 files changed, 46 insertions(+), 63 deletions(-)
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 41/45] block, drivers, fs: shrink bi_rw from long to int

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:32 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> We don't need bi_rw to be so large on 64 bit archs, so
> reduce it to unsigned int.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
>  block/blk-core.c   | 2 +-
>  drivers/md/dm-flakey.c | 2 +-
>  drivers/md/raid5.c | 6 +++---
>  fs/btrfs/check-integrity.c | 4 ++--
>  fs/btrfs/inode.c   | 2 +-
>  include/linux/blk_types.h  | 2 +-
>  6 files changed, 9 insertions(+), 9 deletions(-)
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 40/45] block: move bio io prio to a new field

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:32 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> In the next patch, we move drop the compat code and make
> the op a separate value that is hidden in bi_rw. To give
> the op and rq bits flags room to grow this moves prio to
> its own field.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
>  include/linux/bio.h   | 14 ++
>  include/linux/blk_types.h |  5 ++---
>  2 files changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index 4568647..35108c2 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -47,18 +47,8 @@
>  #define bio_op(bio)  (op_from_rq_bits((bio)->bi_rw))
>  #define bio_set_op_attrs(bio, op, flags) ((bio)->bi_rw |= (op | flags))
>  
> -/*
> - * upper 16 bits of bi_rw define the io priority of this bio
> - */
> -#define BIO_PRIO_SHIFT   (8 * sizeof(unsigned long) - IOPRIO_BITS)
> -#define bio_prio(bio)((bio)->bi_rw >> BIO_PRIO_SHIFT)
> -#define bio_prio_valid(bio)  ioprio_valid(bio_prio(bio))
> -
> -#define bio_set_prio(bio, prio)  do {\
> - WARN_ON(prio >= (1 << IOPRIO_BITS));\
> - (bio)->bi_rw &= ((1UL << BIO_PRIO_SHIFT) - 1);  \
> - (bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT); \
> -} while (0)
> +#define bio_prio(bio)(bio)->bi_ioprio
> +#define bio_set_prio(bio, prio)  ((bio)->bi_ioprio = prio)
>  
>  /*
>   * various member access, note that bio_data should of course not be used
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index 6e60baa..2738413 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -48,9 +48,8 @@ struct bio {
>   struct block_device *bi_bdev;
>   unsigned intbi_flags;   /* status, command, etc */
>   int bi_error;
> - unsigned long   bi_rw;  /* bottom bits READ/WRITE,
> -  * top bits priority
> -      */
> + unsigned long   bi_rw;  /* READ/WRITE */
> + unsigned short  bi_ioprio;
>  
>   struct bvec_iterbi_iter;
>  
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 37/45] drivers: use req op accessor

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:32 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> The req operation REQ_OP is separated from the rq_flag_bits
> definition. This converts the block layer drivers to
> use req_op to get the op from the request struct.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
>  drivers/block/loop.c  |  6 +++---
>  drivers/block/mtip32xx/mtip32xx.c |  2 +-
>  drivers/block/nbd.c   |  2 +-
>  drivers/block/rbd.c   |  4 ++--
>  drivers/block/xen-blkfront.c  |  8 +---
>  drivers/ide/ide-floppy.c  |  2 +-
>  drivers/md/dm.c   |  2 +-
>  drivers/mmc/card/block.c  |  7 +++
>  drivers/mmc/card/queue.c  |  6 ++
>  drivers/mmc/card/queue.h  |  5 -
>  drivers/mtd/mtd_blkdevs.c |  2 +-
>  drivers/nvme/host/core.c  |  2 +-
>  drivers/nvme/host/nvme.h  |  4 ++--
>  drivers/scsi/sd.c | 25 -----
>  14 files changed, 43 insertions(+), 34 deletions(-)
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 28/45] target: use bio op accessors

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:32 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> Separate the op from the rq_flag_bits and have the target layer
> set/get the bio using bio_set_op_attrs/bio_op.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
>  drivers/target/target_core_iblock.c | 29 ++---
>  drivers/target/target_core_pscsi.c  |  2 +-
>  2 files changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/target/target_core_iblock.c 
> b/drivers/target/target_core_iblock.c
> index c25109c..22af12f 100644
> --- a/drivers/target/target_core_iblock.c
> +++ b/drivers/target/target_core_iblock.c
[ .. ]
> @@ -689,18 +690,15 @@ iblock_execute_rw(struct se_cmd *cmd, struct 
> scatterlist *sgl, u32 sgl_nents,
>* Force writethrough using WRITE_FUA if a volatile write cache
>* is not enabled, or if initiator set the Force Unit Access 
> bit.
>*/
> + op = REQ_OP_WRITE;
>   if (test_bit(QUEUE_FLAG_FUA, >queue_flags)) {
>   if (cmd->se_cmd_flags & SCF_FUA)
> - rw = WRITE_FUA;
> + op_flags = WRITE_FUA;
>   else if (!test_bit(QUEUE_FLAG_WC, >queue_flags))
> - rw = WRITE_FUA;
> - else
> - rw = WRITE;
> - } else {
> - rw = WRITE;
> + op_flags = WRITE_FUA;
>   }
Wrong intendation.

>   } else {
> - rw = READ;
> + op = REQ_OP_READ;
>   }
>  
>   ibr = kzalloc(sizeof(struct iblock_req), GFP_KERNEL);
> @@ -714,7 +712,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist 
> *sgl, u32 sgl_nents,
>   return 0;
>   }
>  
> - bio = iblock_get_bio(cmd, block_lba, sgl_nents, rw);
> + bio = iblock_get_bio(cmd, block_lba, sgl_nents, op, op_flags);
>   if (!bio)
>   goto fail_free_ibr;
>  
> @@ -738,7 +736,8 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist 
> *sgl, u32 sgl_nents,
>   bio_cnt = 0;
>   }
>  
> - bio = iblock_get_bio(cmd, block_lba, sg_num, rw);
> + bio = iblock_get_bio(cmd, block_lba, sg_num, op,
> +  op_flags);
>   if (!bio)
>   goto fail_put_bios;
>  
> diff --git a/drivers/target/target_core_pscsi.c 
> b/drivers/target/target_core_pscsi.c
> index de18790..81564c8 100644
> --- a/drivers/target/target_core_pscsi.c
> +++ b/drivers/target/target_core_pscsi.c
> @@ -922,7 +922,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, 
> u32 sgl_nents,
>   goto fail;
>  
>   if (rw)
> - bio->bi_rw |= REQ_WRITE;
> + bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
>  
>   pr_debug("PSCSI: Allocated bio: %p,"
>   " dir: %s nr_vecs: %d\n", bio,
> 
Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 25/45] bcache: use bio op accessors

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:32 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> Separate the op from the rq_flag_bits and have bcache
> set/get the bio using bio_set_op_attrs/bio_op.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
>  drivers/md/bcache/btree.c |  4 ++--
>  drivers/md/bcache/debug.c |  4 ++--
>  drivers/md/bcache/journal.c   |  7 ---
>  drivers/md/bcache/movinggc.c  |  2 +-
>  drivers/md/bcache/request.c   | 14 +++---
>  drivers/md/bcache/super.c | 24 +---
>  drivers/md/bcache/writeback.c |  4 ++--
>  7 files changed, 31 insertions(+), 28 deletions(-)
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 24/45] dm: use bio op accessors

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:32 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> Separate the op from the rq_flag_bits and have dm
> set/get the bio using bio_set_op_attrs/bio_op.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/45] block discard: use bio set op accessor

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:31 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> This converts the block issue discard helper and users to use
> the bio_set_op_attrs accessor and only pass in the operation flags
> like REQ_SEQURE.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
>  block/blk-lib.c| 13 +++--
>  drivers/md/dm-thin.c   |  2 +-
>  include/linux/blkdev.h |  3 ++-
>  3 files changed, 10 insertions(+), 8 deletions(-)
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/45] block, fs, mm, drivers: use bio set/get op accessors

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:31 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> This patch converts the simple bi_rw use cases in the block,
> drivers, mm and fs code to set/get the bio operation using
> bio_set_op_attrs/bio_op
> 
> These should be simple one or two liner cases, so I just did them
> in one patch. The next patches handle the more complicated
> cases in a module per patch.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
> 
> v5:
> 1. Add missed crypto call.
> 2. Change nfs bi_rw check to bi_op.
> 
>  block/bio.c | 13 ++---
>  block/blk-core.c|  6 +++---
>  block/blk-flush.c   |  2 +-
>  block/blk-lib.c |  4 ++--
>  block/blk-map.c |  2 +-
>  block/blk-merge.c   | 12 ++--
>  drivers/block/brd.c |  2 +-
>  drivers/block/floppy.c  |  2 +-
>  drivers/block/pktcdvd.c |  4 ++--
>  drivers/block/rsxx/dma.c|  2 +-
>  drivers/block/zram/zram_drv.c   |  2 +-
>  drivers/lightnvm/rrpc.c |  6 +++---
>  drivers/scsi/osd/osd_initiator.c|  8 
>  drivers/staging/lustre/lustre/llite/lloop.c |  6 +++---
>  fs/crypto/crypto.c  |  2 +-
>  fs/exofs/ore.c  |  2 +-
>  fs/ext4/page-io.c   |  6 +++---
>  fs/ext4/readpage.c  |  2 +-
>  fs/jfs/jfs_logmgr.c |  4 ++--
>  fs/jfs/jfs_metapage.c   |  4 ++--
>  fs/logfs/dev_bdev.c | 12 ++--
>  fs/nfs/blocklayout/blocklayout.c|  4 ++--
>  include/linux/bio.h | 15 ++-
>  mm/page_io.c|  4 ++--
>  24 files changed, 65 insertions(+), 61 deletions(-)
> 
[ .. ]
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index 09c5308..4568647 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -109,18 +109,23 @@ static inline bool bio_has_data(struct bio *bio)
>  {
>   if (bio &&
>   bio->bi_iter.bi_size &&
> - !(bio->bi_rw & REQ_DISCARD))
> + bio_op(bio) != REQ_OP_DISCARD)
>   return true;
>  
>   return false;
>  }
>  
> +static inline bool bio_no_advance_iter(struct bio *bio)
> +{
> + return bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == 
> REQ_OP_WRITE_SAME;
> +}
> +
>  static inline bool bio_is_rw(struct bio *bio)
>  {
>   if (!bio_has_data(bio))
>   return false;
>  
> - if (bio->bi_rw & BIO_NO_ADVANCE_ITER_MASK)
> + if (bio_no_advance_iter(bio))
>   return false;
>  
>   return true;
> @@ -228,7 +233,7 @@ static inline void bio_advance_iter(struct bio *bio, 
> struct bvec_iter *iter,
>  {
>   iter->bi_sector += bytes >> 9;
>  
> - if (bio->bi_rw & BIO_NO_ADVANCE_ITER_MASK)
> + if (bio_no_advance_iter(bio))
>   iter->bi_size -= bytes;
>   else
>   bvec_iter_advance(bio->bi_io_vec, iter, bytes);
Hmm. Can't you drop 'BIO_NO_ADVANCE_ITER_MASK' after this patch?

> @@ -256,10 +261,10 @@ static inline unsigned bio_segments(struct bio *bio)
>* differently:
>*/
>  
> - if (bio->bi_rw & REQ_DISCARD)
> + if (bio_op(bio) == REQ_OP_DISCARD)
>   return 1;
>  
> - if (bio->bi_rw & REQ_WRITE_SAME)
> + if (bio_op(bio) == REQ_OP_WRITE_SAME)
>   return 1;
>  
>   bio_for_each_segment(bv, bio, iter)
> diff --git a/mm/page_io.c b/mm/page_io.c
> index 5a5fd66..dcc5d37 100644
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -317,7 +317,7 @@ int __swap_writepage(struct page *page, struct 
> writeback_control *wbc,
>   ret = -ENOMEM;
>   goto out;
>   }
> - bio->bi_rw = WRITE;
> + bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
>   if (wbc->sync_mode == WB_SYNC_ALL)
>   bio->bi_rw |= REQ_SYNC;
>   count_vm_event(PSWPOUT);
> @@ -370,7 +370,7 @@ int swap_readpage(struct page *page)
>   ret = -ENOMEM;
>   goto out;
>   }
> - bio->bi_rw = READ;
> + bio_set_op_attrs(bio, REQ_OP_READ, 0);
>   count_vm_event(PSWPIN);
>   submit_bio(bio);
>  out:
> 
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 07/45] bcache: use op_is_write instead of checking for REQ_WRITE

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:31 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> We currently set REQ_WRITE/WRITE for all non READ IOs
> like discard, flush, writesame, etc. In the next patches where we
> no longer set up the op as a bitmap, we will not be able to
> detect a operation direction like writesame by testing if REQ_WRITE is
> set.
> 
> This has bcache use the op_is_write helper which will do the right
> thing.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
>  drivers/md/bcache/io.c  | 2 +-
>  drivers/md/bcache/request.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
(Could probably folded together with the two previous patches)

Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/45] dm: use op_is_write instead of checking for REQ_WRITE

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:31 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> We currently set REQ_WRITE/WRITE for all non READ IOs
> like discard, flush, writesame, etc. In the next patches where we
> no longer set up the op as a bitmap, we will not be able to
> detect a operation direction like writesame by testing if REQ_WRITE is
> set.
> 
> This has dm use the op_is_write helper which will do the right
> thing.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---

(Could probably be folded into the previous patch)

Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/45] block, drivers, cgroup: use op_is_write helper instead of checking for REQ_WRITE

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:31 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> We currently set REQ_WRITE/WRITE for all non READ IOs
> like discard, flush, writesame, etc. In the next patches where we
> no longer set up the op as a bitmap, we will not be able to
> detect a operation direction like writesame by testing if REQ_WRITE is
> set.
> 
> This patch converts the drivers and cgroup to use the
> op_is_write helper. This should just cover the simple
> cases. I did dm, md and bcache in their own patches
> because they were more involved.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/45] block: add REQ_OP definitions and helpers

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:31 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> The following patches separate the operation (WRITE, READ, DISCARD,
> etc) from the rq_flag_bits flags. This patch adds definitions for
> request/bio operations (REQ_OPs) and adds request/bio accessors to
> get/set the op.
> 
> In this patch the REQ_OPs match the REQ rq_flag_bits ones
> for compat reasons while all the code is converted to use the
> op accessors in the set. In the last patches the op will become a
> number and the accessors and helpers in this patch will be dropped
> or updated.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/45] block/fs/drivers: remove rw argument from submit_bio

2016-06-06 Thread Hannes Reinecke
On 06/05/2016 09:31 PM, mchri...@redhat.com wrote:
> From: Mike Christie <mchri...@redhat.com>
> 
> This has callers of submit_bio/submit_bio_wait set the bio->bi_rw
> instead of passing it in. This makes that use the same as
> generic_make_request and how we set the other bio fields.
> 
> Signed-off-by: Mike Christie <mchri...@redhat.com>
> ---
Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/42] v5: separate operations from flags in the bio/request structs

2016-04-14 Thread Hannes Reinecke
On 04/13/2016 09:35 PM, mchri...@redhat.com wrote:
> The following patches begin to cleanup the request->cmd_flags and
> bio->bi_rw mess. We currently use cmd_flags to specify the operation,
> attributes and state of the request. For bi_rw we use it for similar
> info and also the priority but then also have another bi_flags field
> for state. At some point, we abused them so much we just made cmd_flags
> 64 bits, so we could add more.
> 
> The following patches seperate the operation (read, write discard,
> flush, etc) from cmd_flags/bi_rw.
> 
> This patchset was made against linux-next from today April 13
> (git tag next-20160413).
> 
> I put a git tree here:
> https://github.com/mikechristie/linux-kernel.git
> The patches are in the op branch.
> 
A round of applause for you.

For the entire series:

Reviewed-by: Hannes Reinecke <h...@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [dm-devel] [PATCH] block: add a bi_error field to struct bio

2015-07-21 Thread Hannes Reinecke
On 07/20/2015 03:29 PM, Christoph Hellwig wrote:
 Currently we have two different ways to signal an I/O error on a BIO:
 
  (1) by clearing the BIO_UPTODATE flag
  (2) by returning a Linux errno value to the bi_end_io callback
 
 The first one has the drawback of only communicating a single possible
 error (-EIO), and the second one has the drawback of not beeing persistent
 when bios are queued up, and are not passed along from child to parent
 bio in the ever more popular chaining scenario.  Having both mechanisms
 available has the additional drawback of utterly confusing driver authors
 and introducing bugs where various I/O submitters only deal with one of
 them, and the others have to add boilerplate code to deal with both kinds
 of error returns.
 
 So add a new bi_error field to store an errno value directly in struct
 bio and remove the existing mechanisms to clean all this up.
 
 Signed-off-by: Christoph Hellwig h...@lst.de
 ---
Very good improvement.

Reviewed-by: Hannes Reinecke h...@suse.de

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries  Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html