@@ -52,16 +52,14 @@ bool f2fs_is_compressed_page(struct page *page)
52
52
}
53
53
54
54
static void f2fs_set_compressed_page (struct page * page ,
55
- struct inode * inode , pgoff_t index , void * data , refcount_t * r )
55
+ struct inode * inode , pgoff_t index , void * data )
56
56
{
57
57
SetPagePrivate (page );
58
58
set_page_private (page , (unsigned long )data );
59
59
60
60
/* i_crypto_info and iv index */
61
61
page -> index = index ;
62
62
page -> mapping = inode -> i_mapping ;
63
- if (r )
64
- refcount_inc (r );
65
63
}
66
64
67
65
static void f2fs_put_compressed_page (struct page * page )
@@ -478,7 +476,7 @@ void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity)
478
476
vunmap (dic -> rbuf );
479
477
out_free_dic :
480
478
if (verity )
481
- refcount_add ( dic -> nr_cpages - 1 , & dic -> ref );
479
+ refcount_set ( & dic -> ref , dic -> nr_cpages );
482
480
if (!verity )
483
481
f2fs_decompress_end_io (dic -> rpages , dic -> cluster_size ,
484
482
ret , false);
@@ -834,7 +832,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
834
832
835
833
cic -> magic = F2FS_COMPRESSED_PAGE_MAGIC ;
836
834
cic -> inode = inode ;
837
- refcount_set (& cic -> ref , 1 );
835
+ refcount_set (& cic -> ref , cc -> nr_cpages );
838
836
cic -> rpages = f2fs_kzalloc (sbi , sizeof (struct page * ) <<
839
837
cc -> log_cluster_size , GFP_NOFS );
840
838
if (!cic -> rpages )
@@ -844,8 +842,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
844
842
845
843
for (i = 0 ; i < cc -> nr_cpages ; i ++ ) {
846
844
f2fs_set_compressed_page (cc -> cpages [i ], inode ,
847
- cc -> rpages [i + 1 ]-> index ,
848
- cic , i ? & cic -> ref : NULL );
845
+ cc -> rpages [i + 1 ]-> index , cic );
849
846
fio .compressed_page = cc -> cpages [i ];
850
847
if (fio .encrypted ) {
851
848
fio .page = cc -> rpages [i + 1 ];
@@ -1095,7 +1092,7 @@ struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc)
1095
1092
1096
1093
dic -> magic = F2FS_COMPRESSED_PAGE_MAGIC ;
1097
1094
dic -> inode = cc -> inode ;
1098
- refcount_set (& dic -> ref , 1 );
1095
+ refcount_set (& dic -> ref , cc -> nr_cpages );
1099
1096
dic -> cluster_idx = cc -> cluster_idx ;
1100
1097
dic -> cluster_size = cc -> cluster_size ;
1101
1098
dic -> log_cluster_size = cc -> log_cluster_size ;
@@ -1119,8 +1116,7 @@ struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc)
1119
1116
goto out_free ;
1120
1117
1121
1118
f2fs_set_compressed_page (page , cc -> inode ,
1122
- start_idx + i + 1 ,
1123
- dic , i ? & dic -> ref : NULL );
1119
+ start_idx + i + 1 , dic );
1124
1120
dic -> cpages [i ] = page ;
1125
1121
}
1126
1122
0 commit comments