Skip to content

Commit 42612e7

Browse files
committed
Merge tag 'f2fs-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs updates from Jaegeuk Kim: "In this round, we've added some knobs to enhance compression feature and harden testing environment. In addition, we've fixed several bugs reported from Android devices such as long discarding latency, device hanging during quota_sync, etc. Enhancements: - support lzo-rle algorithm - add two ioctls to release and reserve blocks for compression - support partial truncation/fiemap on compressed file - introduce sysfs entries to attach IO flags explicitly - add iostat trace point along with read io stat Bug fixes: - fix long discard latency - flush quota data by f2fs_quota_sync correctly - fix to recover parent inode number for power-cut recovery - fix lz4/zstd output buffer budget - parse checkpoint mount option correctly - avoid inifinite loop to wait for flushing node/meta pages - manage discard space correctly And some refactoring and clean up patches were added" * tag 'f2fs-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (51 commits) f2fs: attach IO flags to the missing cases f2fs: add node_io_flag for bio flags likewise data_io_flag f2fs: remove unused parameter of f2fs_put_rpages_mapping() f2fs: handle readonly filesystem in f2fs_ioc_shutdown() f2fs: avoid utf8_strncasecmp() with unstable name f2fs: don't return vmalloc() memory from f2fs_kmalloc() f2fs: fix retry logic in f2fs_write_cache_pages() f2fs: fix wrong discard space f2fs: compress: don't compress any datas after cp stop f2fs: remove unneeded return value of __insert_discard_tree() f2fs: fix wrong value of tracepoint parameter f2fs: protect new segment allocation in expand_inode_data f2fs: code cleanup by removing ifdef macro surrounding f2fs: avoid inifinite loop to wait for flushing node pages at cp_error f2fs: flush dirty meta pages when flushing them f2fs: fix checkpoint=disable:%u%% f2fs: compress: fix zstd data corruption f2fs: add compressed/gc data read IO stat f2fs: fix potential use-after-free issue f2fs: compress: don't handle non-compressed data in workqueue ...
2 parents ad57a10 + b7b911d commit 42612e7

File tree

25 files changed

+1580
-534
lines changed

25 files changed

+1580
-534
lines changed

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,3 +323,27 @@ What: /sys/fs/f2fs/<disk>/mounted_time_sec
323323
Date: February 2020
324324
Contact: "Jaegeuk Kim" <[email protected]>
325325
Description: Show the mounted time in secs of this partition.
326+
327+
What: /sys/fs/f2fs/<disk>/data_io_flag
328+
Date: April 2020
329+
Contact: "Jaegeuk Kim" <[email protected]>
330+
Description: Give a way to attach REQ_META|FUA to data writes
331+
given temperature-based bits. Now the bits indicate:
332+
* REQ_META | REQ_FUA |
333+
* 5 | 4 | 3 | 2 | 1 | 0 |
334+
* Cold | Warm | Hot | Cold | Warm | Hot |
335+
336+
What: /sys/fs/f2fs/<disk>/node_io_flag
337+
Date: June 2020
338+
Contact: "Jaegeuk Kim" <[email protected]>
339+
Description: Give a way to attach REQ_META|FUA to node writes
340+
given temperature-based bits. Now the bits indicate:
341+
* REQ_META | REQ_FUA |
342+
* 5 | 4 | 3 | 2 | 1 | 0 |
343+
* Cold | Warm | Hot | Cold | Warm | Hot |
344+
345+
What: /sys/fs/f2fs/<disk>/iostat_period_ms
346+
Date: April 2020
347+
Contact: "Daeho Jeong" <[email protected]>
348+
Description: Give a way to change iostat_period time. 3secs by default.
349+
The new iostat trace gives stats gap given the period.

Documentation/filesystems/f2fs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ checkpoint=%s[:%u[%]] Set to "disable" to turn off checkpointing. Set to "enabl
248248
would be unusable can be viewed at /sys/fs/f2fs/<disk>/unusable
249249
This space is reclaimed once checkpoint=enable.
250250
compress_algorithm=%s Control compress algorithm, currently f2fs supports "lzo",
251-
"lz4" and "zstd" algorithm.
251+
"lz4", "zstd" and "lzo-rle" algorithm.
252252
compress_log_size=%u Support configuring compress cluster size, the size will
253253
be 4KB * (1 << %u), 16KB is minimum size, also it's
254254
default size.

fs/f2fs/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,13 @@ config F2FS_FS_ZSTD
127127
default y
128128
help
129129
Support ZSTD compress algorithm, if unsure, say Y.
130+
131+
config F2FS_FS_LZORLE
132+
bool "LZO-RLE compression support"
133+
depends on F2FS_FS_COMPRESSION
134+
depends on F2FS_FS_LZO
135+
select LZO_COMPRESS
136+
select LZO_DECOMPRESS
137+
default y
138+
help
139+
Support LZO-RLE compress algorithm, if unsure, say Y.

