Message ID | 20240904152605.4055570-3-kbusch@meta.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block integrity merging and counting | expand |
On Wed, Sep 04, 2024 at 08:25:57AM -0700, Keith Busch wrote: > From: Keith Busch <kbusch@kernel.org> > > This way drivers that want this value don't need to concern themselves > with the CONFIG_BLK_DEV_INTEGRITY setting. Looks ok: Reviewed-by: Christoph Hellwig <hch@lst.de> Although I wonder if we should simply define the field unconditionally given that it is only 2 bytes wide and packs nicely.
On Tue, Sep 10, 2024 at 05:30:46PM +0200, Christoph Hellwig wrote: > On Wed, Sep 04, 2024 at 08:25:57AM -0700, Keith Busch wrote: > > From: Keith Busch <kbusch@kernel.org> > > > > This way drivers that want this value don't need to concern themselves > > with the CONFIG_BLK_DEV_INTEGRITY setting. > > Looks ok: > > Reviewed-by: Christoph Hellwig <hch@lst.de> > > Although I wonder if we should simply define the field unconditionally > given that it is only 2 bytes wide and packs nicely. Good idea, I didn't consider that. Various parts become cleaner if it's unconditionally part of the request. I'll try it out. BTW, just want to mention the the return value here is unreliable until patch 10. I've reworked the series so that appears first to avoid a bisect hazard. The end result is the same though, so I didn't want to spam the mailing list with a v2 just yet.
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 8d304b1d16b15..3984aad9bf64a 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -228,6 +228,18 @@ static inline unsigned short req_get_ioprio(struct request *req) return req->ioprio; } +#ifdef CONFIG_BLK_DEV_INTEGRITY +static inline unsigned short blk_rq_integrity_segments(struct request *rq) +{ + return rq->nr_integrity_segments; +} +#else +static inline unsigned short blk_rq_integrity_segments(struct request *rq) +{ + return 0; +} +#endif + #define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ) #define rq_dma_dir(rq) \