X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=block%2Fblk.h;h=e8d598e4a948de5d4e5d9ff298166b2fb6cacbc0;hb=e45d4b5e270c693042c482bf4efb92e7d075dd2e;hp=442098aa9463a37dad0dfccb1718eea65be6cdb3;hpb=8cbab92dff778e516064c13113ca15d4869ec883;p=mirror_ubuntu-bionic-kernel.git diff --git a/block/blk.h b/block/blk.h index 442098aa9463..e8d598e4a948 100644 --- a/block/blk.h +++ b/block/blk.h @@ -245,6 +245,16 @@ static inline void req_set_nomerge(struct request_queue *q, struct request *req) q->last_merge = NULL; } +/* + * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size + * is defined as 'unsigned int', meantime it has to aligned to with logical + * block size which is the minimum accepted unit by hardware. + */ +static inline unsigned int bio_allowed_max_sectors(struct request_queue *q) +{ + return round_down(UINT_MAX, queue_logical_block_size(q)) >> 9; +} + /* * Internal io_context interface */