summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/f2fs.h
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2016-02-06 01:40:34 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2016-02-22 19:07:23 -0500
commit28bc106b2346a7348706bf86d9efbe31920c69f3 (patch)
tree52439e8fcc8df448a1065094f1aac10c90d1c49d /fs/f2fs/f2fs.h
parent29b96b547e90f6a774d669348d8db2c35149f6f3 (diff)
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>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index d8caf0c86593..0d2b1ba9660e 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -686,6 +686,7 @@ enum page_type {
686 META_FLUSH, 686 META_FLUSH,
687 INMEM, /* the below types are used by tracepoints only. */ 687 INMEM, /* the below types are used by tracepoints only. */
688 INMEM_DROP, 688 INMEM_DROP,
689 INMEM_REVOKE,
689 IPU, 690 IPU,
690 OPU, 691 OPU,
691}; 692};
@@ -695,6 +696,7 @@ struct f2fs_io_info {
695 enum page_type type; /* contains DATA/NODE/META/META_FLUSH */ 696 enum page_type type; /* contains DATA/NODE/META/META_FLUSH */
696 int rw; /* contains R/RS/W/WS with REQ_META/REQ_PRIO */ 697 int rw; /* contains R/RS/W/WS with REQ_META/REQ_PRIO */
697 block_t blk_addr; /* block address to be written */ 698 block_t blk_addr; /* block address to be written */
699 block_t old_blkaddr; /* old block address before Cow */
698 struct page *page; /* page to be written */ 700 struct page *page; /* page to be written */
699 struct page *encrypted_page; /* encrypted page */ 701 struct page *encrypted_page; /* encrypted page */
700}; 702};
@@ -1853,7 +1855,7 @@ void write_node_page(unsigned int, struct f2fs_io_info *);
1853void write_data_page(struct dnode_of_data *, struct f2fs_io_info *); 1855void write_data_page(struct dnode_of_data *, struct f2fs_io_info *);
1854void rewrite_data_page(struct f2fs_io_info *); 1856void rewrite_data_page(struct f2fs_io_info *);
1855void f2fs_replace_block(struct f2fs_sb_info *, struct dnode_of_data *, 1857void f2fs_replace_block(struct f2fs_sb_info *, struct dnode_of_data *,
1856 block_t, block_t, unsigned char, bool); 1858 block_t, block_t, unsigned char, bool, bool);
1857void allocate_data_block(struct f2fs_sb_info *, struct page *, 1859void allocate_data_block(struct f2fs_sb_info *, struct page *,
1858 block_t, block_t *, struct f2fs_summary *, int); 1860 block_t, block_t *, struct f2fs_summary *, int);
1859void f2fs_wait_on_page_writeback(struct page *, enum page_type, bool); 1861void f2fs_wait_on_page_writeback(struct page *, enum page_type, bool);