Thread (66 messages) 66 messages, 6 authors, 2024-06-04

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

From: Bart Van Assche <bvanassche@acm.org>
Date: 2024-05-20 23:00:54
Also in: dm-devel, linux-doc, linux-fsdevel, linux-nvme, lkml

Possibly related (same subject, not in this thread)

On 5/20/24 03:20, Nitesh Shetty wrote:
Upon arrival of source bio we merge these two bio's and send
corresponding request down to device driver.
bios with different operation types must not be merged.
+static enum bio_merge_status bio_attempt_copy_offload_merge(struct request *req,
+							    struct bio *bio)
+{
+	if (req->__data_len != bio->bi_iter.bi_size)
+		return BIO_MERGE_FAILED;
+
+	req->biotail->bi_next = bio;
+	req->biotail = bio;
+	req->nr_phys_segments++;
+	req->__data_len += bio->bi_iter.bi_size;
+
+	return BIO_MERGE_OK;
+}
This function appends a bio to a request. Hence, the name of this function is
wrong.
quoted hunk ↗ jump to hunk
@@ -1085,6 +1124,8 @@ static enum bio_merge_status blk_attempt_bio_merge(struct request_queue *q,
  		break;
  	case ELEVATOR_DISCARD_MERGE:
  		return bio_attempt_discard_merge(q, rq, bio);
+	case ELEVATOR_COPY_OFFLOAD_MERGE:
+		return bio_attempt_copy_offload_merge(rq, bio);
  	default:
  		return BIO_MERGE_NONE;
  	}
Is any code added in this patch series that causes an I/O scheduler to return
ELEVATOR_COPY_OFFLOAD_MERGE?
+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.
+static inline bool op_is_copy(blk_opf_t op)
+{
+	return ((op & REQ_OP_MASK) == REQ_OP_COPY_SRC ||
+		(op & REQ_OP_MASK) == REQ_OP_COPY_DST);
+}
The above function is not used in this patch. Please introduce new functions in the
patch in which these are used for the first time.

Thanks,

Bart.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help