fs/f2fs/acl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: GPL-2.0
1+
/* SPDX-License-Identifier: GPL-2.0 */
22
/*
33
* fs/f2fs/acl.h
44
*

fs/f2fs/checkpoint.c

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index,
8686
return ERR_PTR(err);
8787
}
8888

89+
f2fs_update_iostat(sbi, FS_META_READ_IO, F2FS_BLKSIZE);
90+
8991
lock_page(page);
9092
if (unlikely(page->mapping != mapping)) {
9193
f2fs_put_page(page, 1);
@@ -220,6 +222,7 @@ int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
220222
.is_por = (type == META_POR),
221223
};
222224
struct blk_plug plug;
225+
int err;
223226

224227
if (unlikely(type == META_POR))
225228
fio.op_flags &= ~REQ_META;
@@ -263,8 +266,11 @@ int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
263266
}
264267

265268
fio.page = page;
266-
f2fs_submit_page_bio(&fio);
267-
f2fs_put_page(page, 0);
269+
err = f2fs_submit_page_bio(&fio);
270+
f2fs_put_page(page, err ? 1 : 0);
271+
272+
if (!err)
273+
f2fs_update_iostat(sbi, FS_META_READ_IO, F2FS_BLKSIZE);
268274
}
269275
out:
270276
blk_finish_plug(&plug);
@@ -889,8 +895,8 @@ int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi)
889895
int i;
890896
int err;
891897

892-
sbi->ckpt = f2fs_kzalloc(sbi, array_size(blk_size, cp_blks),
893-
GFP_KERNEL);
898+
sbi->ckpt = f2fs_kvzalloc(sbi, array_size(blk_size, cp_blks),
899+
GFP_KERNEL);
894900
if (!sbi->ckpt)
895901
return -ENOMEM;
896902
/*
@@ -1160,10 +1166,12 @@ static int block_operations(struct f2fs_sb_info *sbi)
11601166
.nr_to_write = LONG_MAX,
11611167
.for_reclaim = 0,
11621168
};
1163-
struct blk_plug plug;
11641169
int err = 0, cnt = 0;
11651170

1166-
blk_start_plug(&plug);
1171+
/*
1172+
* Let's flush inline_data in dirty node pages.
1173+
*/
1174+
f2fs_flush_inline_data(sbi);
11671175

11681176
retry_flush_quotas:
11691177
f2fs_lock_all(sbi);
@@ -1192,7 +1200,7 @@ static int block_operations(struct f2fs_sb_info *sbi)
11921200
f2fs_unlock_all(sbi);
11931201
err = f2fs_sync_dirty_inodes(sbi, DIR_INODE);
11941202
if (err)
1195-
goto out;
1203+
return err;
11961204
cond_resched();
11971205
goto retry_flush_quotas;
11981206
}
@@ -1208,7 +1216,7 @@ static int block_operations(struct f2fs_sb_info *sbi)
12081216
f2fs_unlock_all(sbi);
12091217
err = f2fs_sync_inode_meta(sbi);
12101218
if (err)
1211-
goto out;
1219+
return err;
12121220
cond_resched();
12131221
goto retry_flush_quotas;
12141222
}
@@ -1224,7 +1232,7 @@ static int block_operations(struct f2fs_sb_info *sbi)
12241232
if (err) {
12251233
up_write(&sbi->node_change);
12261234
f2fs_unlock_all(sbi);
1227-
goto out;
1235+
return err;
12281236
}
12291237
cond_resched();
12301238
goto retry_flush_nodes;
@@ -1236,8 +1244,6 @@ static int block_operations(struct f2fs_sb_info *sbi)
12361244
*/
12371245
__prepare_cp_block(sbi);
12381246
up_write(&sbi->node_change);
1239-
out:
1240-
blk_finish_plug(&plug);
12411247
return err;
12421248
}
12431249

@@ -1260,6 +1266,9 @@ void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type)
12601266
if (unlikely(f2fs_cp_error(sbi)))
12611267
break;
12621268

1269+
if (type == F2FS_DIRTY_META)
1270+
f2fs_sync_meta_pages(sbi, META, LONG_MAX,
1271+
FS_CP_META_IO);
12631272
io_schedule_timeout(DEFAULT_IO_TIMEOUT);
12641273
}
12651274
finish_wait(&sbi->cp_wait, &wait);
@@ -1553,7 +1562,8 @@ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
15531562
return 0;
15541563
f2fs_warn(sbi, "Start checkpoint disabled!");
15551564
}
1556-
mutex_lock(&sbi->cp_mutex);
1565+
if (cpc->reason != CP_RESIZE)
1566+
mutex_lock(&sbi->cp_mutex);
15571567

15581568
if (!is_sbi_flag_set(sbi, SBI_IS_DIRTY) &&
15591569
((cpc->reason & CP_FASTBOOT) || (cpc->reason & CP_SYNC) ||
@@ -1622,7 +1632,8 @@ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
16221632
f2fs_update_time(sbi, CP_TIME);
16231633
trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "finish checkpoint");
16241634
out:
1625-
mutex_unlock(&sbi->cp_mutex);
1635+
if (cpc->reason != CP_RESIZE)
1636+
mutex_unlock(&sbi->cp_mutex);
16261637
return err;
16271638
}
16281639

0 commit comments

Comments
 (0)