[Devel] [PATCH RHEL7 COMMIT] ploop: fix iblk-to-sector calculations

Konstantin Khorenko khorenko at odin.com
Mon May 18 21:26:59 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 96f009d1061c9e1ec9b6c7699eef565bcd44f26a
Author: Andrey Smetanin <asmetanin at virtuozzo.com>
Date:   Tue May 19 08:26:59 2015 +0400

    ploop: fix iblk-to-sector calculations
    
    iblk stands for image-file block number. Its size is the same as u32. The size
    of 'sector' is the same as long. While converting the former to the latter
    like this: sec = iblk << shift, we must always cast 'iblk' to long. And we
    actually do in most cases. The patch fixes a place in io_direct module where
    it was forgotten.
    
    https://jira.sw.ru/browse/PSBM-22961
    
    Signed-off-by: Maxim Patlasov <MPatlasov at parallels.com>
---
 drivers/block/ploop/io_direct.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index ab74849..56b9f37 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -119,8 +119,8 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
 		goto out_em_err;
 
 	if (write && em->block_start == BLOCK_UNINIT) {
-		sector_t end = (iblk + 1) << preq->plo->cluster_log;
-		sec = iblk << preq->plo->cluster_log;
+		sector_t end = (sector_t)(iblk + 1) << preq->plo->cluster_log;
+		sec = (sector_t)iblk << preq->plo->cluster_log;
 
 		if (em->start <= sec)
 			sec = em->end;



More information about the Devel mailing list