[Devel] [PATCH RHEL7 COMMIT] ploop: support 4K block-size of host block-device
Konstantin Khorenko
khorenko at odin.com
Mon May 18 21:27:01 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.1
------>
commit 5e02bd5942dd5cfd66f5b4096e966ae9b134b5ea
Author: Andrey Smetanin <asmetanin at virtuozzo.com>
Date: Tue May 19 08:27:01 2015 +0400
ploop: support 4K block-size of host block-device
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;
More information about the Devel
mailing list