linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] misc f2fs cleanups
@ 2023-01-19  6:36 Christoph Hellwig
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry Christoph Hellwig
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

Hi all,

a bunch of random cleanups found by code inspection.

Diffstat:
 checkpoint.c |   22 ++++-----
 file.c       |   60 +++++++++++---------------
 segment.c    |  134 +++++++++++++++++++++--------------------------------------
 segment.h    |    6 --
 4 files changed, 84 insertions(+), 138 deletions(-)


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry
  2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
@ 2023-01-19  6:36 ` Christoph Hellwig
  2023-01-29 10:29   ` Chao Yu
  2023-01-31 19:10   ` patchwork-bot+f2fs
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 2/8] f2fs: simplify do_checkpoint Christoph Hellwig
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

This function just assigns a summary entry.  This can be done entirely
typesafe with an open code struct assignment that relies on array
indexing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/segment.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 311243dda4cefa..ec6880213e8fa9 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2323,19 +2323,6 @@ bool f2fs_is_checkpointed_data(struct f2fs_sb_info *sbi, block_t blkaddr)
 	return is_cp;
 }
 
-/*
- * This function should be resided under the curseg_mutex lock
- */
-static void __add_sum_entry(struct f2fs_sb_info *sbi, int type,
-					struct f2fs_summary *sum)
-{
-	struct curseg_info *curseg = CURSEG_I(sbi, type);
-	void *addr = curseg->sum_blk;
-
-	addr += curseg->next_blkoff * sizeof(struct f2fs_summary);
-	memcpy(addr, sum, sizeof(struct f2fs_summary));
-}
-
 /*
  * Calculate the number of current summary pages for writing
  */
@@ -3262,13 +3249,7 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 
 	f2fs_wait_discard_bio(sbi, *new_blkaddr);
 
-	/*
-	 * __add_sum_entry should be resided under the curseg_mutex
-	 * because, this function updates a summary entry in the
-	 * current summary block.
-	 */
-	__add_sum_entry(sbi, type, sum);
-
+	curseg->sum_blk->entries[curseg->next_blkoff] = *sum;
 	__refresh_next_blkoff(sbi, curseg);
 
 	stat_inc_block_count(sbi, curseg);
@@ -3571,7 +3552,7 @@ void f2fs_do_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
 	}
 
 	curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, new_blkaddr);
-	__add_sum_entry(sbi, type, sum);
+	curseg->sum_blk->entries[curseg->next_blkoff] = *sum;
 
 	if (!recover_curseg || recover_newaddr) {
 		if (!from_gc)
-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [f2fs-dev] [PATCH 2/8] f2fs: simplify do_checkpoint
  2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry Christoph Hellwig
@ 2023-01-19  6:36 ` Christoph Hellwig
  2023-01-29 10:30   ` Chao Yu
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 3/8] f2fs: add a f2fs_curseg_valid_blocks helper Christoph Hellwig
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

For each loop add a local curseg_info pointer insted of looking it up
for each of the three fields.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/checkpoint.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index d68b3c991888df..641165c8299231 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1470,20 +1470,18 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 	ckpt->elapsed_time = cpu_to_le64(get_mtime(sbi, true));
 	ckpt->free_segment_count = cpu_to_le32(free_segments(sbi));
 	for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) {
-		ckpt->cur_node_segno[i] =
-			cpu_to_le32(curseg_segno(sbi, i + CURSEG_HOT_NODE));
-		ckpt->cur_node_blkoff[i] =
-			cpu_to_le16(curseg_blkoff(sbi, i + CURSEG_HOT_NODE));
-		ckpt->alloc_type[i + CURSEG_HOT_NODE] =
-				curseg_alloc_type(sbi, i + CURSEG_HOT_NODE);
+		struct curseg_info *curseg = CURSEG_I(sbi, i + CURSEG_HOT_NODE);
+
+		ckpt->cur_node_segno[i] = cpu_to_le32(curseg->segno);
+		ckpt->cur_node_blkoff[i] = cpu_to_le16(curseg->next_blkoff);
+		ckpt->alloc_type[i + CURSEG_HOT_NODE] = curseg->alloc_type;
 	}
 	for (i = 0; i < NR_CURSEG_DATA_TYPE; i++) {
-		ckpt->cur_data_segno[i] =
-			cpu_to_le32(curseg_segno(sbi, i + CURSEG_HOT_DATA));
-		ckpt->cur_data_blkoff[i] =
-			cpu_to_le16(curseg_blkoff(sbi, i + CURSEG_HOT_DATA));
-		ckpt->alloc_type[i + CURSEG_HOT_DATA] =
-				curseg_alloc_type(sbi, i + CURSEG_HOT_DATA);
+		struct curseg_info *curseg = CURSEG_I(sbi, i + CURSEG_HOT_DATA);
+
+		ckpt->cur_data_segno[i] = cpu_to_le32(curseg->segno);;
+		ckpt->cur_data_blkoff[i] = cpu_to_le16(curseg->next_blkoff);
+		ckpt->alloc_type[i + CURSEG_HOT_DATA] = curseg->alloc_type;
 	}
 
 	/* 2 cp + n data seg summary + orphan inode blocks */
-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [f2fs-dev] [PATCH 3/8] f2fs: add a f2fs_curseg_valid_blocks helper
  2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry Christoph Hellwig
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 2/8] f2fs: simplify do_checkpoint Christoph Hellwig
@ 2023-01-19  6:36 ` Christoph Hellwig
  2023-01-29 10:34   ` Chao Yu
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 4/8] f2fs: factor the read/write tracing logic into a helper Christoph Hellwig
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

Add a helper to return the valid blocks on log and SSR segments, and
replace the last two uses of curseg_blkoff with it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/segment.c | 32 +++++++++++++++-----------------
 fs/f2fs/segment.h |  6 ------
 2 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index ec6880213e8fa9..ad323b6e8609cd 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2323,6 +2323,15 @@ bool f2fs_is_checkpointed_data(struct f2fs_sb_info *sbi, block_t blkaddr)
 	return is_cp;
 }
 
+static unsigned short f2fs_curseg_valid_blocks(struct f2fs_sb_info *sbi, int type)
+{
+	struct curseg_info *curseg = CURSEG_I(sbi, type);
+
+	if (sbi->ckpt->alloc_type[type] == SSR)
+		return sbi->blocks_per_seg;
+	return curseg->next_blkoff;
+}
+
 /*
  * Calculate the number of current summary pages for writing
  */
@@ -2332,15 +2341,11 @@ int f2fs_npages_for_summary_flush(struct f2fs_sb_info *sbi, bool for_ra)
 	int i, sum_in_page;
 
 	for (i = CURSEG_HOT_DATA; i <= CURSEG_COLD_DATA; i++) {
-		if (sbi->ckpt->alloc_type[i] == SSR)
-			valid_sum_count += sbi->blocks_per_seg;
-		else {
-			if (for_ra)
-				valid_sum_count += le16_to_cpu(
-					F2FS_CKPT(sbi)->cur_data_blkoff[i]);
-			else
-				valid_sum_count += curseg_blkoff(sbi, i);
-		}
+		if (sbi->ckpt->alloc_type[i] != SSR && for_ra)
+			valid_sum_count +=
+				le16_to_cpu(F2FS_CKPT(sbi)->cur_data_blkoff[i]);
+		else
+			valid_sum_count += f2fs_curseg_valid_blocks(sbi, i);
 	}
 
 	sum_in_page = (PAGE_SIZE - 2 * SUM_JOURNAL_SIZE -
@@ -3861,15 +3866,8 @@ static void write_compacted_summaries(struct f2fs_sb_info *sbi, block_t blkaddr)
 
 	/* Step 3: write summary entries */
 	for (i = CURSEG_HOT_DATA; i <= CURSEG_COLD_DATA; i++) {
-		unsigned short blkoff;
-
 		seg_i = CURSEG_I(sbi, i);
-		if (sbi->ckpt->alloc_type[i] == SSR)
-			blkoff = sbi->blocks_per_seg;
-		else
-			blkoff = curseg_blkoff(sbi, i);
-
-		for (j = 0; j < blkoff; j++) {
+		for (j = 0; j < f2fs_curseg_valid_blocks(sbi, i); j++) {
 			if (!page) {
 				page = f2fs_grab_meta_page(sbi, blkaddr++);
 				kaddr = (unsigned char *)page_address(page);
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index ad6a9c19f46a48..0f3f05cb8c29f5 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -710,12 +710,6 @@ static inline unsigned char curseg_alloc_type(struct f2fs_sb_info *sbi,
 	return curseg->alloc_type;
 }
 
-static inline unsigned short curseg_blkoff(struct f2fs_sb_info *sbi, int type)
-{
-	struct curseg_info *curseg = CURSEG_I(sbi, type);
-	return curseg->next_blkoff;
-}
-
 static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int segno)
 {
 	f2fs_bug_on(sbi, segno > TOTAL_SEGS(sbi) - 1);
-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [f2fs-dev] [PATCH 4/8] f2fs: factor the read/write tracing logic into a helper
  2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
                   ` (2 preceding siblings ...)
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 3/8] f2fs: add a f2fs_curseg_valid_blocks helper Christoph Hellwig
@ 2023-01-19  6:36 ` Christoph Hellwig
  2023-01-29 10:36   ` Chao Yu
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 5/8] f2fs: refactor __allocate_new_segment Christoph Hellwig
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

