ref: 06c35f48e36de717fd16e720705cdbbfac3a842a
parent: 9e8466622a31fed8113e9a01969f01a850f92cea
author: gkostka <kostka.grzegorz@gmail.com>
date: Mon Dec 7 16:52:22 EST 2015
Add ph_blk_offset during every blockdev bread/bwrite
--- a/lwext4/ext4_blockdev.c
+++ b/lwext4/ext4_blockdev.c
@@ -212,6 +212,7 @@
ext4_assert(bdev && buf);
pba = (lba * bdev->lg_bsize) / bdev->bdif->ph_bsize;
+ pba += bdev->ph_blk_offset;
pb_cnt = bdev->lg_bsize / bdev->bdif->ph_bsize;
bdev->bread_ctr++;
@@ -227,6 +228,7 @@
ext4_assert(bdev && buf);
pba = (lba * bdev->lg_bsize) / bdev->bdif->ph_bsize;
+ pba += bdev->ph_blk_offset;
pb_cnt = bdev->lg_bsize / bdev->bdif->ph_bsize;
bdev->bwrite_ctr++;
@@ -250,7 +252,7 @@
if (!(bdev->bdif->ph_flags & EXT4_BDEV_INITIALIZED))
return EIO;
- block_idx = off / bdev->bdif->ph_bsize;
+ block_idx = (off / bdev->bdif->ph_bsize) + bdev->ph_blk_offset;
block_end = block_idx + len / bdev->bdif->ph_bsize;
if (!(block_end < bdev->bdif->ph_bcnt))
@@ -322,7 +324,7 @@
if (!(bdev->bdif->ph_flags & EXT4_BDEV_INITIALIZED))
return EIO;
- block_idx = off / bdev->bdif->ph_bsize;
+ block_idx = (off / bdev->bdif->ph_bsize) + bdev->ph_blk_offset;
block_end = block_idx + len / bdev->bdif->ph_bsize;
if (!(block_end < bdev->bdif->ph_bcnt))