Patch 1 changes UBIblock to use a copy of scsi_kmap_atomic_sg()
for sg list processing. This patch is meant for backporting to stable.
It makes use of kmap_atomic() and a bounce buffer because MTD/UBI IO
can sleep.
Patches 2 to 7 move scsi_kmap_atomic_sg() into lib/scatterlist.c,
convert it to kmap_local(), convert all users to it and remove the
bounce buffer from UBIblock again.
Richard Weinberger (7):
ubi: block: Refactor sg list processing for highmem
scatterlist: Add kmap helpers
scsi: dc395x: Switch to kmap_sg
scsi: esp_scsi: Switch to kmap_sg
scsi: fdomain: Switch to kmap_sg
ubi: block: Switch to kmap_sg
scsi: core: Remove scsi_kmap_atomic_sg()
drivers/mtd/ubi/block.c | 11 +++----
drivers/mtd/ubi/eba.c | 50 +++++++++++++------------------
drivers/scsi/dc395x.c | 12 ++++----
drivers/scsi/esp_scsi.c | 4 +--
drivers/scsi/fdomain.c | 10 +++----
drivers/scsi/scsi_lib.c | 60 -------------------------------------
include/linux/mtd/ubi.h | 12 ++++----
include/linux/scatterlist.h | 3 ++
include/scsi/scsi_cmnd.h | 4 ---
lib/scatterlist.c | 55 ++++++++++++++++++++++++++++++++++
10 files changed, 100 insertions(+), 121 deletions(-)
--
2.35.3
Switch to our new helper from scatterlist lib.
No functional change, the mapped region is still used in atomic
context.
Signed-off-by: Richard Weinberger <[email protected]>
---
drivers/scsi/esp_scsi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 97816a0e6240a..10d2fcf65f28a 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -1355,11 +1355,11 @@ static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent,
struct esp_cmd_priv *p = ESP_CMD_PRIV(cmd);
u8 *ptr;
- ptr = scsi_kmap_atomic_sg(p->cur_sg, p->num_sg,
+ ptr = kmap_sg(p->cur_sg, p->num_sg,
&offset, &count);
if (likely(ptr)) {
*(ptr + offset) = bval;
- scsi_kunmap_atomic_sg(ptr);
+ kunmap_sg(ptr);
}
}
bytes_sent += fifo_cnt;
--
2.35.3
Hi Richard,
[email protected] wrote on Thu, 10 Aug 2023 18:00:11 +0200:
> Patch 1 changes UBIblock to use a copy of scsi_kmap_atomic_sg()
> for sg list processing. This patch is meant for backporting to stable.
> It makes use of kmap_atomic() and a bounce buffer because MTD/UBI IO
> can sleep.
>
> Patches 2 to 7 move scsi_kmap_atomic_sg() into lib/scatterlist.c,
> convert it to kmap_local(), convert all users to it and remove the
> bounce buffer from UBIblock again.
Both the idea and the implementation look nice, I don't feel skilled
enough for sending Reviewed-by here, but it seems okay at a first
glance.
Well done Richard :-)
Miquèl