• Chao Yu's avatar
    f2fs: cache global IPU bio · 0b20fcec
    Chao Yu authored
    In commit 8648de2c ("f2fs: add bio cache for IPU"), we added
    f2fs_submit_ipu_bio() in __write_data_page() as below:
    
    __write_data_page()
    
    	if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode)) {
    		f2fs_submit_ipu_bio(sbi, bio, page);
    		....
    	}
    
    in order to avoid below deadlock:
    
    Thread A				Thread B
    - __write_data_page (inode x, page y)
     - f2fs_do_write_data_page
      - set_page_writeback        ---- set writeback flag in page y
      - f2fs_inplace_write_data
     - f2fs_balance_fs
    					 - lock gc_mutex
     - lock gc_mutex
    					  - f2fs_gc
    					   - do_garbage_collect
    					    - gc_data_segment
    					     - move_data_page
    					      - f2fs_wait_on_page_writeback
    					       - wait_on_page_writeback  --- wait writeback of page y
    
    However, the bio submission breaks the merge of IPU IOs.
    
    So in this patch let's add a global bio cache for merged IPU pages,
    then f2fs_wait_on_page_writeback() is able to submit bio if a
    writebacked page is cached in global bio cache.
    Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    0b20fcec
f2fs.h 118 KB