diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-05-19 20:55:50 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-05-28 02:03:01 -0400 |
commit | 64aa7ed98db489d1c41ef140876ada38498678ab (patch) | |
tree | 47aacafa1511c4116f3bf383a9bbee1efef2cc0f /fs/f2fs | |
parent | 1646cfac952ff87fcbc18a77164472aa61d08094 (diff) |
f2fs: change get_new_data_page to pass a locked node page
This patch is for passing a locked node page to get_dnode_of_data.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/data.c | 12 | ||||
-rw-r--r-- | fs/f2fs/dir.c | 4 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 2 | ||||
-rw-r--r-- | fs/f2fs/file.c | 2 |
4 files changed, 11 insertions, 9 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 05fb5c6077b8..af7454939362 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -280,8 +280,8 @@ repeat: | |||
280 | * Also, caller should grab and release a mutex by calling mutex_lock_op() and | 280 | * Also, caller should grab and release a mutex by calling mutex_lock_op() and |
281 | * mutex_unlock_op(). | 281 | * mutex_unlock_op(). |
282 | */ | 282 | */ |
283 | struct page *get_new_data_page(struct inode *inode, pgoff_t index, | 283 | struct page *get_new_data_page(struct inode *inode, |
284 | bool new_i_size) | 284 | struct page *npage, pgoff_t index, bool new_i_size) |
285 | { | 285 | { |
286 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 286 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
287 | struct address_space *mapping = inode->i_mapping; | 287 | struct address_space *mapping = inode->i_mapping; |
@@ -289,18 +289,20 @@ struct page *get_new_data_page(struct inode *inode, pgoff_t index, | |||
289 | struct dnode_of_data dn; | 289 | struct dnode_of_data dn; |
290 | int err; | 290 | int err; |
291 | 291 | ||
292 | set_new_dnode(&dn, inode, NULL, NULL, 0); | 292 | set_new_dnode(&dn, inode, npage, npage, 0); |
293 | err = get_dnode_of_data(&dn, index, ALLOC_NODE); | 293 | err = get_dnode_of_data(&dn, index, ALLOC_NODE); |
294 | if (err) | 294 | if (err) |
295 | return ERR_PTR(err); | 295 | return ERR_PTR(err); |
296 | 296 | ||
297 | if (dn.data_blkaddr == NULL_ADDR) { | 297 | if (dn.data_blkaddr == NULL_ADDR) { |
298 | if (reserve_new_block(&dn)) { | 298 | if (reserve_new_block(&dn)) { |
299 | f2fs_put_dnode(&dn); | 299 | if (!npage) |
300 | f2fs_put_dnode(&dn); | ||
300 | return ERR_PTR(-ENOSPC); | 301 | return ERR_PTR(-ENOSPC); |
301 | } | 302 | } |
302 | } | 303 | } |
303 | f2fs_put_dnode(&dn); | 304 | if (!npage) |
305 | f2fs_put_dnode(&dn); | ||
304 | repeat: | 306 | repeat: |
305 | page = grab_cache_page(mapping, index); | 307 | page = grab_cache_page(mapping, index); |
306 | if (!page) | 308 | if (!page) |
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 1ac6b93036b7..7db6e58622d9 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
@@ -287,7 +287,7 @@ static int make_empty_dir(struct inode *inode, struct inode *parent) | |||
287 | struct f2fs_dir_entry *de; | 287 | struct f2fs_dir_entry *de; |
288 | void *kaddr; | 288 | void *kaddr; |
289 | 289 | ||
290 | dentry_page = get_new_data_page(inode, 0, true); | 290 | dentry_page = get_new_data_page(inode, NULL, 0, true); |
291 | if (IS_ERR(dentry_page)) | 291 | if (IS_ERR(dentry_page)) |
292 | return PTR_ERR(dentry_page); | 292 | return PTR_ERR(dentry_page); |
293 | 293 | ||
@@ -448,7 +448,7 @@ start: | |||
448 | bidx = dir_block_index(level, (le32_to_cpu(dentry_hash) % nbucket)); | 448 | bidx = dir_block_index(level, (le32_to_cpu(dentry_hash) % nbucket)); |
449 | 449 | ||
450 | for (block = bidx; block <= (bidx + nblock - 1); block++) { | 450 | for (block = bidx; block <= (bidx + nblock - 1); block++) { |
451 | dentry_page = get_new_data_page(dir, block, true); | 451 | dentry_page = get_new_data_page(dir, NULL, block, true); |
452 | if (IS_ERR(dentry_page)) | 452 | if (IS_ERR(dentry_page)) |
453 | return PTR_ERR(dentry_page); | 453 | return PTR_ERR(dentry_page); |
454 | 454 | ||
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index ef6cac8c16a5..cbae2b663eba 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -1027,7 +1027,7 @@ int reserve_new_block(struct dnode_of_data *); | |||
1027 | void update_extent_cache(block_t, struct dnode_of_data *); | 1027 | void update_extent_cache(block_t, struct dnode_of_data *); |
1028 | struct page *find_data_page(struct inode *, pgoff_t, bool); | 1028 | struct page *find_data_page(struct inode *, pgoff_t, bool); |
1029 | struct page *get_lock_data_page(struct inode *, pgoff_t); | 1029 | struct page *get_lock_data_page(struct inode *, pgoff_t); |
1030 | struct page *get_new_data_page(struct inode *, pgoff_t, bool); | 1030 | struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool); |
1031 | int f2fs_readpage(struct f2fs_sb_info *, struct page *, block_t, int); | 1031 | int f2fs_readpage(struct f2fs_sb_info *, struct page *, block_t, int); |
1032 | int do_write_data_page(struct page *); | 1032 | int do_write_data_page(struct page *); |
1033 | 1033 | ||
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 1cae864f8dfc..b8e34db37ae8 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -387,7 +387,7 @@ static void fill_zero(struct inode *inode, pgoff_t index, | |||
387 | f2fs_balance_fs(sbi); | 387 | f2fs_balance_fs(sbi); |
388 | 388 | ||
389 | ilock = mutex_lock_op(sbi); | 389 | ilock = mutex_lock_op(sbi); |
390 | page = get_new_data_page(inode, index, false); | 390 | page = get_new_data_page(inode, NULL, index, false); |
391 | mutex_unlock_op(sbi, ilock); | 391 | mutex_unlock_op(sbi, ilock); |
392 | 392 | ||
393 | if (!IS_ERR(page)) { | 393 | if (!IS_ERR(page)) { |