projects
/
lwext4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ext4_journal: two changes below.
[lwext4.git]
/
lwext4
/
ext4_bcache.c
diff --git
a/lwext4/ext4_bcache.c
b/lwext4/ext4_bcache.c
index a8b1855ccda08ac88d4501559a6907d02909e3ca..1a1766ac4ab978339e5e9e95a9d3c14d4bc64e17 100644
(file)
--- a/
lwext4/ext4_bcache.c
+++ b/
lwext4/ext4_bcache.c
@@
-132,6
+132,7
@@
ext4_buf_alloc(struct ext4_bcache *bc, uint64_t lba)
buf->lba = lba;
buf->data = data;
buf->lba = lba;
buf->data = data;
+ buf->bc = bc;
return buf;
}
return buf;
}
@@
-163,10
+164,10
@@
void ext4_bcache_drop_buf(struct ext4_bcache *bc, struct ext4_buf *buf)
ext4_dbg(DEBUG_BCACHE, DBG_WARN "Buffer is still referenced. "
"lba: %" PRIu64 ", refctr: %" PRIu32 "\n",
buf->lba, buf->refctr);
ext4_dbg(DEBUG_BCACHE, DBG_WARN "Buffer is still referenced. "
"lba: %" PRIu64 ", refctr: %" PRIu32 "\n",
buf->lba, buf->refctr);
- }
+ } else
+ RB_REMOVE(ext4_buf_lru, &bc->lru_root, buf);
RB_REMOVE(ext4_buf_lba, &bc->lba_root, buf);
RB_REMOVE(ext4_buf_lba, &bc->lba_root, buf);
- RB_REMOVE(ext4_buf_lru, &bc->lru_root, buf);
/*Forcibly drop dirty buffer.*/
if (ext4_bcache_test_flag(buf, BC_DIRTY))
/*Forcibly drop dirty buffer.*/
if (ext4_bcache_test_flag(buf, BC_DIRTY))
@@
-190,6
+191,8
@@
void ext4_bcache_invalidate_lba(struct ext4_bcache *bc,
if (ext4_bcache_test_flag(buf, BC_DIRTY))
ext4_bcache_remove_dirty_node(bc, buf);
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_clear_dirty(buf);
}
}
@@
-213,6
+216,7
@@
ext4_bcache_find_get(struct ext4_bcache *bc, struct ext4_block *b,
ext4_bcache_inc_ref(buf);
ext4_bcache_inc_ref(buf);
+ b->lb_id = lba;
b->buf = buf;
b->data = buf->data;
}
b->buf = buf;
b->data = buf->data;
}
@@
-238,6
+242,11
@@
int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b,
/* One more buffer in bcache now. :-) */
bc->ref_blocks++;
/* One more buffer in bcache now. :-) */
bc->ref_blocks++;
+ /*Calc ref blocks max depth*/
+ if (bc->max_ref_blocks < bc->ref_blocks)
+ bc->max_ref_blocks = bc->ref_blocks;
+
+
ext4_bcache_inc_ref(buf);
/* Assign new value to LRU id and increment LRU counter
* by 1*/
ext4_bcache_inc_ref(buf);
/* Assign new value to LRU id and increment LRU counter
* by 1*/
@@
-275,7
+284,8
@@
int ext4_bcache_free(struct ext4_bcache *bc, struct ext4_block *b)
if (ext4_bcache_test_flag(buf, BC_DIRTY) &&
ext4_bcache_test_flag(buf, BC_UPTODATE)) {
if (bc->bdev->cache_write_back &&
if (ext4_bcache_test_flag(buf, BC_DIRTY) &&
ext4_bcache_test_flag(buf, BC_UPTODATE)) {
if (bc->bdev->cache_write_back &&
- !ext4_bcache_test_flag(buf, BC_FLUSH))
+ !ext4_bcache_test_flag(buf, BC_FLUSH) &&
+ !ext4_bcache_test_flag(buf, BC_TMP))
ext4_bcache_insert_dirty_node(bc, buf);
else {
ext4_block_flush_buf(bc->bdev, buf);
ext4_bcache_insert_dirty_node(bc, buf);
else {
ext4_block_flush_buf(bc->bdev, buf);
@@
-284,7
+294,8
@@
int ext4_bcache_free(struct ext4_bcache *bc, struct ext4_block *b)
}
/* The buffer is invalidated...drop it. */
}
/* The buffer is invalidated...drop it. */
- if (!ext4_bcache_test_flag(buf, BC_UPTODATE))
+ if (!ext4_bcache_test_flag(buf, BC_UPTODATE) ||
+ ext4_bcache_test_flag(buf, BC_TMP))
ext4_bcache_drop_buf(bc, buf);
}
ext4_bcache_drop_buf(bc, buf);
}