Factor the logic to log a path for reads and writs into a helper
shared between the read_iter and write_iter methods.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/file.c | 60 +++++++++++++++++++++-----------------------------
 1 file changed, 25 insertions(+), 35 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index f5c1b78149540c..305be6ac024196 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4340,6 +4340,27 @@ static ssize_t f2fs_dio_read_iter(struct kiocb *iocb, struct iov_iter *to)
 	return ret;
 }
 
+static void f2fs_trace_rw_file_path(struct kiocb *iocb, size_t count, int rw)
+{
+	struct inode *inode = file_inode(iocb->ki_filp);
+	char *buf, *path;
+
+	buf = f2fs_kmalloc(F2FS_I_SB(inode), PATH_MAX, GFP_KERNEL);
+	if (!buf)
+		return;
+	path = dentry_path_raw(file_dentry(iocb->ki_filp), buf, PATH_MAX);
+	if (IS_ERR(path))
+		goto free_buf;
+	if (rw == WRITE)
+		trace_f2fs_datawrite_start(inode, iocb->ki_pos, count,
+				current->pid, path, current->comm);
+	else
+		trace_f2fs_dataread_start(inode, iocb->ki_pos, count,
+				current->pid, path, current->comm);
+free_buf:
+	kfree(buf);
+}
+
 static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 {
 	struct inode *inode = file_inode(iocb->ki_filp);
@@ -4349,24 +4370,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 	if (!f2fs_is_compress_backend_ready(inode))
 		return -EOPNOTSUPP;
 
-	if (trace_f2fs_dataread_start_enabled()) {
-		char *p = f2fs_kmalloc(F2FS_I_SB(inode), PATH_MAX, GFP_KERNEL);
-		char *path;
-
-		if (!p)
-			goto skip_read_trace;
+	if (trace_f2fs_dataread_start_enabled())
+		f2fs_trace_rw_file_path(iocb, iov_iter_count(to), READ);
 
-		path = dentry_path_raw(file_dentry(iocb->ki_filp), p, PATH_MAX);
-		if (IS_ERR(path)) {
-			kfree(p);
-			goto skip_read_trace;
-		}
-
-		trace_f2fs_dataread_start(inode, pos, iov_iter_count(to),
-					current->pid, path, current->comm);
-		kfree(p);
-	}
-skip_read_trace:
 	if (f2fs_should_use_dio(inode, iocb, to)) {
 		ret = f2fs_dio_read_iter(iocb, to);
 	} else {
@@ -4672,24 +4678,8 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	if (preallocated < 0) {
 		ret = preallocated;
 	} else {
-		if (trace_f2fs_datawrite_start_enabled()) {
-			char *p = f2fs_kmalloc(F2FS_I_SB(inode),
-						PATH_MAX, GFP_KERNEL);
-			char *path;
-
-			if (!p)
-				goto skip_write_trace;
-			path = dentry_path_raw(file_dentry(iocb->ki_filp),
-								p, PATH_MAX);
-			if (IS_ERR(path)) {
-				kfree(p);
-				goto skip_write_trace;
-			}
-			trace_f2fs_datawrite_start(inode, orig_pos, orig_count,
-					current->pid, path, current->comm);
-			kfree(p);
-		}
-skip_write_trace:
+		f2fs_trace_rw_file_path(iocb, orig_count, WRITE);
+
 		/* Do the actual write. */
 		ret = dio ?
 			f2fs_dio_write_iter(iocb, from, &may_need_sync) :
-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [f2fs-dev] [PATCH 5/8] f2fs: refactor __allocate_new_segment
  2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
                   ` (3 preceding siblings ...)
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 4/8] f2fs: factor the read/write tracing logic into a helper Christoph Hellwig
@ 2023-01-19  6:36 ` Christoph Hellwig
  2023-01-29 10:39   ` Chao Yu
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 6/8] f2fs: remove __allocate_new_section Christoph Hellwig
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

Simplify the check whether to allocate a new segment or reuse an open
one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/segment.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index ad323b6e8609cd..b25ee37d0375e2 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2897,16 +2897,12 @@ static void __allocate_new_segment(struct f2fs_sb_info *sbi, int type,
 	struct curseg_info *curseg = CURSEG_I(sbi, type);
 	unsigned int old_segno;
 
-	if (!curseg->inited)
-		goto alloc;
-
-	if (force || curseg->next_blkoff ||
-		get_valid_blocks(sbi, curseg->segno, new_sec))
-		goto alloc;
-
-	if (!get_ckpt_valid_blocks(sbi, curseg->segno, new_sec))
+	if (!force && curseg->inited &&
+	    !curseg->next_blkoff &&
+	    !get_valid_blocks(sbi, curseg->segno, new_sec) &&
+	    !get_ckpt_valid_blocks(sbi, curseg->segno, new_sec))
 		return;
-alloc:
+
 	old_segno = curseg->segno;
 	new_curseg(sbi, type, true);
 	stat_inc_seg_type(sbi, curseg);
-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [f2fs-dev] [PATCH 6/8] f2fs: remove __allocate_new_section
  2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
                   ` (4 preceding siblings ...)
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 5/8] f2fs: refactor __allocate_new_segment Christoph Hellwig
@ 2023-01-19  6:36 ` Christoph Hellwig
  2023-01-29 10:39   ` Chao Yu
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 7/8] f2fs: refactor next blk selection Christoph Hellwig
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 8/8] f2fs: remove __has_curseg_space Christoph Hellwig
  7 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

