Messages in this thread | | | Subject | Re: next bio iters break discard? | From | "Martin K. Petersen" <> | Date | Wed, 15 Jan 2014 20:39:42 -0500 |
| |
>>>>> "Kent" == Kent Overstreet <kmo@daterainc.com> writes:
Kent> Side note, one of the things on my todo list/wishlist is make a Kent> separate enum for bio type - bare flush, normal read/write, scsi Kent> command, discard and write same. In particular with bi_size Kent> meaning different things depending on the type of the command, I Kent> think having an enum we can switch off of where appropriate Kent> instead of a bunch of random flags will make things a hell of a Kent> lot saner.
Yeah. That's one of the reasons we cleaned up the merge flags and introduced bio_has_data() and bio_is_rw().
Kent> There's also that horrible hack in the scsi (?) code Christoph Kent> added for discards - where the driver adds a page to the bio - if Kent> the driver is counting the number of segments _after_ that god Kent> only knows what is supposed to happen.
I manually do the bookkeeping in the SCSI disk driver. I.e. LLDs are explicitly told to perform a 512-byte transfer. And when they're done I complete bi_size bytes to the block layer. Kind of ugly but it's an unfortunate side effect of bi_size being both the size of the scatterlist and the block count. I did consider making them separate entities but that means struct bio will grow for no reason for the common case of read/write. Didn't seem worth the hassle...
Kent> Does the below patch look like what we want? I'm assuming that if Kent> multiple WRITE_SAME bios are merged, since they're all writing the Kent> same data we can consider the entire request to be a single Kent> segment.
Looks OK to me.
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
-- Martin K. Petersen Oracle Linux Engineering
| |