public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/5] block: add function to issue compare and write
       [not found] ` <1413437835-13778-3-git-send-email-michaelc@cs.wisc.edu>
@ 2014-10-17  9:55   ` Christoph Hellwig
  2014-10-17 23:38     ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2014-10-17  9:55 UTC (permalink / raw)
  To: michaelc; +Cc: linux-scsi, target-devel, ceph-devel, axboe, linux-kernel

On Thu, Oct 16, 2014 at 12:37:12AM -0500, michaelc@cs.wisc.edu wrote:
> @@ -160,7 +160,7 @@ enum rq_flag_bits {
>  	__REQ_DISCARD,		/* request to discard sectors */
>  	__REQ_SECURE,		/* secure discard (used with __REQ_DISCARD) */
>  	__REQ_WRITE_SAME,	/* write same block many times */
> -
> +	__REQ_CMP_AND_WRITE,	/* compare data and write if matched */

I think it's time that we stop overloading the request flags with
request types.

We already have req->cmd_type which actually is a fairly good
description of what we get except for REQ_TYPE_FS, which is a horrible
overload using req->cmd_flags.

Given that you're just one of many currently ongoing patches to add
more flags here I think you need to byte the bullet and fix this up
by replacing REQ_TYPE_FS with:

REQ_TYPE_WRITE
REQ_TYPE_READ
REQ_TYPE_FLUSH
REQ_TYPE_DISCARD
REQ_TYPE_WRITE_SAME
REQ_TYPE_CMP_AND_WRITE

sd.c is a nice guide of what should be a flag and what a type since my
last refactoring of the command_init function.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/5] block: add function to issue compare and write
  2014-10-17  9:55   ` [PATCH 2/5] block: add function to issue compare and write Christoph Hellwig
@ 2014-10-17 23:38     ` Martin K. Petersen
  2014-10-18 15:16       ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Martin K. Petersen @ 2014-10-17 23:38 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: michaelc, linux-scsi, target-devel, ceph-devel, axboe,
	linux-kernel

>>>>> "Christoph" == Christoph Hellwig <hch@infradead.org> writes:

Christoph> We already have req->cmd_type which actually is a fairly good
Christoph> description of what we get except for REQ_TYPE_FS, which is a
Christoph> horrible overload using req->cmd_flags.

Christoph> Given that you're just one of many currently ongoing patches
Christoph> to add more flags here I think you need to byte the bullet
Christoph> and fix this up by replacing REQ_TYPE_FS with:

Christoph> REQ_TYPE_WRITE REQ_TYPE_READ REQ_TYPE_FLUSH REQ_TYPE_DISCARD
Christoph> REQ_TYPE_WRITE_SAME REQ_TYPE_CMP_AND_WRITE

The problem with this is that, as it stands, a bio has no type. And it
would suck if we couldn't keep bio rw and request flags in sync.

I wonder if it would make more sense to move the remaining rq types to
cmd_flags after I'm done with the 64-bit conversion?

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/5] block: add function to issue compare and write
  2014-10-17 23:38     ` Martin K. Petersen
@ 2014-10-18 15:16       ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2014-10-18 15:16 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: michaelc, linux-scsi, target-devel, ceph-devel, axboe,
	linux-kernel

On Fri, Oct 17, 2014 at 07:38:37PM -0400, Martin K. Petersen wrote:
> The problem with this is that, as it stands, a bio has no type. And it
> would suck if we couldn't keep bio rw and request flags in sync.
> 
> I wonder if it would make more sense to move the remaining rq types to
> cmd_flags after I'm done with the 64-bit conversion?

I'd prefer adding a cmd_type to the bio as well and avoid the 64-bit
flag conversion.  While we'll probably grow more types of I/Os (e.g.
copy offload) I hope we can actually reduce the number of real flags,
and it's easier to read for sure if we can switch on the command type
in the driver.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-18 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1413437835-13778-1-git-send-email-michaelc@cs.wisc.edu>
     [not found] ` <1413437835-13778-3-git-send-email-michaelc@cs.wisc.edu>
2014-10-17  9:55   ` [PATCH 2/5] block: add function to issue compare and write Christoph Hellwig
2014-10-17 23:38     ` Martin K. Petersen
2014-10-18 15:16       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox