f2fs: support revoking atomic written pages

f2fs support atomic write with following semantics:
1. open db file
2. ioctl start atomic write
3. (write db file) * n
4. ioctl commit atomic write
5. close db file

With this flow we can avoid file becoming corrupted when abnormal power
cut, because we hold data of transaction in referenced pages linked in
inmem_pages list of inode, but without setting them dirty, so these data
won't be persisted unless we commit them in step 4.

But we should still hold journal db file in memory by using volatile
write, because our semantics of 'atomic write support' is incomplete, in
step 4, we could fail to submit all dirty data of transaction, once
partial dirty data was committed in storage, then after a checkpoint &
abnormal power-cut, db file will be corrupted forever.

So this patch tries to improve atomic write flow by adding a revoking flow,
once inner error occurs in committing, this gives another chance to try to
revoke these partial submitted data of current transaction, it makes
committing operation more like aotmical one.

If we're not lucky, once revoking operation was failed, EAGAIN will be
reported to user for suggesting doing the recovery with held journal file,
or retrying current transaction again.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
此提交包含在:
Chao Yu
2016-02-06 14:40:34 +08:00
提交者 Jaegeuk Kim
父節點 29b96b547e
當前提交 28bc106b23
共有 7 個檔案被更改,包括 93 行新增36 行删除

查看文件

@@ -1072,6 +1072,7 @@ int do_write_data_page(struct f2fs_io_info *fio)
return err;
fio->blk_addr = dn.data_blkaddr;
fio->old_blkaddr = dn.data_blkaddr;
/* This page is already truncated */
if (fio->blk_addr == NULL_ADDR) {