Merge tag 'rpmsg-v4.16' of git://github.com/andersson/remoteproc
[linux-2.6-microblaze.git] / fs / f2fs / gc.c
index d844dcb..aa720cc 100644 (file)
@@ -624,6 +624,11 @@ static void move_data_block(struct inode *inode, block_t bidx,
        if (f2fs_is_atomic_file(inode))
                goto out;
 
+       if (f2fs_is_pinned_file(inode)) {
+               f2fs_pin_file_control(inode, true);
+               goto out;
+       }
+
        set_new_dnode(&dn, inode, NULL, NULL, 0);
        err = get_dnode_of_data(&dn, bidx, LOOKUP_NODE);
        if (err)
@@ -686,7 +691,12 @@ static void move_data_block(struct inode *inode, block_t bidx,
        fio.op = REQ_OP_WRITE;
        fio.op_flags = REQ_SYNC;
        fio.new_blkaddr = newaddr;
-       f2fs_submit_page_write(&fio);
+       err = f2fs_submit_page_write(&fio);
+       if (err) {
+               if (PageWriteback(fio.encrypted_page))
+                       end_page_writeback(fio.encrypted_page);
+               goto put_page_out;
+       }
 
        f2fs_update_iostat(fio.sbi, FS_GC_DATA_IO, F2FS_BLKSIZE);
 
@@ -720,6 +730,11 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,
 
        if (f2fs_is_atomic_file(inode))
                goto out;
+       if (f2fs_is_pinned_file(inode)) {
+               if (gc_type == FG_GC)
+                       f2fs_pin_file_control(inode, true);
+               goto out;
+       }
 
        if (gc_type == BG_GC) {
                if (PageWriteback(page))
@@ -1091,6 +1106,7 @@ void build_gc_manager(struct f2fs_sb_info *sbi)
 
        sbi->fggc_threshold = div64_u64((main_count - ovp_count) *
                                BLKS_PER_SEC(sbi), (main_count - resv_count));
+       sbi->gc_pin_file_threshold = DEF_GC_FAILED_PINNED_FILES;
 
        /* give warm/cold data area from slower device */
        if (sbi->s_ndevs && sbi->segs_per_sec == 1)