[Devel] [PATCH rh7 12/38] ploop: support 4K block-size of host block-device
Andrey Smetanin
asmetanin at virtuozzo.com
Fri May 15 09:48:13 PDT 2015
Avoid 512-bytes reads/writes. They were used by 'expanded' format module
to get and save format header. Let's use 4K reads/writes instead.
Customer's problem:
> [root at pcstest10 ~]# ploop mount /vz3/test.hdd
> add delta dev=/dev/ploop19025 img=/vz3/test.hdd (rw)
> Can't add image /vz3/test.hdd: Input/output error
> [root at pcstest10 ~]#
>
> Right after trying to mount the image the kernel throws the following:
>
> [1564044.775584] sd 13:0:0:0: [sde] Bad block number requested
>
> The block size of this device is not 512 as for other direct attached
> disks. It is 4096 and the device is an iSCSI target.
https://jira.sw.ru/browse/PSBM-21989
Signed-off-by: Maxim Patlasov <MPatlasov at parallels.com>
---
drivers/block/ploop/fmt_ploop1.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index fb12c30..5ce6915 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -78,7 +78,7 @@ static int ploop1_stop(struct ploop_delta * delta)
vh = (struct ploop_pvd_header *)page_address(ph->dyn_page);
- err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -90,7 +90,7 @@ static int ploop1_stop(struct ploop_delta * delta)
vh->m_DiskInUse = 0;
- err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -128,7 +128,7 @@ ploop1_open(struct ploop_delta * delta)
goto out_err;
/* IO engine is ready. */
- err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
goto out_err;
@@ -168,7 +168,7 @@ ploop1_open(struct ploop_delta * delta)
if (!(delta->flags & PLOOP_FMT_RDONLY)) {
vh->m_DiskInUse = cpu_to_le32(SIGNATURE_DISK_IN_USE);
- err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
goto out_err;
}
@@ -198,7 +198,7 @@ ploop1_refresh(struct ploop_delta * delta)
vh = (struct ploop_pvd_header *)page_address(ph->dyn_page);
- err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -266,7 +266,7 @@ ploop1_sync(struct ploop_delta * delta)
if (err)
return err;
- err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -279,7 +279,7 @@ ploop1_sync(struct ploop_delta * delta)
vh->m_Flags = cpu_to_le32(vh->m_Flags);
}
- err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -312,7 +312,7 @@ ploop1_complete_snapshot(struct ploop_delta * delta, struct ploop_snapdata * sd)
if (err)
goto out;
- err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
goto out;
@@ -335,7 +335,7 @@ ploop1_complete_snapshot(struct ploop_delta * delta, struct ploop_snapdata * sd)
* remain valid.
*/
- err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
goto out;
@@ -367,7 +367,7 @@ ploop1_prepare_merge(struct ploop_delta * delta, struct ploop_snapdata * sd)
vh = (struct ploop_pvd_header *)page_address(ph->dyn_page);
- err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -403,7 +403,7 @@ ploop1_start_merge(struct ploop_delta * delta, struct ploop_snapdata * sd)
return -EIO;
}
- err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -413,7 +413,7 @@ ploop1_start_merge(struct ploop_delta * delta, struct ploop_snapdata * sd)
/* keep hdr in ph->dyn_page and in map_node in sync */
ploop_update_map_hdr(&delta->plo->map, (u8 *)vh, sizeof(*vh));
- err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -505,7 +505,7 @@ static int ploop1_complete_grow(struct ploop_delta * delta, u64 new_size)
if (err)
return err;
- err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_read(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
@@ -531,7 +531,7 @@ static int ploop1_complete_grow(struct ploop_delta * delta, u64 new_size)
/* keep hdr in ph->dyn_page and in map_node in sync */
ploop_update_map_hdr(&delta->plo->map, (u8 *)vh, sizeof(*vh));
- err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 512, 0, 0);
+ err = delta->io.ops->sync_write(&delta->io, ph->dyn_page, 4096, 0, 0);
if (err)
return err;
--
1.9.3
More information about the Devel
mailing list