Just fold this trivial wrapper into the only caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/segment.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index b25ee37d0375e2..f889f623a59fd6 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2909,17 +2909,11 @@ static void __allocate_new_segment(struct f2fs_sb_info *sbi, int type,
 	locate_dirty_segment(sbi, old_segno);
 }
 
-static void __allocate_new_section(struct f2fs_sb_info *sbi,
-						int type, bool force)
-{
-	__allocate_new_segment(sbi, type, true, force);
-}
-
 void f2fs_allocate_new_section(struct f2fs_sb_info *sbi, int type, bool force)
 {
 	f2fs_down_read(&SM_I(sbi)->curseg_lock);
 	down_write(&SIT_I(sbi)->sentry_lock);
-	__allocate_new_section(sbi, type, force);
+	__allocate_new_segment(sbi, type, true, force);
 	up_write(&SIT_I(sbi)->sentry_lock);
 	f2fs_up_read(&SM_I(sbi)->curseg_lock);
 }
-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [f2fs-dev] [PATCH 7/8] f2fs: refactor next blk selection
  2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
                   ` (5 preceding siblings ...)
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 6/8] f2fs: remove __allocate_new_section Christoph Hellwig
@ 2023-01-19  6:36 ` Christoph Hellwig
  2023-01-29 12:20   ` Chao Yu
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 8/8] f2fs: remove __has_curseg_space Christoph Hellwig
  7 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

Remove __refresh_next_blkoff by opencoding the SSR vs LFS segment check
in the only caller, and then add helpers for SSR block selection and
blkoff randomization instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/segment.c | 48 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index f889f623a59fd6..6f588e440c7575 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2616,30 +2616,10 @@ static int __next_free_blkoff(struct f2fs_sb_info *sbi,
 	return __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, start);
 }
 
-/*
- * If a segment is written by LFS manner, next block offset is just obtained
- * by increasing the current block offset. However, if a segment is written by
- * SSR manner, next block offset obtained by calling __next_free_blkoff
- */
-static void __refresh_next_blkoff(struct f2fs_sb_info *sbi,
-				struct curseg_info *seg)
+static int f2fs_find_next_ssr_block(struct f2fs_sb_info *sbi,
+		struct curseg_info *seg)
 {
-	if (seg->alloc_type == SSR) {
-		seg->next_blkoff =
-			__next_free_blkoff(sbi, seg->segno,
-						seg->next_blkoff + 1);
-	} else {
-		seg->next_blkoff++;
-		if (F2FS_OPTION(sbi).fs_mode == FS_MODE_FRAGMENT_BLK) {
-			/* To allocate block chunks in different sizes, use random number */
-			if (--seg->fragment_remained_chunk <= 0) {
-				seg->fragment_remained_chunk =
-				   get_random_u32_inclusive(1, sbi->max_fragment_chunk);
-				seg->next_blkoff +=
-				   get_random_u32_inclusive(1, sbi->max_fragment_hole);
-			}
-		}
-	}
+	return __next_free_blkoff(sbi, seg->segno, seg->next_blkoff + 1);
 }
 
 bool f2fs_segment_has_free_slot(struct f2fs_sb_info *sbi, int segno)
@@ -3216,6 +3196,19 @@ static int __get_segment_type(struct f2fs_io_info *fio)
 	return type;
 }
 
+static void f2fs_randomize_chunk(struct f2fs_sb_info *sbi,
+		struct curseg_info *seg)
+{
+	/* To allocate block chunks in different sizes, use random number */
+	if (--seg->fragment_remained_chunk > 0)
+		return;
+
+	seg->fragment_remained_chunk =
+		get_random_u32_inclusive(1, sbi->max_fragment_chunk);
+	seg->next_blkoff +=
+		get_random_u32_inclusive(1, sbi->max_fragment_hole);
+}
+
 void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 		block_t old_blkaddr, block_t *new_blkaddr,
 		struct f2fs_summary *sum, int type,
@@ -3245,8 +3238,13 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 	f2fs_wait_discard_bio(sbi, *new_blkaddr);
 
 	curseg->sum_blk->entries[curseg->next_blkoff] = *sum;
-	__refresh_next_blkoff(sbi, curseg);
-
+	if (curseg->alloc_type == SSR) {
+		curseg->next_blkoff = f2fs_find_next_ssr_block(sbi, curseg);
+	} else {
+		curseg->next_blkoff++;
+		if (F2FS_OPTION(sbi).fs_mode == FS_MODE_FRAGMENT_BLK)
+			f2fs_randomize_chunk(sbi, curseg);
+	}
 	stat_inc_block_count(sbi, curseg);
 
 	if (from_gc) {
-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [f2fs-dev] [PATCH 8/8] f2fs: remove __has_curseg_space
  2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
                   ` (6 preceding siblings ...)
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 7/8] f2fs: refactor next blk selection Christoph Hellwig
@ 2023-01-19  6:36 ` Christoph Hellwig
  2023-01-29 12:24   ` Chao Yu
  7 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2023-01-19  6:36 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: linux-f2fs-devel

