Commit 0a9beaf
ublk: refactor auto buffer register in ublk_dispatch_req()
Refactor auto buffer register code and prepare for supporting batch IO
feature, and the main motivation is to put 'ublk_io' operation code
together, so that per-io lock can be applied for the code block.
The key changes are:
- Rename ublk_auto_buf_reg() as ublk_do_auto_buf_reg()
- Introduce an enum `auto_buf_reg_res` to represent the result of
the buffer registration attempt (FAIL, FALLBACK, OK).
- Split the existing `ublk_do_auto_buf_reg` function into two:
- `__ublk_do_auto_buf_reg`: Performs the actual buffer registration
and returns the `auto_buf_reg_res` status.
- `ublk_do_auto_buf_reg`: A wrapper that calls the internal function
and handles the I/O preparation based on the result.
- Introduce `ublk_prep_auto_buf_reg_io` to encapsulate the logic for
preparing the I/O for completion after buffer registration.
- Pass the `tag` directly to `ublk_auto_buf_reg_fallback` to avoid
recalculating it.
This refactoring makes the control flow clearer and isolates the different
stages of the auto buffer registration process.
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 8d61ece commit 0a9beaf
1 file changed
Lines changed: 43 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1168 | 1168 | | |
1169 | 1169 | | |
1170 | 1170 | | |
1171 | | - | |
| 1171 | + | |
1172 | 1172 | | |
1173 | | - | |
1174 | 1173 | | |
1175 | 1174 | | |
1176 | 1175 | | |
1177 | 1176 | | |
1178 | 1177 | | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
1182 | 1202 | | |
1183 | 1203 | | |
1184 | 1204 | | |
1185 | 1205 | | |
1186 | 1206 | | |
1187 | 1207 | | |
1188 | 1208 | | |
1189 | | - | |
1190 | | - | |
| 1209 | + | |
| 1210 | + | |
1191 | 1211 | | |
1192 | 1212 | | |
1193 | | - | |
| 1213 | + | |
1194 | 1214 | | |
1195 | 1215 | | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
| 1216 | + | |
1200 | 1217 | | |
1201 | 1218 | | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
1206 | 1222 | | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
| 1223 | + | |
| 1224 | + | |
1210 | 1225 | | |
1211 | | - | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
1212 | 1230 | | |
1213 | 1231 | | |
1214 | 1232 | | |
| |||
1281 | 1299 | | |
1282 | 1300 | | |
1283 | 1301 | | |
1284 | | - | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
1285 | 1306 | | |
| 1307 | + | |
1286 | 1308 | | |
1287 | 1309 | | |
1288 | 1310 | | |
| |||
0 commit comments