segment.c (9249dded7b5cb539a8c8698b25d08a3c15261470) | segment.c (bae0ee7a767ceeea6d8e170da3f228fbc7480331) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/segment.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/fs.h> --- 215 unchanged lines hidden (view full) --- 224 list_for_each_entry_safe(cur, tmp, head, list) { 225 struct page *page = cur->page; 226 227 if (drop) 228 trace_f2fs_commit_inmem_page(page, INMEM_DROP); 229 230 lock_page(page); 231 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/segment.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/fs.h> --- 215 unchanged lines hidden (view full) --- 224 list_for_each_entry_safe(cur, tmp, head, list) { 225 struct page *page = cur->page; 226 227 if (drop) 228 trace_f2fs_commit_inmem_page(page, INMEM_DROP); 229 230 lock_page(page); 231 |
232 f2fs_wait_on_page_writeback(page, DATA, true); | 232 f2fs_wait_on_page_writeback(page, DATA, true, true); |
233 234 if (recover) { 235 struct dnode_of_data dn; 236 struct node_info ni; 237 238 trace_f2fs_commit_inmem_page(page, INMEM_REVOKE); 239retry: 240 set_new_dnode(&dn, inode, NULL, NULL, 0); --- 141 unchanged lines hidden (view full) --- 382 383 list_for_each_entry_safe(cur, tmp, &fi->inmem_pages, list) { 384 struct page *page = cur->page; 385 386 lock_page(page); 387 if (page->mapping == inode->i_mapping) { 388 trace_f2fs_commit_inmem_page(page, INMEM); 389 | 233 234 if (recover) { 235 struct dnode_of_data dn; 236 struct node_info ni; 237 238 trace_f2fs_commit_inmem_page(page, INMEM_REVOKE); 239retry: 240 set_new_dnode(&dn, inode, NULL, NULL, 0); --- 141 unchanged lines hidden (view full) --- 382 383 list_for_each_entry_safe(cur, tmp, &fi->inmem_pages, list) { 384 struct page *page = cur->page; 385 386 lock_page(page); 387 if (page->mapping == inode->i_mapping) { 388 trace_f2fs_commit_inmem_page(page, INMEM); 389 |
390 f2fs_wait_on_page_writeback(page, DATA, true); | 390 f2fs_wait_on_page_writeback(page, DATA, true, true); |
391 392 set_page_dirty(page); 393 if (clear_page_dirty_for_io(page)) { 394 inode_dec_dirty_pages(inode); 395 f2fs_remove_dirty_inode(inode); 396 } 397retry: 398 fio.page = page; --- 2875 unchanged lines hidden (view full) --- 3274 3275 f2fs_do_replace_block(sbi, &sum, old_addr, new_addr, 3276 recover_curseg, recover_newaddr); 3277 3278 f2fs_update_data_blkaddr(dn, new_addr); 3279} 3280 3281void f2fs_wait_on_page_writeback(struct page *page, | 391 392 set_page_dirty(page); 393 if (clear_page_dirty_for_io(page)) { 394 inode_dec_dirty_pages(inode); 395 f2fs_remove_dirty_inode(inode); 396 } 397retry: 398 fio.page = page; --- 2875 unchanged lines hidden (view full) --- 3274 3275 f2fs_do_replace_block(sbi, &sum, old_addr, new_addr, 3276 recover_curseg, recover_newaddr); 3277 3278 f2fs_update_data_blkaddr(dn, new_addr); 3279} 3280 3281void f2fs_wait_on_page_writeback(struct page *page, |
3282 enum page_type type, bool ordered) | 3282 enum page_type type, bool ordered, bool locked) |
3283{ 3284 if (PageWriteback(page)) { 3285 struct f2fs_sb_info *sbi = F2FS_P_SB(page); 3286 3287 f2fs_submit_merged_write_cond(sbi, NULL, page, 0, type); | 3283{ 3284 if (PageWriteback(page)) { 3285 struct f2fs_sb_info *sbi = F2FS_P_SB(page); 3286 3287 f2fs_submit_merged_write_cond(sbi, NULL, page, 0, type); |
3288 if (ordered) | 3288 if (ordered) { |
3289 wait_on_page_writeback(page); | 3289 wait_on_page_writeback(page); |
3290 else | 3290 f2fs_bug_on(sbi, locked && PageWriteback(page)); 3291 } else { |
3291 wait_for_stable_page(page); | 3292 wait_for_stable_page(page); |
3293 } |
|
3292 } 3293} 3294 3295void f2fs_wait_on_block_writeback(struct inode *inode, block_t blkaddr) 3296{ 3297 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 3298 struct page *cpage; 3299 3300 if (!f2fs_post_read_required(inode)) 3301 return; 3302 3303 if (!is_valid_data_blkaddr(sbi, blkaddr)) 3304 return; 3305 3306 cpage = find_lock_page(META_MAPPING(sbi), blkaddr); 3307 if (cpage) { | 3294 } 3295} 3296 3297void f2fs_wait_on_block_writeback(struct inode *inode, block_t blkaddr) 3298{ 3299 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 3300 struct page *cpage; 3301 3302 if (!f2fs_post_read_required(inode)) 3303 return; 3304 3305 if (!is_valid_data_blkaddr(sbi, blkaddr)) 3306 return; 3307 3308 cpage = find_lock_page(META_MAPPING(sbi), blkaddr); 3309 if (cpage) { |
3308 f2fs_wait_on_page_writeback(cpage, DATA, true); | 3310 f2fs_wait_on_page_writeback(cpage, DATA, true, true); |
3309 f2fs_put_page(cpage, 1); 3310 } 3311} 3312 3313void f2fs_wait_on_block_writeback_range(struct inode *inode, block_t blkaddr, 3314 block_t len) 3315{ 3316 block_t i; --- 1124 unchanged lines hidden --- | 3311 f2fs_put_page(cpage, 1); 3312 } 3313} 3314 3315void f2fs_wait_on_block_writeback_range(struct inode *inode, block_t blkaddr, 3316 block_t len) 3317{ 3318 block_t i; --- 1124 unchanged lines hidden --- |