Just open code the logic in the only caller, where it is more
obvious.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/segment.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 6f588e440c7575..4646c2ca2d55c2 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3071,13 +3071,6 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
 	return err;
 }
 
-static bool __has_curseg_space(struct f2fs_sb_info *sbi,
-					struct curseg_info *curseg)
-{
-	return curseg->next_blkoff < f2fs_usable_blks_in_seg(sbi,
-							curseg->segno);
-}
-
 int f2fs_rw_hint_to_seg_type(enum rw_hint hint)
 {
 	switch (hint) {
@@ -3219,6 +3212,7 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 	unsigned long long old_mtime;
 	bool from_gc = (type == CURSEG_ALL_DATA_ATGC);
 	struct seg_entry *se = NULL;
+	bool segment_full = false;
 
 	f2fs_down_read(&SM_I(sbi)->curseg_lock);
 
@@ -3245,6 +3239,8 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 		if (F2FS_OPTION(sbi).fs_mode == FS_MODE_FRAGMENT_BLK)
 			f2fs_randomize_chunk(sbi, curseg);
 	}
+	if (curseg->next_blkoff >= f2fs_usable_blks_in_seg(sbi, curseg->segno))
+		segment_full = true;
 	stat_inc_block_count(sbi, curseg);
 
 	if (from_gc) {
@@ -3263,10 +3259,11 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
 	if (GET_SEGNO(sbi, old_blkaddr) != NULL_SEGNO)
 		update_sit_entry(sbi, old_blkaddr, -1);
 
-	if (!__has_curseg_space(sbi, curseg)) {
-		/*
-		 * Flush out current segment and replace it with new segment.
-		 */
+	/*
+	 * If the current segment is full, flush it out and replace it with a
+	 * new segment.
+	 */
+	if (segment_full) {
 		if (from_gc) {
 			get_atssr_segment(sbi, type, se->type,
 						AT_SSR, se->mtime);
-- 
2.39.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry Christoph Hellwig
@ 2023-01-29 10:29   ` Chao Yu
  2023-01-31 19:10   ` patchwork-bot+f2fs
  1 sibling, 0 replies; 19+ messages in thread
From: Chao Yu @ 2023-01-29 10:29 UTC (permalink / raw)
  To: Christoph Hellwig, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2023/1/19 14:36, Christoph Hellwig wrote:
> This function just assigns a summary entry.  This can be done entirely
> typesafe with an open code struct assignment that relies on array
> indexing.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 2/8] f2fs: simplify do_checkpoint
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 2/8] f2fs: simplify do_checkpoint Christoph Hellwig
@ 2023-01-29 10:30   ` Chao Yu
  0 siblings, 0 replies; 19+ messages in thread
From: Chao Yu @ 2023-01-29 10:30 UTC (permalink / raw)
  To: Christoph Hellwig, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2023/1/19 14:36, Christoph Hellwig wrote:
> For each loop add a local curseg_info pointer insted of looking it up
> for each of the three fields.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 3/8] f2fs: add a f2fs_curseg_valid_blocks helper
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 3/8] f2fs: add a f2fs_curseg_valid_blocks helper Christoph Hellwig
@ 2023-01-29 10:34   ` Chao Yu
  0 siblings, 0 replies; 19+ messages in thread
From: Chao Yu @ 2023-01-29 10:34 UTC (permalink / raw)
  To: Christoph Hellwig, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2023/1/19 14:36, Christoph Hellwig wrote:
> Add a helper to return the valid blocks on log and SSR segments, and
> replace the last two uses of curseg_blkoff with it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 4/8] f2fs: factor the read/write tracing logic into a helper
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 4/8] f2fs: factor the read/write tracing logic into a helper Christoph Hellwig
@ 2023-01-29 10:36   ` Chao Yu
  2023-01-30 23:00     ` Jaegeuk Kim
  0 siblings, 1 reply; 19+ messages in thread
From: Chao Yu @ 2023-01-29 10:36 UTC (permalink / raw)
  To: Christoph Hellwig, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2023/1/19 14:36, Christoph Hellwig wrote:
> Factor the logic to log a path for reads and writs into a helper
> shared between the read_iter and write_iter methods.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   fs/f2fs/file.c | 60 +++++++++++++++++++++-----------------------------
>   1 file changed, 25 insertions(+), 35 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index f5c1b78149540c..305be6ac024196 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4340,6 +4340,27 @@ static ssize_t f2fs_dio_read_iter(struct kiocb *iocb, struct iov_iter *to)
>   	return ret;
>   }
>   
> +static void f2fs_trace_rw_file_path(struct kiocb *iocb, size_t count, int rw)
> +{
> +	struct inode *inode = file_inode(iocb->ki_filp);
> +	char *buf, *path;
> +
> +	buf = f2fs_kmalloc(F2FS_I_SB(inode), PATH_MAX, GFP_KERNEL);
> +	if (!buf)
> +		return;
> +	path = dentry_path_raw(file_dentry(iocb->ki_filp), buf, PATH_MAX);
> +	if (IS_ERR(path))
> +		goto free_buf;
> +	if (rw == WRITE)
> +		trace_f2fs_datawrite_start(inode, iocb->ki_pos, count,
> +				current->pid, path, current->comm);
> +	else
> +		trace_f2fs_dataread_start(inode, iocb->ki_pos, count,
> +				current->pid, path, current->comm);
> +free_buf:
> +	kfree(buf);
> +}
> +
>   static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
>   {
>   	struct inode *inode = file_inode(iocb->ki_filp);
> @@ -4349,24 +4370,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
>   	if (!f2fs_is_compress_backend_ready(inode))
>   		return -EOPNOTSUPP;
>   
> -	if (trace_f2fs_dataread_start_enabled()) {
> -		char *p = f2fs_kmalloc(F2FS_I_SB(inode), PATH_MAX, GFP_KERNEL);
> -		char *path;
> -
> -		if (!p)
> -			goto skip_read_trace;
> +	if (trace_f2fs_dataread_start_enabled())
> +		f2fs_trace_rw_file_path(iocb, iov_iter_count(to), READ);
>   
> -		path = dentry_path_raw(file_dentry(iocb->ki_filp), p, PATH_MAX);
> -		if (IS_ERR(path)) {
> -			kfree(p);
> -			goto skip_read_trace;
> -		}
> -
> -		trace_f2fs_dataread_start(inode, pos, iov_iter_count(to),
> -					current->pid, path, current->comm);
> -		kfree(p);
> -	}
> -skip_read_trace:
>   	if (f2fs_should_use_dio(inode, iocb, to)) {
>   		ret = f2fs_dio_read_iter(iocb, to);
>   	} else {
> @@ -4672,24 +4678,8 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
>   	if (preallocated < 0) {
>   		ret = preallocated;
>   	} else {
> -		if (trace_f2fs_datawrite_start_enabled()) {
> -			char *p = f2fs_kmalloc(F2FS_I_SB(inode),
> -						PATH_MAX, GFP_KERNEL);
> -			char *path;
> -
> -			if (!p)
> -				goto skip_write_trace;
> -			path = dentry_path_raw(file_dentry(iocb->ki_filp),
> -								p, PATH_MAX);
> -			if (IS_ERR(path)) {
> -				kfree(p);
> -				goto skip_write_trace;
> -			}
> -			trace_f2fs_datawrite_start(inode, orig_pos, orig_count,
> -					current->pid, path, current->comm);
> -			kfree(p);
> -		}
> -skip_write_trace:
> +		f2fs_trace_rw_file_path(iocb, orig_count, WRITE);

if (trace_f2fs_datawrite_start_enabled())
	f2fs_trace_rw_file_path(..);

Thanks,

> +
>   		/* Do the actual write. */
>   		ret = dio ?
>   			f2fs_dio_write_iter(iocb, from, &may_need_sync) :


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 5/8] f2fs: refactor __allocate_new_segment
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 5/8] f2fs: refactor __allocate_new_segment Christoph Hellwig
@ 2023-01-29 10:39   ` Chao Yu
  0 siblings, 0 replies; 19+ messages in thread
From: Chao Yu @ 2023-01-29 10:39 UTC (permalink / raw)
  To: Christoph Hellwig, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2023/1/19 14:36, Christoph Hellwig wrote:
> Simplify the check whether to allocate a new segment or reuse an open
> one.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 6/8] f2fs: remove __allocate_new_section
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 6/8] f2fs: remove __allocate_new_section Christoph Hellwig
@ 2023-01-29 10:39   ` Chao Yu
  0 siblings, 0 replies; 19+ messages in thread
From: Chao Yu @ 2023-01-29 10:39 UTC (permalink / raw)
  To: Christoph Hellwig, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2023/1/19 14:36, Christoph Hellwig wrote:
> Just fold this trivial wrapper into the only caller.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 7/8] f2fs: refactor next blk selection
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 7/8] f2fs: refactor next blk selection Christoph Hellwig
@ 2023-01-29 12:20   ` Chao Yu
  0 siblings, 0 replies; 19+ messages in thread
From: Chao Yu @ 2023-01-29 12:20 UTC (permalink / raw)
  To: Christoph Hellwig, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2023/1/19 14:36, Christoph Hellwig wrote:
> Remove __refresh_next_blkoff by opencoding the SSR vs LFS segment check
> in the only caller, and then add helpers for SSR block selection and
> blkoff randomization instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 8/8] f2fs: remove __has_curseg_space
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 8/8] f2fs: remove __has_curseg_space Christoph Hellwig
@ 2023-01-29 12:24   ` Chao Yu
  0 siblings, 0 replies; 19+ messages in thread
