On 11/12/24 9:00 AM, Christoph Hellwig wrote:
- /* Don't merge requests with different write hints. */
- if (req->write_hint != next->write_hint)
- return NULL;
+ if (req->bio && next->bio) {
+ /* Don't merge requests with different write hints. */
+ if (req->bio->bi_write_hint != next->bio->bi_write_hint)
+ return NULL;
+ }
The above two if-statements can be combined into a single if-statement.
@@ -1001,9 +1003,11 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
if (!bio_crypt_rq_ctx_compatible(rq, bio))
return false;
- /* Don't merge requests with different write hints. */
- if (rq->write_hint != bio->bi_write_hint)
- return false;
+ if (rq->bio) {
+ /* Don't merge requests with different write hints. */
+ if (rq->bio->bi_write_hint != bio->bi_write_hint)
+ return false;
+ }
Same comment here: the above two if-statements can also be combined into
a single if-statement.
Otherwise this patch looks good to me.
Thanks,
Bart.