From: Christoph Hellwig <hch@lst.de>
To: Nitesh Shetty <nj.shetty@samsung.com>
Cc: linux-doc@vger.kernel.org, djwong@kernel.org,
linux-nvme@lists.infradead.org, dm-devel@redhat.com,
Christoph Hellwig <hch@lst.de>, Alasdair Kergon <agk@redhat.com>,
Sagi Grimberg <sagi@grimberg.me>,
linux-scsi@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
gost.dev@samsung.com, nitheshshetty@gmail.com,
willy@infradead.org, Chaitanya Kulkarni <kch@nvidia.com>,
Anuj Gupta <anuj20.g@samsung.com>,
Mike Snitzer <snitzer@kernel.org>,
ming.lei@redhat.com, linux-block@vger.kernel.org,
dlemoal@kernel.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Keith Busch <kbusch@kernel.org>,
bvanassche@acm.org, Jens Axboe <axboe@kernel.dk>,
Christian Brauner <brauner@kernel.org>,
martin.petersen@oracle.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [dm-devel] [PATCH v13 4/9] fs, block: copy_file_range for def_blk_ops for direct block device
Date: Thu, 20 Jul 2023 09:57:10 +0200 [thread overview]
Message-ID: <20230720075710.GC5042@lst.de> (raw)
In-Reply-To: <20230627183629.26571-5-nj.shetty@samsung.com>
> +/* Copy source offset from source block device to destination block
> + * device. Returns the length of bytes copied.
> + */
> +ssize_t blkdev_copy_offload_failfast(
> + struct block_device *bdev_in, loff_t pos_in,
> + struct block_device *bdev_out, loff_t pos_out,
> + size_t len, gfp_t gfp_mask)
This is an odd and very misnamed interface.
Either we have a klkdev_copy() interface that automatically falls back
to a fallback (maybe with an opt-out), or we have separate
blkdev_copy_offload/blkdev_copy_emulated interface and let the caller
decide. But none of that really is "failfast".
Also this needs to go into the helpers patch and not a patch that is
supposed to just wire copying up for block device node.
> index b07de77ef126..d27148a2543f 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -1447,7 +1447,8 @@ static int generic_copy_file_checks(struct file *file_in, loff_t pos_in,
> return -EOVERFLOW;
>
> /* Shorten the copy to EOF */
> - size_in = i_size_read(inode_in);
> + size_in = i_size_read(file_in->f_mapping->host);
generic_copy_file_checks needs to be fixed to use ->mapping->host both
or inode_in and inode_out at the top of the file instead of this
band aid. And that needs to be a separate patch with a Fixes tag.
> @@ -1708,7 +1709,9 @@ int generic_file_rw_checks(struct file *file_in, struct file *file_out)
> /* Don't copy dirs, pipes, sockets... */
> if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
> return -EISDIR;
> - if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
> +
> + if ((!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode)) &&
> + (!S_ISBLK(inode_in->i_mode) || !S_ISBLK(inode_out->i_mode)))
This is using weird indentation, and might also not be doing
exactly what we want. I think the better thing to do here is to:
1) check for the accetable types only on the in inode
2) have a check that the mode matches for the in and out inodes
And please do this as a separate prep patch instead of hiding it here.
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Nitesh Shetty <nj.shetty@samsung.com>
Cc: Jens Axboe <axboe@kernel.dk>, Jonathan Corbet <corbet@lwn.net>,
Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
dm-devel@redhat.com, Keith Busch <kbusch@kernel.org>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
willy@infradead.org, hare@suse.de, djwong@kernel.org,
bvanassche@acm.org, ming.lei@redhat.com, dlemoal@kernel.org,
nitheshshetty@gmail.com, gost.dev@samsung.com,
Anuj Gupta <anuj20.g@samsung.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v13 4/9] fs, block: copy_file_range for def_blk_ops for direct block device
Date: Thu, 20 Jul 2023 09:57:10 +0200 [thread overview]
Message-ID: <20230720075710.GC5042@lst.de> (raw)
In-Reply-To: <20230627183629.26571-5-nj.shetty@samsung.com>
> +/* Copy source offset from source block device to destination block
> + * device. Returns the length of bytes copied.
> + */
> +ssize_t blkdev_copy_offload_failfast(
> + struct block_device *bdev_in, loff_t pos_in,
> + struct block_device *bdev_out, loff_t pos_out,
> + size_t len, gfp_t gfp_mask)
This is an odd and very misnamed interface.
Either we have a klkdev_copy() interface that automatically falls back
to a fallback (maybe with an opt-out), or we have separate
blkdev_copy_offload/blkdev_copy_emulated interface and let the caller
decide. But none of that really is "failfast".
Also this needs to go into the helpers patch and not a patch that is
supposed to just wire copying up for block device node.
> index b07de77ef126..d27148a2543f 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -1447,7 +1447,8 @@ static int generic_copy_file_checks(struct file *file_in, loff_t pos_in,
> return -EOVERFLOW;
>
> /* Shorten the copy to EOF */
> - size_in = i_size_read(inode_in);
> + size_in = i_size_read(file_in->f_mapping->host);
generic_copy_file_checks needs to be fixed to use ->mapping->host both
or inode_in and inode_out at the top of the file instead of this
band aid. And that needs to be a separate patch with a Fixes tag.
> @@ -1708,7 +1709,9 @@ int generic_file_rw_checks(struct file *file_in, struct file *file_out)
> /* Don't copy dirs, pipes, sockets... */
> if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
> return -EISDIR;
> - if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
> +
> + if ((!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode)) &&
> + (!S_ISBLK(inode_in->i_mode) || !S_ISBLK(inode_out->i_mode)))
This is using weird indentation, and might also not be doing
exactly what we want. I think the better thing to do here is to:
1) check for the accetable types only on the in inode
2) have a check that the mode matches for the in and out inodes
And please do this as a separate prep patch instead of hiding it here.
next prev parent reply other threads:[~2023-07-20 7:57 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230627183950epcas5p1b924785633509f612ffa5d9616bfe447@epcas5p1.samsung.com>
2023-06-27 18:36 ` [dm-devel] [PATCH v13 0/9] Implement copy offload support Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-27 18:36 ` [dm-devel] [PATCH v13 1/9] block: Introduce queue limits for copy-offload support Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-28 6:40 ` [dm-devel] " Damien Le Moal
2023-06-28 6:40 ` Damien Le Moal
2023-06-28 15:35 ` [dm-devel] " Nitesh Shetty
2023-06-28 15:35 ` Nitesh Shetty
2023-07-20 7:06 ` [dm-devel] " Christoph Hellwig
2023-07-20 7:06 ` Christoph Hellwig
2023-07-20 7:58 ` [dm-devel] " Christoph Hellwig
2023-07-20 7:58 ` Christoph Hellwig
2023-06-27 18:36 ` [dm-devel] [PATCH v13 2/9] block: Add copy offload support infrastructure Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-28 6:45 ` [dm-devel] " Damien Le Moal
2023-06-28 6:45 ` Damien Le Moal
2023-06-28 16:03 ` [dm-devel] " Nitesh Shetty
2023-06-28 16:03 ` Nitesh Shetty
2023-07-20 7:42 ` [dm-devel] " Christoph Hellwig
2023-07-20 7:42 ` Christoph Hellwig
2023-07-27 10:29 ` [dm-devel] " Nitesh Shetty
2023-07-27 10:29 ` Nitesh Shetty
2023-06-27 18:36 ` [dm-devel] [PATCH v13 3/9] block: add emulation for copy Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-28 6:50 ` [dm-devel] " Damien Le Moal
2023-06-28 6:50 ` Damien Le Moal
2023-06-28 16:10 ` [dm-devel] " Nitesh Shetty
2023-06-28 16:10 ` Nitesh Shetty
2023-06-29 8:33 ` [dm-devel] " Ming Lei
2023-06-29 8:33 ` Ming Lei
2023-06-30 11:22 ` [dm-devel] " Nitesh Shetty
2023-06-30 11:22 ` Nitesh Shetty
2023-07-20 7:50 ` [dm-devel] " Christoph Hellwig
2023-07-20 7:50 ` Christoph Hellwig
2023-08-01 13:07 ` [dm-devel] " Nitesh Shetty
2023-08-01 13:07 ` Nitesh Shetty
2023-08-02 6:31 ` [dm-devel] " Kent Overstreet
2023-08-02 6:31 ` Kent Overstreet
2023-06-27 18:36 ` [dm-devel] [PATCH v13 4/9] fs, block: copy_file_range for def_blk_ops for direct block device Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-28 6:51 ` [dm-devel] " Damien Le Moal
2023-06-28 6:51 ` Damien Le Moal
2023-06-28 16:39 ` [dm-devel] " Nitesh Shetty
2023-06-28 16:39 ` Nitesh Shetty
2023-07-20 7:57 ` Christoph Hellwig [this message]
2023-07-20 7:57 ` Christoph Hellwig
2023-07-24 5:46 ` [dm-devel] " Nitesh Shetty
2023-07-24 5:46 ` Nitesh Shetty
2023-06-27 18:36 ` [dm-devel] [PATCH v13 5/9] nvme: add copy offload support Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-07-20 8:00 ` [dm-devel] " Christoph Hellwig
2023-07-20 8:00 ` Christoph Hellwig
2023-06-27 18:36 ` [dm-devel] [PATCH v13 6/9] nvmet: add copy command support for bdev and file ns Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-27 18:36 ` [dm-devel] [PATCH v13 7/9] dm: Add support for copy offload Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-27 18:36 ` [dm-devel] [PATCH v13 8/9] dm: Enable copy offload for dm-linear target Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-27 18:36 ` [dm-devel] [PATCH v13 9/9] null_blk: add support for copy offload Nitesh Shetty
2023-06-27 18:36 ` Nitesh Shetty
2023-06-28 12:11 ` [dm-devel] " kernel test robot
2023-06-28 12:11 ` kernel test robot
2023-06-28 12:52 ` [dm-devel] " kernel test robot
2023-06-28 12:52 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230720075710.GC5042@lst.de \
--to=hch@lst.de \
--cc=agk@redhat.com \
--cc=anuj20.g@samsung.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=bvanassche@acm.org \
--cc=corbet@lwn.net \
--cc=djwong@kernel.org \
--cc=dlemoal@kernel.org \
--cc=dm-devel@redhat.com \
--cc=gost.dev@samsung.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=nitheshshetty@gmail.com \
--cc=nj.shetty@samsung.com \
--cc=sagi@grimberg.me \
--cc=snitzer@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.