From: Chao Yu @ 2023-01-29 12:24 UTC (permalink / raw)
  To: Christoph Hellwig, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2023/1/19 14:36, Christoph Hellwig wrote:
> Just open code the logic in the only caller, where it is more
> obvious.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 4/8] f2fs: factor the read/write tracing logic into a helper
  2023-01-29 10:36   ` Chao Yu
@ 2023-01-30 23:00     ` Jaegeuk Kim
  0 siblings, 0 replies; 19+ messages in thread
From: Jaegeuk Kim @ 2023-01-30 23:00 UTC (permalink / raw)
  To: Chao Yu; +Cc: Christoph Hellwig, linux-f2fs-devel

On 01/29, Chao Yu wrote:
> On 2023/1/19 14:36, Christoph Hellwig wrote:
> > Factor the logic to log a path for reads and writs into a helper
> > shared between the read_iter and write_iter methods.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >   fs/f2fs/file.c | 60 +++++++++++++++++++++-----------------------------
> >   1 file changed, 25 insertions(+), 35 deletions(-)
> > 
> > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > index f5c1b78149540c..305be6ac024196 100644
> > --- a/fs/f2fs/file.c
> > +++ b/fs/f2fs/file.c
> > @@ -4340,6 +4340,27 @@ static ssize_t f2fs_dio_read_iter(struct kiocb *iocb, struct iov_iter *to)
> >   	return ret;
> >   }
> > +static void f2fs_trace_rw_file_path(struct kiocb *iocb, size_t count, int rw)
> > +{
> > +	struct inode *inode = file_inode(iocb->ki_filp);
> > +	char *buf, *path;
> > +
> > +	buf = f2fs_kmalloc(F2FS_I_SB(inode), PATH_MAX, GFP_KERNEL);
> > +	if (!buf)
> > +		return;
> > +	path = dentry_path_raw(file_dentry(iocb->ki_filp), buf, PATH_MAX);
> > +	if (IS_ERR(path))
> > +		goto free_buf;
> > +	if (rw == WRITE)
> > +		trace_f2fs_datawrite_start(inode, iocb->ki_pos, count,
> > +				current->pid, path, current->comm);
> > +	else
> > +		trace_f2fs_dataread_start(inode, iocb->ki_pos, count,
> > +				current->pid, path, current->comm);
> > +free_buf:
> > +	kfree(buf);
> > +}
> > +
> >   static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
> >   {
> >   	struct inode *inode = file_inode(iocb->ki_filp);
> > @@ -4349,24 +4370,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
> >   	if (!f2fs_is_compress_backend_ready(inode))
> >   		return -EOPNOTSUPP;
> > -	if (trace_f2fs_dataread_start_enabled()) {
> > -		char *p = f2fs_kmalloc(F2FS_I_SB(inode), PATH_MAX, GFP_KERNEL);
> > -		char *path;
> > -
> > -		if (!p)
> > -			goto skip_read_trace;
> > +	if (trace_f2fs_dataread_start_enabled())
> > +		f2fs_trace_rw_file_path(iocb, iov_iter_count(to), READ);
> > -		path = dentry_path_raw(file_dentry(iocb->ki_filp), p, PATH_MAX);
> > -		if (IS_ERR(path)) {
> > -			kfree(p);
> > -			goto skip_read_trace;
> > -		}
> > -
> > -		trace_f2fs_dataread_start(inode, pos, iov_iter_count(to),
> > -					current->pid, path, current->comm);
> > -		kfree(p);
> > -	}
> > -skip_read_trace:
> >   	if (f2fs_should_use_dio(inode, iocb, to)) {
> >   		ret = f2fs_dio_read_iter(iocb, to);
> >   	} else {
> > @@ -4672,24 +4678,8 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
> >   	if (preallocated < 0) {
> >   		ret = preallocated;
> >   	} else {
> > -		if (trace_f2fs_datawrite_start_enabled()) {
> > -			char *p = f2fs_kmalloc(F2FS_I_SB(inode),
> > -						PATH_MAX, GFP_KERNEL);
> > -			char *path;
> > -
> > -			if (!p)
> > -				goto skip_write_trace;
> > -			path = dentry_path_raw(file_dentry(iocb->ki_filp),
> > -								p, PATH_MAX);
> > -			if (IS_ERR(path)) {
> > -				kfree(p);
> > -				goto skip_write_trace;
> > -			}
> > -			trace_f2fs_datawrite_start(inode, orig_pos, orig_count,
> > -					current->pid, path, current->comm);
> > -			kfree(p);
> > -		}
> > -skip_write_trace:
> > +		f2fs_trace_rw_file_path(iocb, orig_count, WRITE);
> 
> if (trace_f2fs_datawrite_start_enabled())
> 	f2fs_trace_rw_file_path(..);

I queued the patch with this change in dev-test first.

Thanks,

> 
> Thanks,
> 
> > +
> >   		/* Do the actual write. */
> >   		ret = dio ?
> >   			f2fs_dio_write_iter(iocb, from, &may_need_sync) :


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry
  2023-01-19  6:36 ` [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry Christoph Hellwig
  2023-01-29 10:29   ` Chao Yu
@ 2023-01-31 19:10   ` patchwork-bot+f2fs
  1 sibling, 0 replies; 19+ messages in thread
From: patchwork-bot+f2fs @ 2023-01-31 19:10 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: jaegeuk, linux-f2fs-devel

Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Thu, 19 Jan 2023 07:36:18 +0100 you wrote:
> This function just assigns a summary entry.  This can be done entirely
> typesafe with an open code struct assignment that relies on array
> indexing.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/f2fs/segment.c | 23 ++---------------------
>  1 file changed, 2 insertions(+), 21 deletions(-)

Here is the summary with links:
  - [f2fs-dev,1/8] f2fs: remove __add_sum_entry
    https://git.kernel.org/jaegeuk/f2fs/c/2163a691c5f3
  - [f2fs-dev,2/8] f2fs: simplify do_checkpoint
    https://git.kernel.org/jaegeuk/f2fs/c/bc6cc6f92b89
  - [f2fs-dev,3/8] f2fs: add a f2fs_curseg_valid_blocks helper
    https://git.kernel.org/jaegeuk/f2fs/c/0034f8954469
  - [f2fs-dev,4/8] f2fs: factor the read/write tracing logic into a helper
    (no matching commit)
  - [f2fs-dev,5/8] f2fs: refactor __allocate_new_segment
    https://git.kernel.org/jaegeuk/f2fs/c/53577f7c5b8b
  - [f2fs-dev,6/8] f2fs: remove __allocate_new_section
    https://git.kernel.org/jaegeuk/f2fs/c/b2164fbdb8f8
  - [f2fs-dev,7/8] f2fs: refactor next blk selection
    https://git.kernel.org/jaegeuk/f2fs/c/33234f9705d8
  - [f2fs-dev,8/8] f2fs: remove __has_curseg_space
    https://git.kernel.org/jaegeuk/f2fs/c/b8574d8c47eb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-01-31 19:10 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19  6:36 [f2fs-dev] misc f2fs cleanups Christoph Hellwig
2023-01-19  6:36 ` [f2fs-dev] [PATCH 1/8] f2fs: remove __add_sum_entry Christoph Hellwig
2023-01-29 10:29   ` Chao Yu
2023-01-31 19:10   ` patchwork-bot+f2fs
2023-01-19  6:36 ` [f2fs-dev] [PATCH 2/8] f2fs: simplify do_checkpoint Christoph Hellwig
2023-01-29 10:30   ` Chao Yu
2023-01-19  6:36 ` [f2fs-dev] [PATCH 3/8] f2fs: add a f2fs_curseg_valid_blocks helper Christoph Hellwig
2023-01-29 10:34   ` Chao Yu
2023-01-19  6:36 ` [f2fs-dev] [PATCH 4/8] f2fs: factor the read/write tracing logic into a helper Christoph Hellwig
2023-01-29 10:36   ` Chao Yu
2023-01-30 23:00     ` Jaegeuk Kim
2023-01-19  6:36 ` [f2fs-dev] [PATCH 5/8] f2fs: refactor __allocate_new_segment Christoph Hellwig
2023-01-29 10:39   ` Chao Yu
2023-01-19  6:36 ` [f2fs-dev] [PATCH 6/8] f2fs: remove __allocate_new_section Christoph Hellwig
2023-01-29 10:39   ` Chao Yu
2023-01-19  6:36 ` [f2fs-dev] [PATCH 7/8] f2fs: refactor next blk selection Christoph Hellwig
2023-01-29 12:20   ` Chao Yu
2023-01-19  6:36 ` [f2fs-dev] [PATCH 8/8] f2fs: remove __has_curseg_space Christoph Hellwig
2023-01-29 12:24   ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).