summaryrefslogtreecommitdiff
path: root/src/ext4_bcache.c
diff options
context:
space:
mode:
authorKaho Ng <ngkaho1234@gmail.com>2016-04-27 19:11:31 +0800
committerKaho Ng <ngkaho1234@gmail.com>2016-04-30 16:18:00 +0800
commit8281a97813ef19452be1ce6ec1a6c40e483f12f1 (patch)
tree46fe725d3b7de77cc98268b2d571a6fa45f37550 /src/ext4_bcache.c
parent2a5abdbf8c1375f83edde31831cd8b0bb36bc6d8 (diff)
ext4_journal: numorous changes.
- Do not utilize jbd_block_rec::buf because it can be unreliable that jbd_block_rec::buf may be freed. - Do not need to flush buffers before a new transaction is going to reference them. - add some comments to the changes.
Diffstat (limited to 'src/ext4_bcache.c')
-rw-r--r--src/ext4_bcache.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/ext4_bcache.c b/src/ext4_bcache.c
index 1a1766a..e1e3b0c 100644
--- a/src/ext4_bcache.c
+++ b/src/ext4_bcache.c
@@ -177,6 +177,19 @@ void ext4_bcache_drop_buf(struct ext4_bcache *bc, struct ext4_buf *buf)
bc->ref_blocks--;
}
+void ext4_bcache_invalidate_buf(struct ext4_bcache *bc,
+ struct ext4_buf *buf)
+{
+ buf->end_write = NULL;
+ buf->end_write_arg = NULL;
+
+ /* Clear both dirty and up-to-date flags. */
+ if (ext4_bcache_test_flag(buf, BC_DIRTY))
+ ext4_bcache_remove_dirty_node(bc, buf);
+
+ ext4_bcache_clear_dirty(buf);
+}
+
void ext4_bcache_invalidate_lba(struct ext4_bcache *bc,
uint64_t from,
uint32_t cnt)
@@ -187,13 +200,7 @@ void ext4_bcache_invalidate_lba(struct ext4_bcache *bc,
if (buf->lba > end)
break;
- /* Clear both dirty and up-to-date flags. */
- if (ext4_bcache_test_flag(buf, BC_DIRTY))
- ext4_bcache_remove_dirty_node(bc, buf);
-
- buf->end_write = NULL;
- buf->end_write_arg = NULL;
- ext4_bcache_clear_dirty(buf);
+ ext4_bcache_invalidate_buf(bc, buf);
}
}