Commit cf04e8eb authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: use f2fs_io_info to clean up messy parameters during IO path

This patch cleans up parameters on IO paths.
The key idea is to use f2fs_io_info adding a parameter, block address, and then
use this structure as parameters.
Reviewed-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 9ecf4b80
...@@ -50,6 +50,11 @@ struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index) ...@@ -50,6 +50,11 @@ struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
{ {
struct address_space *mapping = META_MAPPING(sbi); struct address_space *mapping = META_MAPPING(sbi);
struct page *page; struct page *page;
struct f2fs_io_info fio = {
.type = META,
.rw = READ_SYNC | REQ_META | REQ_PRIO,
.blk_addr = index,
};
repeat: repeat:
page = grab_cache_page(mapping, index); page = grab_cache_page(mapping, index);
if (!page) { if (!page) {
...@@ -59,8 +64,7 @@ struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index) ...@@ -59,8 +64,7 @@ struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
if (PageUptodate(page)) if (PageUptodate(page))
goto out; goto out;
if (f2fs_submit_page_bio(sbi, page, index, if (f2fs_submit_page_bio(sbi, page, &fio))
READ_SYNC | REQ_META | REQ_PRIO))
goto repeat; goto repeat;
lock_page(page); lock_page(page);
...@@ -112,14 +116,12 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type ...@@ -112,14 +116,12 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type
block_t prev_blk_addr = 0; block_t prev_blk_addr = 0;
struct page *page; struct page *page;
block_t blkno = start; block_t blkno = start;
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.type = META, .type = META,
.rw = READ_SYNC | REQ_META | REQ_PRIO .rw = READ_SYNC | REQ_META | REQ_PRIO
}; };
for (; nrpages-- > 0; blkno++) { for (; nrpages-- > 0; blkno++) {
block_t blk_addr;
if (!is_valid_blkaddr(sbi, blkno, type)) if (!is_valid_blkaddr(sbi, blkno, type))
goto out; goto out;
...@@ -130,27 +132,27 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type ...@@ -130,27 +132,27 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type
NAT_BLOCK_OFFSET(NM_I(sbi)->max_nid))) NAT_BLOCK_OFFSET(NM_I(sbi)->max_nid)))
blkno = 0; blkno = 0;
/* get nat block addr */ /* get nat block addr */
blk_addr = current_nat_addr(sbi, fio.blk_addr = current_nat_addr(sbi,
blkno * NAT_ENTRY_PER_BLOCK); blkno * NAT_ENTRY_PER_BLOCK);
break; break;
case META_SIT: case META_SIT:
/* get sit block addr */ /* get sit block addr */
blk_addr = current_sit_addr(sbi, fio.blk_addr = current_sit_addr(sbi,
blkno * SIT_ENTRY_PER_BLOCK); blkno * SIT_ENTRY_PER_BLOCK);
if (blkno != start && prev_blk_addr + 1 != blk_addr) if (blkno != start && prev_blk_addr + 1 != fio.blk_addr)
goto out; goto out;
prev_blk_addr = blk_addr; prev_blk_addr = fio.blk_addr;
break; break;
case META_SSA: case META_SSA:
case META_CP: case META_CP:
case META_POR: case META_POR:
blk_addr = blkno; fio.blk_addr = blkno;
break; break;
default: default:
BUG(); BUG();
} }
page = grab_cache_page(META_MAPPING(sbi), blk_addr); page = grab_cache_page(META_MAPPING(sbi), fio.blk_addr);
if (!page) if (!page)
continue; continue;
if (PageUptodate(page)) { if (PageUptodate(page)) {
...@@ -158,7 +160,7 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type ...@@ -158,7 +160,7 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type
continue; continue;
} }
f2fs_submit_page_mbio(sbi, page, blk_addr, &fio); f2fs_submit_page_mbio(sbi, page, &fio);
f2fs_put_page(page, 0); f2fs_put_page(page, 0);
} }
out: out:
......
...@@ -132,14 +132,14 @@ void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi, ...@@ -132,14 +132,14 @@ void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
* Return unlocked page. * Return unlocked page.
*/ */
int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct page *page, int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct page *page,
block_t blk_addr, int rw) struct f2fs_io_info *fio)
{ {
struct bio *bio; struct bio *bio;
trace_f2fs_submit_page_bio(page, blk_addr, rw); trace_f2fs_submit_page_bio(page, fio->blk_addr, fio->rw);
/* Allocate a new bio */ /* Allocate a new bio */
bio = __bio_alloc(sbi, blk_addr, 1, is_read_io(rw)); bio = __bio_alloc(sbi, fio->blk_addr, 1, is_read_io(fio->rw));
if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) { if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) {
bio_put(bio); bio_put(bio);
...@@ -147,12 +147,12 @@ int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct page *page, ...@@ -147,12 +147,12 @@ int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct page *page,
return -EFAULT; return -EFAULT;
} }
submit_bio(rw, bio); submit_bio(fio->rw, bio);
return 0; return 0;
} }
void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page, void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page,
block_t blk_addr, struct f2fs_io_info *fio) struct f2fs_io_info *fio)
{ {
enum page_type btype = PAGE_TYPE_OF_BIO(fio->type); enum page_type btype = PAGE_TYPE_OF_BIO(fio->type);
struct f2fs_bio_info *io; struct f2fs_bio_info *io;
...@@ -160,21 +160,21 @@ void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page, ...@@ -160,21 +160,21 @@ void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page,
io = is_read ? &sbi->read_io : &sbi->write_io[btype]; io = is_read ? &sbi->read_io : &sbi->write_io[btype];
verify_block_addr(sbi, blk_addr); verify_block_addr(sbi, fio->blk_addr);
down_write(&io->io_rwsem); down_write(&io->io_rwsem);
if (!is_read) if (!is_read)
inc_page_count(sbi, F2FS_WRITEBACK); inc_page_count(sbi, F2FS_WRITEBACK);
if (io->bio && (io->last_block_in_bio != blk_addr - 1 || if (io->bio && (io->last_block_in_bio != fio->blk_addr - 1 ||
io->fio.rw != fio->rw)) io->fio.rw != fio->rw))
__submit_merged_bio(io); __submit_merged_bio(io);
alloc_new: alloc_new:
if (io->bio == NULL) { if (io->bio == NULL) {
int bio_blocks = MAX_BIO_BLOCKS(sbi); int bio_blocks = MAX_BIO_BLOCKS(sbi);
io->bio = __bio_alloc(sbi, blk_addr, bio_blocks, is_read); io->bio = __bio_alloc(sbi, fio->blk_addr, bio_blocks, is_read);
io->fio = *fio; io->fio = *fio;
} }
...@@ -184,10 +184,10 @@ void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page, ...@@ -184,10 +184,10 @@ void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page,
goto alloc_new; goto alloc_new;
} }
io->last_block_in_bio = blk_addr; io->last_block_in_bio = fio->blk_addr;
up_write(&io->io_rwsem); up_write(&io->io_rwsem);
trace_f2fs_submit_page_mbio(page, fio->rw, fio->type, blk_addr); trace_f2fs_submit_page_mbio(page, fio->rw, fio->type, fio->blk_addr);
} }
/* /*
...@@ -376,6 +376,10 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync) ...@@ -376,6 +376,10 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
struct dnode_of_data dn; struct dnode_of_data dn;
struct page *page; struct page *page;
int err; int err;
struct f2fs_io_info fio = {
.type = DATA,
.rw = sync ? READ_SYNC : READA,
};
page = find_get_page(mapping, index); page = find_get_page(mapping, index);
if (page && PageUptodate(page)) if (page && PageUptodate(page))
...@@ -404,8 +408,8 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync) ...@@ -404,8 +408,8 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
return page; return page;
} }
err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, dn.data_blkaddr, fio.blk_addr = dn.data_blkaddr;
sync ? READ_SYNC : READA); err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, &fio);
if (err) if (err)
return ERR_PTR(err); return ERR_PTR(err);
...@@ -430,7 +434,10 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index) ...@@ -430,7 +434,10 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index)
struct dnode_of_data dn; struct dnode_of_data dn;
struct page *page; struct page *page;
int err; int err;
struct f2fs_io_info fio = {
.type = DATA,
.rw = READ_SYNC,
};
repeat: repeat:
page = grab_cache_page(mapping, index); page = grab_cache_page(mapping, index);
if (!page) if (!page)
...@@ -464,8 +471,8 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index) ...@@ -464,8 +471,8 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index)
return page; return page;
} }
err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, fio.blk_addr = dn.data_blkaddr;
dn.data_blkaddr, READ_SYNC); err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, &fio);
if (err) if (err)
return ERR_PTR(err); return ERR_PTR(err);
...@@ -515,8 +522,12 @@ struct page *get_new_data_page(struct inode *inode, ...@@ -515,8 +522,12 @@ struct page *get_new_data_page(struct inode *inode,
zero_user_segment(page, 0, PAGE_CACHE_SIZE); zero_user_segment(page, 0, PAGE_CACHE_SIZE);
SetPageUptodate(page); SetPageUptodate(page);
} else { } else {
err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, struct f2fs_io_info fio = {
dn.data_blkaddr, READ_SYNC); .type = DATA,
.rw = READ_SYNC,
.blk_addr = dn.data_blkaddr,
};
err = f2fs_submit_page_bio(F2FS_I_SB(inode), page, &fio);
if (err) if (err)
goto put_err; goto put_err;
...@@ -745,7 +756,6 @@ static int f2fs_read_data_pages(struct file *file, ...@@ -745,7 +756,6 @@ static int f2fs_read_data_pages(struct file *file,
int do_write_data_page(struct page *page, struct f2fs_io_info *fio) int do_write_data_page(struct page *page, struct f2fs_io_info *fio)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
block_t old_blkaddr, new_blkaddr;
struct dnode_of_data dn; struct dnode_of_data dn;
int err = 0; int err = 0;
...@@ -754,10 +764,10 @@ int do_write_data_page(struct page *page, struct f2fs_io_info *fio) ...@@ -754,10 +764,10 @@ int do_write_data_page(struct page *page, struct f2fs_io_info *fio)
if (err) if (err)
return err; return err;
old_blkaddr = dn.data_blkaddr; fio->blk_addr = dn.data_blkaddr;
/* This page is already truncated */ /* This page is already truncated */
if (old_blkaddr == NULL_ADDR) if (fio->blk_addr == NULL_ADDR)
goto out_writepage; goto out_writepage;
set_page_writeback(page); set_page_writeback(page);
...@@ -766,14 +776,14 @@ int do_write_data_page(struct page *page, struct f2fs_io_info *fio) ...@@ -766,14 +776,14 @@ int do_write_data_page(struct page *page, struct f2fs_io_info *fio)
* If current allocation needs SSR, * If current allocation needs SSR,
* it had better in-place writes for updated data. * it had better in-place writes for updated data.
*/ */
if (unlikely(old_blkaddr != NEW_ADDR && if (unlikely(fio->blk_addr != NEW_ADDR &&
!is_cold_data(page) && !is_cold_data(page) &&
need_inplace_update(inode))) { need_inplace_update(inode))) {
rewrite_data_page(page, old_blkaddr, fio); rewrite_data_page(page, fio);
set_inode_flag(F2FS_I(inode), FI_UPDATE_WRITE); set_inode_flag(F2FS_I(inode), FI_UPDATE_WRITE);
} else { } else {
write_data_page(page, &dn, &new_blkaddr, fio); write_data_page(page, &dn, fio);
update_extent_cache(new_blkaddr, &dn); update_extent_cache(fio->blk_addr, &dn);
set_inode_flag(F2FS_I(inode), FI_APPEND_WRITE); set_inode_flag(F2FS_I(inode), FI_APPEND_WRITE);
} }
out_writepage: out_writepage:
...@@ -1007,8 +1017,12 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, ...@@ -1007,8 +1017,12 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
if (dn.data_blkaddr == NEW_ADDR) { if (dn.data_blkaddr == NEW_ADDR) {
zero_user_segment(page, 0, PAGE_CACHE_SIZE); zero_user_segment(page, 0, PAGE_CACHE_SIZE);
} else { } else {
err = f2fs_submit_page_bio(sbi, page, dn.data_blkaddr, struct f2fs_io_info fio = {
READ_SYNC); .type = DATA,
.rw = READ_SYNC,
.blk_addr = dn.data_blkaddr,
};
err = f2fs_submit_page_bio(sbi, page, &fio);
if (err) if (err)
goto fail; goto fail;
......
...@@ -491,6 +491,7 @@ enum page_type { ...@@ -491,6 +491,7 @@ enum page_type {
struct f2fs_io_info { struct f2fs_io_info {
enum page_type type; /* contains DATA/NODE/META/META_FLUSH */ enum page_type type; /* contains DATA/NODE/META/META_FLUSH */
int rw; /* contains R/RS/W/WS with REQ_META/REQ_PRIO */ int rw; /* contains R/RS/W/WS with REQ_META/REQ_PRIO */
block_t blk_addr; /* block address to be written */
}; };
#define is_read_io(rw) (((rw) & 1) == READ) #define is_read_io(rw) (((rw) & 1) == READ)
...@@ -1414,10 +1415,10 @@ int f2fs_trim_fs(struct f2fs_sb_info *, struct fstrim_range *); ...@@ -1414,10 +1415,10 @@ int f2fs_trim_fs(struct f2fs_sb_info *, struct fstrim_range *);
struct page *get_sum_page(struct f2fs_sb_info *, unsigned int); struct page *get_sum_page(struct f2fs_sb_info *, unsigned int);
void write_meta_page(struct f2fs_sb_info *, struct page *); void write_meta_page(struct f2fs_sb_info *, struct page *);
void write_node_page(struct f2fs_sb_info *, struct page *, void write_node_page(struct f2fs_sb_info *, struct page *,
struct f2fs_io_info *, unsigned int, block_t, block_t *); unsigned int, struct f2fs_io_info *);
void write_data_page(struct page *, struct dnode_of_data *, block_t *, void write_data_page(struct page *, struct dnode_of_data *,
struct f2fs_io_info *); struct f2fs_io_info *);
void rewrite_data_page(struct page *, block_t, struct f2fs_io_info *); void rewrite_data_page(struct page *, struct f2fs_io_info *);
void recover_data_page(struct f2fs_sb_info *, struct page *, void recover_data_page(struct f2fs_sb_info *, struct page *,
struct f2fs_summary *, block_t, block_t); struct f2fs_summary *, block_t, block_t);
void allocate_data_block(struct f2fs_sb_info *, struct page *, void allocate_data_block(struct f2fs_sb_info *, struct page *,
...@@ -1464,8 +1465,9 @@ void destroy_checkpoint_caches(void); ...@@ -1464,8 +1465,9 @@ void destroy_checkpoint_caches(void);
* data.c * data.c
*/ */
void f2fs_submit_merged_bio(struct f2fs_sb_info *, enum page_type, int); void f2fs_submit_merged_bio(struct f2fs_sb_info *, enum page_type, int);
int f2fs_submit_page_bio(struct f2fs_sb_info *, struct page *, block_t, int); int f2fs_submit_page_bio(struct f2fs_sb_info *, struct page *,
void f2fs_submit_page_mbio(struct f2fs_sb_info *, struct page *, block_t, struct f2fs_io_info *);
void f2fs_submit_page_mbio(struct f2fs_sb_info *, struct page *,
struct f2fs_io_info *); struct f2fs_io_info *);
int reserve_new_block(struct dnode_of_data *); int reserve_new_block(struct dnode_of_data *);
int f2fs_reserve_block(struct dnode_of_data *, pgoff_t); int f2fs_reserve_block(struct dnode_of_data *, pgoff_t);
......
...@@ -79,7 +79,6 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page) ...@@ -79,7 +79,6 @@ int f2fs_read_inline_data(struct inode *inode, struct page *page)
int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page)
{ {
void *src_addr, *dst_addr; void *src_addr, *dst_addr;
block_t new_blk_addr;
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.type = DATA, .type = DATA,
.rw = WRITE_SYNC | REQ_PRIO, .rw = WRITE_SYNC | REQ_PRIO,
...@@ -115,9 +114,9 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) ...@@ -115,9 +114,9 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page)
/* write data page to try to make data consistent */ /* write data page to try to make data consistent */
set_page_writeback(page); set_page_writeback(page);
fio.blk_addr = dn->data_blkaddr;
write_data_page(page, dn, &new_blk_addr, &fio); write_data_page(page, dn, &fio);
update_extent_cache(new_blk_addr, dn); update_extent_cache(fio.blk_addr, dn);
f2fs_wait_on_page_writeback(page, DATA); f2fs_wait_on_page_writeback(page, DATA);
if (dirty) if (dirty)
inode_dec_dirty_pages(dn->inode); inode_dec_dirty_pages(dn->inode);
......
...@@ -977,6 +977,10 @@ static int read_node_page(struct page *page, int rw) ...@@ -977,6 +977,10 @@ static int read_node_page(struct page *page, int rw)
{ {
struct f2fs_sb_info *sbi = F2FS_P_SB(page); struct f2fs_sb_info *sbi = F2FS_P_SB(page);
struct node_info ni; struct node_info ni;
struct f2fs_io_info fio = {
.type = NODE,
.rw = rw,
};
get_node_info(sbi, page->index, &ni); get_node_info(sbi, page->index, &ni);
...@@ -988,7 +992,8 @@ static int read_node_page(struct page *page, int rw) ...@@ -988,7 +992,8 @@ static int read_node_page(struct page *page, int rw)
if (PageUptodate(page)) if (PageUptodate(page))
return LOCKED_PAGE; return LOCKED_PAGE;
return f2fs_submit_page_bio(sbi, page, ni.blk_addr, rw); fio.blk_addr = ni.blk_addr;
return f2fs_submit_page_bio(sbi, page, &fio);
} }
/* /*
...@@ -1269,7 +1274,6 @@ static int f2fs_write_node_page(struct page *page, ...@@ -1269,7 +1274,6 @@ static int f2fs_write_node_page(struct page *page,
{ {
struct f2fs_sb_info *sbi = F2FS_P_SB(page); struct f2fs_sb_info *sbi = F2FS_P_SB(page);
nid_t nid; nid_t nid;
block_t new_addr;
struct node_info ni; struct node_info ni;
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.type = NODE, .type = NODE,
...@@ -1304,9 +1308,11 @@ static int f2fs_write_node_page(struct page *page, ...@@ -1304,9 +1308,11 @@ static int f2fs_write_node_page(struct page *page,
} else { } else {
down_read(&sbi->node_write); down_read(&sbi->node_write);
} }
set_page_writeback(page); set_page_writeback(page);
write_node_page(sbi, page, &fio, nid, ni.blk_addr, &new_addr); fio.blk_addr = ni.blk_addr;
set_node_addr(sbi, &ni, new_addr, is_fsync_dnode(page)); write_node_page(sbi, page, nid, &fio);
set_node_addr(sbi, &ni, fio.blk_addr, is_fsync_dnode(page));
dec_page_count(sbi, F2FS_DIRTY_NODES); dec_page_count(sbi, F2FS_DIRTY_NODES);
up_read(&sbi->node_write); up_read(&sbi->node_write);
unlock_page(page); unlock_page(page);
......
...@@ -1182,39 +1182,39 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, ...@@ -1182,39 +1182,39 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
} }
static void do_write_page(struct f2fs_sb_info *sbi, struct page *page, static void do_write_page(struct f2fs_sb_info *sbi, struct page *page,
block_t old_blkaddr, block_t *new_blkaddr, struct f2fs_summary *sum,
struct f2fs_summary *sum, struct f2fs_io_info *fio) struct f2fs_io_info *fio)
{ {
int type = __get_segment_type(page, fio->type); int type = __get_segment_type(page, fio->type);
allocate_data_block(sbi, page, old_blkaddr, new_blkaddr, sum, type); allocate_data_block(sbi, page, fio->blk_addr, &fio->blk_addr, sum, type);
/* writeout dirty page into bdev */ /* writeout dirty page into bdev */
f2fs_submit_page_mbio(sbi, page, *new_blkaddr, fio); f2fs_submit_page_mbio(sbi, page, fio);
} }
void write_meta_page(struct f2fs_sb_info *sbi, struct page *page) void write_meta_page(struct f2fs_sb_info *sbi, struct page *page)
{ {
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.type = META, .type = META,
.rw = WRITE_SYNC | REQ_META | REQ_PRIO .rw = WRITE_SYNC | REQ_META | REQ_PRIO,
.blk_addr = page->index,
}; };
set_page_writeback(page); set_page_writeback(page);
f2fs_submit_page_mbio(sbi, page, page->index, &fio); f2fs_submit_page_mbio(sbi, page, &fio);
} }
void write_node_page(struct f2fs_sb_info *sbi, struct page *page, void write_node_page(struct f2fs_sb_info *sbi, struct page *page,
struct f2fs_io_info *fio, unsigned int nid, struct f2fs_io_info *fio)
unsigned int nid, block_t old_blkaddr, block_t *new_blkaddr)
{ {
struct f2fs_summary sum; struct f2fs_summary sum;
set_summary(&sum, nid, 0, 0); set_summary(&sum, nid, 0, 0);
do_write_page(sbi, page, old_blkaddr, new_blkaddr, &sum, fio); do_write_page(sbi, page, &sum, fio);
} }
void write_data_page(struct page *page, struct dnode_of_data *dn, void write_data_page(struct page *page, struct dnode_of_data *dn,
block_t *new_blkaddr, struct f2fs_io_info *fio) struct f2fs_io_info *fio)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode);
struct f2fs_summary sum; struct f2fs_summary sum;
...@@ -1223,14 +1223,12 @@ void write_data_page(struct page *page, struct dnode_of_data *dn, ...@@ -1223,14 +1223,12 @@ void write_data_page(struct page *page, struct dnode_of_data *dn,
f2fs_bug_on(sbi, dn->data_blkaddr == NULL_ADDR); f2fs_bug_on(sbi, dn->data_blkaddr == NULL_ADDR);
get_node_info(sbi, dn->nid, &ni); get_node_info(sbi, dn->nid, &ni);
set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version); set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version);
do_write_page(sbi, page, &sum, fio);
do_write_page(sbi, page, dn->data_blkaddr, new_blkaddr, &sum, fio);
} }
void rewrite_data_page(struct page *page, block_t old_blkaddr, void rewrite_data_page(struct page *page, struct f2fs_io_info *fio)
struct f2fs_io_info *fio)
{ {
f2fs_submit_page_mbio(F2FS_P_SB(page), page, old_blkaddr, fio); f2fs_submit_page_mbio(F2FS_P_SB(page), page, fio);
} }
void recover_data_page(struct f2fs_sb_info *sbi, void recover_data_page(struct f2fs_sb_info *sbi,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment