[Ocfs2-tools-devel] [PATCH 2/2] Modify the check in
io_cache_disconnect, take 2
Tao Ma
tao.ma at oracle.com
Tue Oct 23 18:15:49 PDT 2007
In the io_cache rb-tree, we may want to erase a cached block
which is the root of the whole tree. In this scenario, the rb_parent
will be NULL. So this io_cache will not be removed by the original
io_cache_disconnect and lead to the "assert" problem when we try
io_cache_insert by using the same icb.
Instead, the icb->icb_blkno will be checked when we want to remove
the specified io_cache. The icb->icb_blkno is set to to UINT64_MAX
when it is removed and we also initialize it to UINT64_MAX in
io_init_cache.
Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
libocfs2/unix_io.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libocfs2/unix_io.c b/libocfs2/unix_io.c
index 65f2791..d453471 100644
--- a/libocfs2/unix_io.c
+++ b/libocfs2/unix_io.c
@@ -217,11 +217,12 @@ static void io_cache_disconnect(struct io_cache *ic,
{
/*
* This icb should longer be looked up.
- * If rb_parent is NULL, it's already disconnected.
+ * If icb->icb_blkno is UINT64_MAX, it's already disconnected.
*/
- if (icb->icb_node.rb_parent) {
+ if (icb->icb_blkno != UINT64_MAX) {
rb_erase(&icb->icb_node, &ic->ic_lookup);
memset(&icb->icb_node, 0, sizeof(struct rb_node));
+ icb->icb_blkno = UINT64_MAX;
}
}
@@ -375,6 +376,7 @@ errcode_t io_init_cache(io_channel *channel, size_t nr_blocks)
icb_list = ic->ic_metadata_buffer;
dbuf = ic->ic_data_buffer;
for (i = 0; i < nr_blocks; i++) {
+ icb_list[i].icb_blkno = UINT64_MAX;
icb_list[i].icb_buf = dbuf;
dbuf += channel->io_blksize;
list_add_tail(&icb_list[i].icb_list, &ic->ic_lru);
--
1.5.3.2.g4f337
More information about the Ocfs2-tools-devel
mailing list