Commit 34310c4
btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)
Add an io_uring command for encoded reads, using the same interface as
the existing BTRFS_IOC_ENCODED_READ ioctl.
btrfs_uring_encoded_read() is an io_uring version of
btrfs_ioctl_encoded_read(), which validates the user input and calls
btrfs_encoded_read() to read the appropriate metadata. If we determine
that we need to read an extent from disk, we call
btrfs_encoded_read_regular_fill_pages() through
btrfs_uring_read_extent() to prepare the bio.
The existing btrfs_encoded_read_regular_fill_pages() is changed so that
if it is passed a valid uring_ctx, rather than waking up any waiting
threads it calls btrfs_uring_read_extent_endio(). This in turn copies
the read data back to userspace, and calls io_uring_cmd_done() to
complete the io_uring command.
Because we're potentially doing a non-blocking read,
btrfs_uring_read_extent() doesn't clean up after itself if it returns
-EIOCBQUEUED. Instead, it allocates a priv struct, populates the fields
there that we will need to unlock the inode and free our allocations,
and defers this to the btrfs_uring_read_finished() that gets called when
the bio completes.
Signed-off-by: Mark Harmstone <maharmstone@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 68d3b27 commit 34310c4
6 files changed
+339
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
616 | | - | |
| 616 | + | |
617 | 617 | | |
618 | 618 | | |
619 | 619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3710 | 3710 | | |
3711 | 3711 | | |
3712 | 3712 | | |
| 3713 | + | |
3713 | 3714 | | |
3714 | 3715 | | |
3715 | 3716 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9056 | 9056 | | |
9057 | 9057 | | |
9058 | 9058 | | |
| 9059 | + | |
9059 | 9060 | | |
9060 | 9061 | | |
9061 | 9062 | | |
| |||
9075 | 9076 | | |
9076 | 9077 | | |
9077 | 9078 | | |
9078 | | - | |
9079 | | - | |
| 9079 | + | |
| 9080 | + | |
| 9081 | + | |
| 9082 | + | |
| 9083 | + | |
| 9084 | + | |
| 9085 | + | |
| 9086 | + | |
| 9087 | + | |
| 9088 | + | |
9080 | 9089 | | |
9081 | 9090 | | |
9082 | 9091 | | |
9083 | 9092 | | |
9084 | 9093 | | |
9085 | | - | |
| 9094 | + | |
9086 | 9095 | | |
9087 | 9096 | | |
9088 | 9097 | | |
| |||
9097 | 9106 | | |
9098 | 9107 | | |
9099 | 9108 | | |
| 9109 | + | |
9100 | 9110 | | |
9101 | 9111 | | |
9102 | 9112 | | |
| |||
9125 | 9135 | | |
9126 | 9136 | | |
9127 | 9137 | | |
9128 | | - | |
9129 | | - | |
9130 | | - | |
9131 | | - | |
9132 | | - | |
9133 | | - | |
| 9138 | + | |
| 9139 | + | |
| 9140 | + | |
| 9141 | + | |
| 9142 | + | |
| 9143 | + | |
| 9144 | + | |
| 9145 | + | |
| 9146 | + | |
| 9147 | + | |
| 9148 | + | |
| 9149 | + | |
| 9150 | + | |
| 9151 | + | |
| 9152 | + | |
| 9153 | + | |
| 9154 | + | |
9134 | 9155 | | |
9135 | 9156 | | |
9136 | 9157 | | |
| |||
9158 | 9179 | | |
9159 | 9180 | | |
9160 | 9181 | | |
9161 | | - | |
| 9182 | + | |
9162 | 9183 | | |
9163 | 9184 | | |
9164 | 9185 | | |
| |||
0 commit comments