Skip to contentSkip to conversation

parallels: dirty BAT properly for continuous allocations

PATCH Applied Denis V. Lunev 2 participants 3 messages Nov 17, 2015 – Nov 23, 2015 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parallels: dirty BAT properly for continuous allocations

From: Vladimir Sementsov-Ogievskiy <[email protected]>

This patch marks part of the BAT dirty properly. There is a possibility that multy-block allocation could have one block allocated on one BAT page and next block on the next page. The code without the patch could not save updated position to the file.

---
 block/parallels.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/parallels.c +1 -1
index 4f79293..f689fde 100644
@@ -220,7 +220,7 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
         s->bat_bitmap[idx + i] = cpu_to_le32(s->data_end / s->off_multiplier);
         s->data_end += s->tracks;
         bitmap_set(s->bat_dirty_bmap,
-                   bat_entry_off(idx) / s->bat_dirty_block, 1);
+                   bat_entry_off(idx + i) / s->bat_dirty_block, 1);
     }
 
     return bat2sect(s, idx) + sector_num % s->tracks;
Signature · 1 line
2.1.4
#1 lore raw
Quoted 19 lines · Denis V. Lunev

From: Vladimir Sementsov-Ogievskiy <[email protected]>

This patch marks part of the BAT dirty properly. There is a possibility that multy-block allocation could have one block allocated on one BAT page and next block on the next page. The code without the patch could not save updated position to the file.

---
  block/parallels.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
block/parallels.c +0 -0
index 4f79293..f689fde 100644

block/parallels.c static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num, · line 226

Quoted 8 lines
block/parallels.c +1 -1
@@ -220,7 +220,7 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
          s->bat_bitmap[idx + i] = cpu_to_le32(s->data_end / s->off_multiplier);
          s->data_end += s->tracks;
          bitmap_set(s->bat_dirty_bmap,
-                   bat_entry_off(idx) / s->bat_dirty_block, 1);
+                   bat_entry_off(idx + i) / s->bat_dirty_block, 1);
      }
 
      return bat2sect(s, idx) + sector_num % s->tracks;

Stefan,

how should we proceed with this? Should I send this as a pull request or you could take this yourself?

Den

#2 lore raw
In reply to Denis V. Lunev
Quoted 7 lines · Denis V. Lunev

From: Vladimir Sementsov-Ogievskiy <[email protected]>

This patch marks part of the BAT dirty properly. There is a possibility that multy-block allocation could have one block allocated on one BAT page and next block on the next page. The code without the patch could not save updated position to the file.

Quoted 6 lines
---
 block/parallels.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan