Skip to content

Commit

Permalink
Address Mav's review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Ameer Hamza <[email protected]>
  • Loading branch information
ixhamza committed Nov 21, 2024
1 parent f30eabd commit 126d003
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion block/blk-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,15 @@ ssize_t blkdev_copy_offload(struct block_device *bdev, loff_t pos_in,
ssize_t ret;
struct blk_plug plug;

if (!max_copy_bytes || bdev->bd_queue->mq_ops == NULL)
if (!max_copy_bytes || bdev->bd_queue->mq_ops == NULL ||
bdev->bd_queue->mq_ops != bdev_out->bd_queue->mq_ops)
return -EOPNOTSUPP;

ret = blkdev_copy_sanity_check(bdev, pos_in, bdev, pos_out, len);

if (ret == 0)
ret = blkdev_copy_sanity_check(bdev_out, pos_in, bdev, pos_out, len);

if (ret)
return ret;

Expand Down
4 changes: 2 additions & 2 deletions block/fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,12 +779,12 @@ static ssize_t blkdev_copy_file_range(struct file *file_in, loff_t pos_in,
struct block_device *out_bdev = I_BDEV(bdev_file_inode(file_out));
ssize_t copied = 0;

if (/*(in_bdev == out_bdev) &&*/ bdev_max_copy_sectors(in_bdev) &&
if (bdev_max_copy_sectors(in_bdev) &&
(file_in->f_iocb_flags & IOCB_DIRECT) &&
(file_out->f_iocb_flags & IOCB_DIRECT)) {
copied = blkdev_copy_offload(in_bdev, pos_in, pos_out, len,
NULL, NULL, GFP_KERNEL, out_bdev);
if (copied < 0)
if (copied != -EOPNOTSUPP && copied < 0)
copied = 0;
} else {
copied = splice_copy_file_range(file_in, pos_in + copied,
Expand Down

0 comments on commit 126d003

Please sign in to comment.