mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[LogFS] Fix bdev erases
Erases for block devices were always just emulated by writing 0xff. Some time back the write was removed and only the page cache was changed to 0xff. Superficialy a good idea with two problems: 1. Touching the page cache isn't necessary either. 2. However, writing out 0xff _is_ necessary for the journal. As the journal is scanned linearly, an old non-overwritten commit entry can be used on next mount and cause havoc. This should fix both aspects.
This commit is contained in:
parent
5c564c2a04
commit
9421502b4f
6 changed files with 97 additions and 20 deletions
|
@ -25,14 +25,14 @@ static int logfs_mark_segment_bad(struct super_block *sb, u32 segno)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int logfs_erase_segment(struct super_block *sb, u32 segno)
|
||||
int logfs_erase_segment(struct super_block *sb, u32 segno, int ensure_erase)
|
||||
{
|
||||
struct logfs_super *super = logfs_super(sb);
|
||||
|
||||
super->s_gec++;
|
||||
|
||||
return super->s_devops->erase(sb, (u64)segno << super->s_segshift,
|
||||
super->s_segsize);
|
||||
super->s_segsize, ensure_erase);
|
||||
}
|
||||
|
||||
static s64 logfs_get_free_bytes(struct logfs_area *area, size_t bytes)
|
||||
|
@ -798,7 +798,7 @@ static int ostore_erase_segment(struct logfs_area *area)
|
|||
u64 ofs;
|
||||
int err;
|
||||
|
||||
err = logfs_erase_segment(sb, area->a_segno);
|
||||
err = logfs_erase_segment(sb, area->a_segno, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue