-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NAS-129309 / None / Copy offload support for block devices #203
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add device limits as sysfs entries, - copy_max_bytes (RW) - copy_max_hw_bytes (RO) Above limits help to split the copy payload in block layer. copy_max_bytes: maximum total length of copy in single payload. copy_max_hw_bytes: Reflects the device supported maximum limit. Signed-off-by: Nitesh Shetty <[email protected]> Signed-off-by: Kanchan Joshi <[email protected]> Signed-off-by: Anuj Gupta <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
We add two new opcode REQ_OP_COPY_DST, REQ_OP_COPY_SRC. Since copy is a composite operation involving src and dst sectors/lba, each needs to be represented by a separate bio to make it compatible with device mapper. We expect caller to take a plug and send bio with destination information, followed by bio with source information. Once the dst bio arrives we form a request and wait for source bio. Upon arrival of source bio we merge these two bio's and send corresponding request down to device driver. Merging non copy offload bio is avoided by checking for copy specific opcodes in merge function. Signed-off-by: Nitesh Shetty <[email protected]> Signed-off-by: Anuj Gupta <[email protected]>
Introduce blkdev_copy_offload to perform copy offload. Issue REQ_OP_COPY_DST with destination info along with taking a plug. This flows till request layer and waits for src bio to arrive. Issue REQ_OP_COPY_SRC with source info and this bio reaches request layer and merges with dst request. For any reason, if a request comes to the driver with only one of src/dst bio, we fail the copy offload. Larger copy will be divided, based on max_copy_sectors limit. Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Anuj Gupta <[email protected]> Signed-off-by: Nitesh Shetty <[email protected]>
This is a prep patch. Allow copy_file_range to work for block devices. Relaxing generic_copy_file_checks allows us to reuse the existing infra, instead of adding a new user interface for block copy offload. Change generic_copy_file_checks to use ->f_mapping->host for both inode_in and inode_out. Allow block device in generic_file_rw_checks. Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Anuj Gupta <[email protected]> Signed-off-by: Nitesh Shetty <[email protected]>
For direct block device opened with O_DIRECT, use blkdev_copy_offload to issue device copy offload, or use splice_copy_file_range in case device copy offload capability is absent or the device files are not open with O_DIRECT. Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Anuj Gupta <[email protected]> Signed-off-by: Nitesh Shetty <[email protected]>
This was referenced Dec 18, 2024
bugclerk
changed the title
Copy offload support for block devices
NAS-129309 / None / Copy offload support for block devices
Dec 18, 2024
amotin
reviewed
Dec 18, 2024
ixhamza
force-pushed
the
NAS-129309
branch
2 times, most recently
from
December 18, 2024 15:39
500c6ff
to
9236ab0
Compare
amotin
approved these changes
Dec 18, 2024
usaleem-ix
approved these changes
Dec 18, 2024
bmeagherix
approved these changes
Dec 18, 2024
ixhamza
force-pushed
the
NAS-129309
branch
2 times, most recently
from
December 19, 2024 18:08
124d7bc
to
dd5ffc3
Compare
Signed-off-by: Ameer Hamza <[email protected]>
Not updating JIRA ticket https://ixsystems.atlassian.net/browse/NAS-129309 target versions as no JIRA version corresponds to this PR |
This PR has been merged and conversations have been locked. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces partial upstream support for copy offload functionality to make zvol block cloning functional. In addition, we have implemented support for single-queue and cross-device copy, which are currently not supported by the upstream patch.
Related Patches
How Has This Been Tested?