Lines Matching full:cc

52 	int (*init_compress_ctx)(struct compress_ctx *cc);
53 void (*destroy_compress_ctx)(struct compress_ctx *cc);
54 int (*compress_pages)(struct compress_ctx *cc);
60 static unsigned int offset_in_cluster(struct compress_ctx *cc, pgoff_t index) in offset_in_cluster() argument
62 return index & (cc->cluster_size - 1); in offset_in_cluster()
65 static pgoff_t cluster_idx(struct compress_ctx *cc, pgoff_t index) in cluster_idx() argument
67 return index >> cc->log_cluster_size; in cluster_idx()
70 static pgoff_t start_idx_of_cluster(struct compress_ctx *cc) in start_idx_of_cluster() argument
72 return cc->cluster_idx << cc->log_cluster_size; in start_idx_of_cluster()
99 static void f2fs_drop_rpages(struct compress_ctx *cc, int len, bool unlock) in f2fs_drop_rpages() argument
104 if (!cc->rpages[i]) in f2fs_drop_rpages()
107 unlock_page(cc->rpages[i]); in f2fs_drop_rpages()
109 put_page(cc->rpages[i]); in f2fs_drop_rpages()
113 static void f2fs_put_rpages(struct compress_ctx *cc) in f2fs_put_rpages() argument
115 f2fs_drop_rpages(cc, cc->cluster_size, false); in f2fs_put_rpages()
118 static void f2fs_unlock_rpages(struct compress_ctx *cc, int len) in f2fs_unlock_rpages() argument
120 f2fs_drop_rpages(cc, len, true); in f2fs_unlock_rpages()
123 static void f2fs_put_rpages_wbc(struct compress_ctx *cc, in f2fs_put_rpages_wbc() argument
128 for (i = 0; i < cc->cluster_size; i++) { in f2fs_put_rpages_wbc()
129 if (!cc->rpages[i]) in f2fs_put_rpages_wbc()
132 redirty_page_for_writepage(wbc, cc->rpages[i]); in f2fs_put_rpages_wbc()
133 f2fs_put_page(cc->rpages[i], unlock); in f2fs_put_rpages_wbc()
142 int f2fs_init_compress_ctx(struct compress_ctx *cc) in f2fs_init_compress_ctx() argument
144 if (cc->rpages) in f2fs_init_compress_ctx()
147 cc->rpages = page_array_alloc(cc->inode, cc->cluster_size); in f2fs_init_compress_ctx()
148 return cc->rpages ? 0 : -ENOMEM; in f2fs_init_compress_ctx()
151 void f2fs_destroy_compress_ctx(struct compress_ctx *cc, bool reuse) in f2fs_destroy_compress_ctx() argument
153 page_array_free(cc->inode, cc->rpages, cc->cluster_size); in f2fs_destroy_compress_ctx()
154 cc->rpages = NULL; in f2fs_destroy_compress_ctx()
155 cc->nr_rpages = 0; in f2fs_destroy_compress_ctx()
156 cc->nr_cpages = 0; in f2fs_destroy_compress_ctx()
157 cc->valid_nr_cpages = 0; in f2fs_destroy_compress_ctx()
159 cc->cluster_idx = NULL_CLUSTER; in f2fs_destroy_compress_ctx()
162 void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page) in f2fs_compress_ctx_add_page() argument
166 if (!f2fs_cluster_can_merge_page(cc, page->index)) in f2fs_compress_ctx_add_page()
167 f2fs_bug_on(F2FS_I_SB(cc->inode), 1); in f2fs_compress_ctx_add_page()
169 cluster_ofs = offset_in_cluster(cc, page->index); in f2fs_compress_ctx_add_page()
170 cc->rpages[cluster_ofs] = page; in f2fs_compress_ctx_add_page()
171 cc->nr_rpages++; in f2fs_compress_ctx_add_page()
172 cc->cluster_idx = cluster_idx(cc, page->index); in f2fs_compress_ctx_add_page()
176 static int lzo_init_compress_ctx(struct compress_ctx *cc) in lzo_init_compress_ctx() argument
178 cc->private = f2fs_kvmalloc(F2FS_I_SB(cc->inode), in lzo_init_compress_ctx()
180 if (!cc->private) in lzo_init_compress_ctx()
183 cc->clen = lzo1x_worst_compress(PAGE_SIZE << cc->log_cluster_size); in lzo_init_compress_ctx()
187 static void lzo_destroy_compress_ctx(struct compress_ctx *cc) in lzo_destroy_compress_ctx() argument
189 kvfree(cc->private); in lzo_destroy_compress_ctx()
190 cc->private = NULL; in lzo_destroy_compress_ctx()
193 static int lzo_compress_pages(struct compress_ctx *cc) in lzo_compress_pages() argument
197 ret = lzo1x_1_compress(cc->rbuf, cc->rlen, cc->cbuf->cdata, in lzo_compress_pages()
198 &cc->clen, cc->private); in lzo_compress_pages()
201 KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, ret); in lzo_compress_pages()
239 static int lz4_init_compress_ctx(struct compress_ctx *cc) in lz4_init_compress_ctx() argument
244 if (F2FS_I(cc->inode)->i_compress_flag >> COMPRESS_LEVEL_OFFSET) in lz4_init_compress_ctx()
248 cc->private = f2fs_kvmalloc(F2FS_I_SB(cc->inode), size, GFP_NOFS); in lz4_init_compress_ctx()
249 if (!cc->private) in lz4_init_compress_ctx()
253 * we do not change cc->clen to LZ4_compressBound(inputsize) to in lz4_init_compress_ctx()
257 cc->clen = cc->rlen - PAGE_SIZE - COMPRESS_HEADER_SIZE; in lz4_init_compress_ctx()
261 static void lz4_destroy_compress_ctx(struct compress_ctx *cc) in lz4_destroy_compress_ctx() argument
263 kvfree(cc->private); in lz4_destroy_compress_ctx()
264 cc->private = NULL; in lz4_destroy_compress_ctx()
268 static int lz4hc_compress_pages(struct compress_ctx *cc) in lz4hc_compress_pages() argument
270 unsigned char level = F2FS_I(cc->inode)->i_compress_flag >> in lz4hc_compress_pages()
275 len = LZ4_compress_HC(cc->rbuf, cc->cbuf->cdata, cc->rlen, in lz4hc_compress_pages()
276 cc->clen, level, cc->private); in lz4hc_compress_pages()
278 len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen, in lz4hc_compress_pages()
279 cc->clen, cc->private); in lz4hc_compress_pages()
283 cc->clen = len; in lz4hc_compress_pages()
288 static int lz4_compress_pages(struct compress_ctx *cc) in lz4_compress_pages() argument
293 return lz4hc_compress_pages(cc); in lz4_compress_pages()
295 len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen, in lz4_compress_pages()
296 cc->clen, cc->private); in lz4_compress_pages()
300 cc->clen = len; in lz4_compress_pages()
337 static int zstd_init_compress_ctx(struct compress_ctx *cc) in zstd_init_compress_ctx() argument
343 unsigned char level = F2FS_I(cc->inode)->i_compress_flag >> in zstd_init_compress_ctx()
349 params = zstd_get_params(F2FS_ZSTD_DEFAULT_CLEVEL, cc->rlen); in zstd_init_compress_ctx()
352 workspace = f2fs_kvmalloc(F2FS_I_SB(cc->inode), in zstd_init_compress_ctx()
360 KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, in zstd_init_compress_ctx()
366 cc->private = workspace; in zstd_init_compress_ctx()
367 cc->private2 = stream; in zstd_init_compress_ctx()
369 cc->clen = cc->rlen - PAGE_SIZE - COMPRESS_HEADER_SIZE; in zstd_init_compress_ctx()
373 static void zstd_destroy_compress_ctx(struct compress_ctx *cc) in zstd_destroy_compress_ctx() argument
375 kvfree(cc->private); in zstd_destroy_compress_ctx()
376 cc->private = NULL; in zstd_destroy_compress_ctx()
377 cc->private2 = NULL; in zstd_destroy_compress_ctx()
380 static int zstd_compress_pages(struct compress_ctx *cc) in zstd_compress_pages() argument
382 zstd_cstream *stream = cc->private2; in zstd_compress_pages()
385 int src_size = cc->rlen; in zstd_compress_pages()
390 inbuf.src = cc->rbuf; in zstd_compress_pages()
394 outbuf.dst = cc->cbuf->cdata; in zstd_compress_pages()
400 KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, in zstd_compress_pages()
408 KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, in zstd_compress_pages()
420 cc->clen = outbuf.pos; in zstd_compress_pages()
508 static int lzorle_compress_pages(struct compress_ctx *cc) in lzorle_compress_pages() argument
512 ret = lzorle1x_1_compress(cc->rbuf, cc->rlen, cc->cbuf->cdata, in lzorle_compress_pages()
513 &cc->clen, cc->private); in lzorle_compress_pages()
516 KERN_ERR, F2FS_I_SB(cc->inode)->sb->s_id, ret); in lzorle_compress_pages()
617 static int f2fs_compress_pages(struct compress_ctx *cc) in f2fs_compress_pages() argument
619 struct f2fs_inode_info *fi = F2FS_I(cc->inode); in f2fs_compress_pages()
626 trace_f2fs_compress_pages_start(cc->inode, cc->cluster_idx, in f2fs_compress_pages()
627 cc->cluster_size, fi->i_compress_algorithm); in f2fs_compress_pages()
630 ret = cops->init_compress_ctx(cc); in f2fs_compress_pages()
635 max_len = COMPRESS_HEADER_SIZE + cc->clen; in f2fs_compress_pages()
636 cc->nr_cpages = DIV_ROUND_UP(max_len, PAGE_SIZE); in f2fs_compress_pages()
637 cc->valid_nr_cpages = cc->nr_cpages; in f2fs_compress_pages()
639 cc->cpages = page_array_alloc(cc->inode, cc->nr_cpages); in f2fs_compress_pages()
640 if (!cc->cpages) { in f2fs_compress_pages()
645 for (i = 0; i < cc->nr_cpages; i++) { in f2fs_compress_pages()
646 cc->cpages[i] = f2fs_compress_alloc_page(); in f2fs_compress_pages()
647 if (!cc->cpages[i]) { in f2fs_compress_pages()
653 cc->rbuf = f2fs_vmap(cc->rpages, cc->cluster_size); in f2fs_compress_pages()
654 if (!cc->rbuf) { in f2fs_compress_pages()
659 cc->cbuf = f2fs_vmap(cc->cpages, cc->nr_cpages); in f2fs_compress_pages()
660 if (!cc->cbuf) { in f2fs_compress_pages()
665 ret = cops->compress_pages(cc); in f2fs_compress_pages()
669 max_len = PAGE_SIZE * (cc->cluster_size - 1) - COMPRESS_HEADER_SIZE; in f2fs_compress_pages()
671 if (cc->clen > max_len) { in f2fs_compress_pages()
676 cc->cbuf->clen = cpu_to_le32(cc->clen); in f2fs_compress_pages()
679 chksum = f2fs_crc32(F2FS_I_SB(cc->inode), in f2fs_compress_pages()
680 cc->cbuf->cdata, cc->clen); in f2fs_compress_pages()
681 cc->cbuf->chksum = cpu_to_le32(chksum); in f2fs_compress_pages()
684 cc->cbuf->reserved[i] = cpu_to_le32(0); in f2fs_compress_pages()
686 new_nr_cpages = DIV_ROUND_UP(cc->clen + COMPRESS_HEADER_SIZE, PAGE_SIZE); in f2fs_compress_pages()
689 memset(&cc->cbuf->cdata[cc->clen], 0, in f2fs_compress_pages()
691 (cc->clen + COMPRESS_HEADER_SIZE)); in f2fs_compress_pages()
693 vm_unmap_ram(cc->cbuf, cc->nr_cpages); in f2fs_compress_pages()
694 vm_unmap_ram(cc->rbuf, cc->cluster_size); in f2fs_compress_pages()
696 for (i = 0; i < cc->nr_cpages; i++) { in f2fs_compress_pages()
699 f2fs_compress_free_page(cc->cpages[i]); in f2fs_compress_pages()
700 cc->cpages[i] = NULL; in f2fs_compress_pages()
704 cops->destroy_compress_ctx(cc); in f2fs_compress_pages()
706 cc->valid_nr_cpages = new_nr_cpages; in f2fs_compress_pages()
708 trace_f2fs_compress_pages_end(cc->inode, cc->cluster_idx, in f2fs_compress_pages()
709 cc->clen, ret); in f2fs_compress_pages()
713 vm_unmap_ram(cc->cbuf, cc->nr_cpages); in f2fs_compress_pages()
715 vm_unmap_ram(cc->rbuf, cc->cluster_size); in f2fs_compress_pages()
717 for (i = 0; i < cc->nr_cpages; i++) { in f2fs_compress_pages()
718 if (cc->cpages[i]) in f2fs_compress_pages()
719 f2fs_compress_free_page(cc->cpages[i]); in f2fs_compress_pages()
721 page_array_free(cc->inode, cc->cpages, cc->nr_cpages); in f2fs_compress_pages()
722 cc->cpages = NULL; in f2fs_compress_pages()
725 cops->destroy_compress_ctx(cc); in f2fs_compress_pages()
727 trace_f2fs_compress_pages_end(cc->inode, cc->cluster_idx, in f2fs_compress_pages()
728 cc->clen, ret); in f2fs_compress_pages()
821 static bool is_page_in_cluster(struct compress_ctx *cc, pgoff_t index) in is_page_in_cluster() argument
823 if (cc->cluster_idx == NULL_CLUSTER) in is_page_in_cluster()
825 return cc->cluster_idx == cluster_idx(cc, index); in is_page_in_cluster()
828 bool f2fs_cluster_is_empty(struct compress_ctx *cc) in f2fs_cluster_is_empty() argument
830 return cc->nr_rpages == 0; in f2fs_cluster_is_empty()
833 static bool f2fs_cluster_is_full(struct compress_ctx *cc) in f2fs_cluster_is_full() argument
835 return cc->cluster_size == cc->nr_rpages; in f2fs_cluster_is_full()
838 bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index) in f2fs_cluster_can_merge_page() argument
840 if (f2fs_cluster_is_empty(cc)) in f2fs_cluster_can_merge_page()
842 return is_page_in_cluster(cc, index); in f2fs_cluster_can_merge_page()
845 bool f2fs_all_cluster_page_ready(struct compress_ctx *cc, struct page **pages, in f2fs_all_cluster_page_ready() argument
855 if (uptodate && (pgidx % cc->cluster_size)) in f2fs_all_cluster_page_ready()
858 if (nr_pages - index < cc->cluster_size) in f2fs_all_cluster_page_ready()
861 for (; i < cc->cluster_size; i++) { in f2fs_all_cluster_page_ready()
871 static bool cluster_has_invalid_data(struct compress_ctx *cc) in cluster_has_invalid_data() argument
873 loff_t i_size = i_size_read(cc->inode); in cluster_has_invalid_data()
877 for (i = 0; i < cc->cluster_size; i++) { in cluster_has_invalid_data()
878 struct page *page = cc->rpages[i]; in cluster_has_invalid_data()
880 f2fs_bug_on(F2FS_I_SB(cc->inode), !page); in cluster_has_invalid_data()
986 static int f2fs_compressed_blocks(struct compress_ctx *cc) in f2fs_compressed_blocks() argument
988 return __f2fs_cluster_blocks(cc->inode, cc->cluster_idx, true); in f2fs_compressed_blocks()
999 static bool cluster_may_compress(struct compress_ctx *cc) in cluster_may_compress() argument
1001 if (!f2fs_need_compress_data(cc->inode)) in cluster_may_compress()
1003 if (f2fs_is_atomic_file(cc->inode)) in cluster_may_compress()
1005 if (!f2fs_cluster_is_full(cc)) in cluster_may_compress()
1007 if (unlikely(f2fs_cp_error(F2FS_I_SB(cc->inode)))) in cluster_may_compress()
1009 return !cluster_has_invalid_data(cc); in cluster_may_compress()
1012 static void set_cluster_writeback(struct compress_ctx *cc) in set_cluster_writeback() argument
1016 for (i = 0; i < cc->cluster_size; i++) { in set_cluster_writeback()
1017 if (cc->rpages[i]) in set_cluster_writeback()
1018 set_page_writeback(cc->rpages[i]); in set_cluster_writeback()
1022 static void set_cluster_dirty(struct compress_ctx *cc) in set_cluster_dirty() argument
1026 for (i = 0; i < cc->cluster_size; i++) in set_cluster_dirty()
1027 if (cc->rpages[i]) in set_cluster_dirty()
1028 set_page_dirty(cc->rpages[i]); in set_cluster_dirty()
1031 static int prepare_compress_overwrite(struct compress_ctx *cc, in prepare_compress_overwrite() argument
1034 struct f2fs_sb_info *sbi = F2FS_I_SB(cc->inode); in prepare_compress_overwrite()
1035 struct address_space *mapping = cc->inode->i_mapping; in prepare_compress_overwrite()
1039 pgoff_t start_idx = start_idx_of_cluster(cc); in prepare_compress_overwrite()
1043 ret = f2fs_is_compressed_cluster(cc->inode, start_idx); in prepare_compress_overwrite()
1047 ret = f2fs_init_compress_ctx(cc); in prepare_compress_overwrite()
1052 for (i = 0; i < cc->cluster_size; i++) { in prepare_compress_overwrite()
1063 f2fs_compress_ctx_add_page(cc, page); in prepare_compress_overwrite()
1066 if (!f2fs_cluster_is_empty(cc)) { in prepare_compress_overwrite()
1069 ret = f2fs_read_multi_pages(cc, &bio, cc->cluster_size, in prepare_compress_overwrite()
1071 f2fs_put_rpages(cc); in prepare_compress_overwrite()
1072 f2fs_destroy_compress_ctx(cc, true); in prepare_compress_overwrite()
1078 ret = f2fs_init_compress_ctx(cc); in prepare_compress_overwrite()
1083 for (i = 0; i < cc->cluster_size; i++) { in prepare_compress_overwrite()
1084 f2fs_bug_on(sbi, cc->rpages[i]); in prepare_compress_overwrite()
1093 f2fs_compress_ctx_add_page(cc, page); in prepare_compress_overwrite()
1097 f2fs_put_rpages(cc); in prepare_compress_overwrite()
1098 f2fs_unlock_rpages(cc, i + 1); in prepare_compress_overwrite()
1099 f2fs_destroy_compress_ctx(cc, true); in prepare_compress_overwrite()
1105 *fsdata = cc->rpages; in prepare_compress_overwrite()
1106 *pagep = cc->rpages[offset_in_cluster(cc, index)]; in prepare_compress_overwrite()
1107 return cc->cluster_size; in prepare_compress_overwrite()
1111 f2fs_put_rpages(cc); in prepare_compress_overwrite()
1112 f2fs_unlock_rpages(cc, i); in prepare_compress_overwrite()
1113 f2fs_destroy_compress_ctx(cc, true); in prepare_compress_overwrite()
1121 struct compress_ctx cc = { in f2fs_prepare_compress_overwrite() local
1130 return prepare_compress_overwrite(&cc, pagep, index, fsdata); in f2fs_prepare_compress_overwrite()
1137 struct compress_ctx cc = { in f2fs_compress_write_end() local
1143 bool first_index = (index == cc.rpages[0]->index); in f2fs_compress_write_end()
1146 set_cluster_dirty(&cc); in f2fs_compress_write_end()
1148 f2fs_put_rpages_wbc(&cc, NULL, false, 1); in f2fs_compress_write_end()
1149 f2fs_destroy_compress_ctx(&cc, false); in f2fs_compress_write_end()
1203 static int f2fs_write_compressed_pages(struct compress_ctx *cc, in f2fs_write_compressed_pages() argument
1208 struct inode *inode = cc->inode; in f2fs_write_compressed_pages()
1213 .ino = cc->inode->i_ino, in f2fs_write_compressed_pages()
1224 .encrypted = fscrypt_inode_uses_fs_layer_crypto(cc->inode), in f2fs_write_compressed_pages()
1229 pgoff_t start_idx = start_idx_of_cluster(cc); in f2fs_write_compressed_pages()
1230 unsigned int last_index = cc->cluster_size - 1; in f2fs_write_compressed_pages()
1236 mapping_set_error(cc->rpages[0]->mapping, -EIO); in f2fs_write_compressed_pages()
1251 set_new_dnode(&dn, cc->inode, NULL, NULL, 0); in f2fs_write_compressed_pages()
1257 for (i = 0; i < cc->cluster_size; i++) { in f2fs_write_compressed_pages()
1263 psize = (loff_t)(cc->rpages[last_index]->index + 1) << PAGE_SHIFT; in f2fs_write_compressed_pages()
1277 atomic_set(&cic->pending_pages, cc->valid_nr_cpages); in f2fs_write_compressed_pages()
1278 cic->rpages = page_array_alloc(cc->inode, cc->cluster_size); in f2fs_write_compressed_pages()
1282 cic->nr_rpages = cc->cluster_size; in f2fs_write_compressed_pages()
1284 for (i = 0; i < cc->valid_nr_cpages; i++) { in f2fs_write_compressed_pages()
1285 f2fs_set_compressed_page(cc->cpages[i], inode, in f2fs_write_compressed_pages()
1286 cc->rpages[i + 1]->index, cic); in f2fs_write_compressed_pages()
1287 fio.compressed_page = cc->cpages[i]; in f2fs_write_compressed_pages()
1296 fio.page = cc->rpages[i + 1]; in f2fs_write_compressed_pages()
1300 cc->cpages[i] = fio.encrypted_page; in f2fs_write_compressed_pages()
1304 set_cluster_writeback(cc); in f2fs_write_compressed_pages()
1306 for (i = 0; i < cc->cluster_size; i++) in f2fs_write_compressed_pages()
1307 cic->rpages[i] = cc->rpages[i]; in f2fs_write_compressed_pages()
1309 for (i = 0; i < cc->cluster_size; i++, dn.ofs_in_node++) { in f2fs_write_compressed_pages()
1313 fio.page = cc->rpages[i]; in f2fs_write_compressed_pages()
1329 if (i > cc->valid_nr_cpages) { in f2fs_write_compressed_pages()
1340 fio.encrypted_page = cc->cpages[i - 1]; in f2fs_write_compressed_pages()
1342 fio.compressed_page = cc->cpages[i - 1]; in f2fs_write_compressed_pages()
1344 cc->cpages[i - 1] = NULL; in f2fs_write_compressed_pages()
1348 inode_dec_dirty_pages(cc->inode); in f2fs_write_compressed_pages()
1354 f2fs_i_compr_blocks_update(inode, cc->valid_nr_cpages, true); in f2fs_write_compressed_pages()
1355 add_compr_block_stat(inode, cc->valid_nr_cpages); in f2fs_write_compressed_pages()
1357 set_inode_flag(cc->inode, FI_APPEND_WRITE); in f2fs_write_compressed_pages()
1358 if (cc->cluster_idx == 0) in f2fs_write_compressed_pages()
1372 f2fs_put_rpages(cc); in f2fs_write_compressed_pages()
1373 page_array_free(cc->inode, cc->cpages, cc->nr_cpages); in f2fs_write_compressed_pages()
1374 cc->cpages = NULL; in f2fs_write_compressed_pages()
1375 f2fs_destroy_compress_ctx(cc, false); in f2fs_write_compressed_pages()
1379 page_array_free(cc->inode, cic->rpages, cc->cluster_size); in f2fs_write_compressed_pages()
1382 fscrypt_finalize_bounce_page(&cc->cpages[i]); in f2fs_write_compressed_pages()
1393 for (i = 0; i < cc->valid_nr_cpages; i++) { in f2fs_write_compressed_pages()
1394 f2fs_compress_free_page(cc->cpages[i]); in f2fs_write_compressed_pages()
1395 cc->cpages[i] = NULL; in f2fs_write_compressed_pages()
1397 page_array_free(cc->inode, cc->cpages, cc->nr_cpages); in f2fs_write_compressed_pages()
1398 cc->cpages = NULL; in f2fs_write_compressed_pages()
1429 static int f2fs_write_raw_pages(struct compress_ctx *cc, in f2fs_write_raw_pages() argument
1434 struct address_space *mapping = cc->inode->i_mapping; in f2fs_write_raw_pages()
1437 compr_blocks = f2fs_compressed_blocks(cc); in f2fs_write_raw_pages()
1439 for (i = 0; i < cc->cluster_size; i++) { in f2fs_write_raw_pages()
1440 if (!cc->rpages[i]) in f2fs_write_raw_pages()
1443 redirty_page_for_writepage(wbc, cc->rpages[i]); in f2fs_write_raw_pages()
1444 unlock_page(cc->rpages[i]); in f2fs_write_raw_pages()
1450 for (i = 0; i < cc->cluster_size; i++) { in f2fs_write_raw_pages()
1451 if (!cc->rpages[i]) in f2fs_write_raw_pages()
1454 lock_page(cc->rpages[i]); in f2fs_write_raw_pages()
1456 if (cc->rpages[i]->mapping != mapping) { in f2fs_write_raw_pages()
1458 unlock_page(cc->rpages[i]); in f2fs_write_raw_pages()
1462 if (!PageDirty(cc->rpages[i])) in f2fs_write_raw_pages()
1465 if (!clear_page_dirty_for_io(cc->rpages[i])) in f2fs_write_raw_pages()
1468 ret = f2fs_write_single_data_page(cc->rpages[i], &_submitted, in f2fs_write_raw_pages()
1473 unlock_page(cc->rpages[i]); in f2fs_write_raw_pages()
1481 if (IS_NOQUOTA(cc->inode)) in f2fs_write_raw_pages()
1498 int f2fs_write_multi_pages(struct compress_ctx *cc, in f2fs_write_multi_pages() argument
1506 if (cluster_may_compress(cc)) { in f2fs_write_multi_pages()
1507 err = f2fs_compress_pages(cc); in f2fs_write_multi_pages()
1509 add_compr_block_stat(cc->inode, cc->cluster_size); in f2fs_write_multi_pages()
1512 f2fs_put_rpages_wbc(cc, wbc, true, 1); in f2fs_write_multi_pages()
1516 err = f2fs_write_compressed_pages(cc, submitted, in f2fs_write_multi_pages()
1520 f2fs_bug_on(F2FS_I_SB(cc->inode), err != -EAGAIN); in f2fs_write_multi_pages()
1523 f2fs_bug_on(F2FS_I_SB(cc->inode), *submitted); in f2fs_write_multi_pages()
1525 err = f2fs_write_raw_pages(cc, submitted, wbc, io_type); in f2fs_write_multi_pages()
1526 f2fs_put_rpages_wbc(cc, wbc, false, 0); in f2fs_write_multi_pages()
1528 f2fs_destroy_compress_ctx(cc, false); in f2fs_write_multi_pages()
1599 struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc) in f2fs_alloc_dic() argument
1602 pgoff_t start_idx = start_idx_of_cluster(cc); in f2fs_alloc_dic()
1603 struct f2fs_sb_info *sbi = F2FS_I_SB(cc->inode); in f2fs_alloc_dic()
1610 dic->rpages = page_array_alloc(cc->inode, cc->cluster_size); in f2fs_alloc_dic()
1617 dic->inode = cc->inode; in f2fs_alloc_dic()
1618 atomic_set(&dic->remaining_pages, cc->nr_cpages); in f2fs_alloc_dic()
1619 dic->cluster_idx = cc->cluster_idx; in f2fs_alloc_dic()
1620 dic->cluster_size = cc->cluster_size; in f2fs_alloc_dic()
1621 dic->log_cluster_size = cc->log_cluster_size; in f2fs_alloc_dic()
1622 dic->nr_cpages = cc->nr_cpages; in f2fs_alloc_dic()
1625 dic->need_verity = f2fs_need_verity(cc->inode, start_idx); in f2fs_alloc_dic()
1628 dic->rpages[i] = cc->rpages[i]; in f2fs_alloc_dic()
1629 dic->nr_rpages = cc->cluster_size; in f2fs_alloc_dic()
1646 f2fs_set_compressed_page(page, cc->inode, in f2fs_alloc_dic()