Re: [PATCH v20 02/12] Add infrastructure for copy offload in block and request layer.

From: Bart Van Assche
Date: Wed May 22 2024 - 13:59:07 EST


On 5/21/24 04:17, Nitesh Shetty wrote:
On 20/05/24 04:00PM, Bart Van Assche wrote:
On 5/20/24 03:20, Nitesh Shetty wrote:
+static inline bool blk_copy_offload_mergable(struct request *req,
+                         struct bio *bio)
+{
+    return (req_op(req) == REQ_OP_COPY_DST &&
+        bio_op(bio) == REQ_OP_COPY_SRC);
+}

bios with different operation types must not be merged. Please rename this function.

As far as function renaming, we followed discard's naming. But open to
any suggestion.

req_attempt_discard_merge() checks whether two REQ_OP_DISCARD bios can be merged.
The above function checks something else, namely whether REQ_OP_COPY_DST and
REQ_OP_COPY_SRC can be combined into a copy offload operation. Hence my request
not to use the verb "merge" for combining REQ_OP_COPY_SRC and REQ_OP_COPY_DST
operations.

Thanks,

Bart.