Skip to contentSkip to conversation

f2fs: issue small discard by LBA order

PATCH New Chao Yu 1 participant 1 message Jul 8, 2018 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH v2 2/2 f2fs: issue small discard by LBA order

From: Chao Yu <[email protected]>

For small granularity discard which size is smaller than 64KB, if we issue those kind of discards orderly by size, their IOs will be spread into entire logical address, so that in FTL, L2P table will be updated randomly, result bad wear rate in the table.

In this patch, we choose to issue small discard by LBA order, by this way, we can expect that L2P table updates from adjacent discard IOs can be merged in the cache, so it can reduce lifetime wearing of flash.

---
v2:
- remove unneeded header file.
- don't retry submission if there is queued IO.

 fs/f2fs/f2fs.h    |  2 ++
 fs/f2fs/segment.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
fs/f2fs/f2fs.h +2 -0
index bf5f7a336ace..c48b655d5d8d 100644
@@ -297,6 +297,7 @@ struct discard_policy {
 	unsigned int io_aware_gran;	/* minimum granularity discard not be aware of I/O */
 	bool io_aware;			/* issue discard in idle time */
 	bool sync;			/* submit discard with REQ_SYNC flag */
+	bool ordered;			/* issue discard by lba order */
 	unsigned int granularity;	/* discard granularity */
 };
 
@@ -313,6 +314,7 @@ struct discard_cmd_control {
 	unsigned int max_discards;		/* max. discards to be issued */
 	unsigned int discard_granularity;	/* discard granularity */
 	unsigned int undiscard_blks;		/* # of undiscard blocks */
+	unsigned int next_pos;			/* next discard position */
 	atomic_t issued_discard;		/* # of issued discard */
 	atomic_t issing_discard;		/* # of issing discard */
 	atomic_t discard_cmd_cnt;		/* # of cached cmd count */
fs/f2fs/segment.c +64 -0

94 lines not on this page · raw message

Signature · 1 line
2.16.2.17.g38e79b1fd