File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -556,27 +556,34 @@ static void move_encrypted_block(struct inode *inode, block_t bidx)
556556 if (!fio .encrypted_page )
557557 goto put_out ;
558558
559- f2fs_submit_page_bio (& fio );
559+ err = f2fs_submit_page_bio (& fio );
560+ if (err )
561+ goto put_page_out ;
562+
563+ /* write page */
564+ lock_page (fio .encrypted_page );
565+
566+ if (unlikely (!PageUptodate (fio .encrypted_page )))
567+ goto put_page_out ;
568+ if (unlikely (fio .encrypted_page -> mapping != META_MAPPING (fio .sbi )))
569+ goto put_page_out ;
570+
571+ set_page_writeback (fio .encrypted_page );
560572
561573 /* allocate block address */
562574 f2fs_wait_on_page_writeback (dn .node_page , NODE );
563-
564575 allocate_data_block (fio .sbi , NULL , fio .blk_addr ,
565576 & fio .blk_addr , & sum , CURSEG_COLD_DATA );
566- dn .data_blkaddr = fio .blk_addr ;
567-
568- /* write page */
569- lock_page (fio .encrypted_page );
570- set_page_writeback (fio .encrypted_page );
571577 fio .rw = WRITE_SYNC ;
572578 f2fs_submit_page_mbio (& fio );
573579
580+ dn .data_blkaddr = fio .blk_addr ;
574581 set_data_blkaddr (& dn );
575582 f2fs_update_extent_cache (& dn );
576583 set_inode_flag (F2FS_I (inode ), FI_APPEND_WRITE );
577584 if (page -> index == 0 )
578585 set_inode_flag (F2FS_I (inode ), FI_FIRST_BLOCK_WRITTEN );
579-
586+ put_page_out :
580587 f2fs_put_page (fio .encrypted_page , 1 );
581588put_out :
582589 f2fs_put_dnode (& dn );
You can’t perform that action at this time.
0 commit comments