Skip to contentSkip to conversation

f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages

PATCH Superseded zangyangyang 2 participants 5 messages Jan 6, 2025 – Jan 9, 2025 F2FS file system

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages

From: zangyangyang1 <[email protected]>

When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors

---
v3: No logical changes, just format patch
v2: Initialize "submitted" in f2fs_write_single_data_page()

---
 fs/f2fs/data.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/data.c +3 -0
index 94f7b084f601..f772fbc7f331 100644
@@ -2816,6 +2816,9 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
 
 	trace_f2fs_writepage(folio, DATA);
 
+	if (submitted)
+		*submitted = 0;
+
 	/* we should bypass data pages to proceed the kworker jobs */
 	if (unlikely(f2fs_cp_error(sbi))) {
 		mapping_set_error(folio->mapping, -EIO);
Signature · 8 lines
2.43.2



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw
Quoted 19 lines · zangyangyang

From: zangyangyang1 <[email protected]>

When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors

---
v3: No logical changes, just format patch
v2: Initialize "submitted" in f2fs_write_single_data_page()

---
 fs/f2fs/data.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/data.c +0 -0
index 94f7b084f601..f772fbc7f331 100644

fs/f2fs/data.c int f2fs_write_single_data_page(struct folio *folio, int *submitted, · line 2820

Quoted 5 lines
fs/f2fs/data.c +2 -0
@@ -2816,6 +2816,9 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
 
 	trace_f2fs_writepage(folio, DATA);
 
+	if (submitted)
+		*submitted = 0;

I don't think this is correct, as callers should handle it.

Quoted 6 lines
fs/f2fs/data.c +1 -0
+
 	/* we should bypass data pages to proceed the kworker jobs */
 	if (unlikely(f2fs_cp_error(sbi))) {
 		mapping_set_error(folio->mapping, -EIO);
Signature · 1 line
2.43.2

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author
#2 lore raw
Quoted 22 lines · Jaegeuk Kim <[email protected]> 于2025年1月9日周四 02:29写道:
Quoted 20 lines · zangyangyang

From: zangyangyang1 <[email protected]>

When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors

---
v3: No logical changes, just format patch
v2: Initialize "submitted" in f2fs_write_single_data_page()

---
 fs/f2fs/data.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/data.c +0 -0
index 94f7b084f601..f772fbc7f331 100644
@@ -2816,6 +2816,9 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
 
Quoted 6 lines

fs/f2fs/data.c int f2fs_write_single_data_page(struct folio *folio, int *submitted, · line 2820

Quoted 4 lines
fs/f2fs/data.c +2 -0
      trace_f2fs_writepage(folio, DATA);
 
+     if (submitted)
+             *submitted = 0;

I don't think this is correct, as callers should handle it.

Hi, Chao, what do you think?

Thanks

Quoted 7 lines
Quoted 7 lines
fs/f2fs/data.c +1 -1
+
      /* we should bypass data pages to proceed the kworker jobs */
      if (unlikely(f2fs_cp_error(sbi))) {
              mapping_set_error(folio->mapping, -EIO);
--

2.43.2

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#3 lore raw
Quoted 24 lines · 臧阳阳
Quoted 22 lines · Jaegeuk Kim <[email protected]> 于2025年1月9日周四 02:29写道:
Quoted 20 lines · zangyangyang

From: zangyangyang1 <[email protected]>

When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors

---
v3: No logical changes, just format patch
v2: Initialize "submitted" in f2fs_write_single_data_page()

---
  fs/f2fs/data.c | 3 +++
  1 file changed, 3 insertions(+)
fs/f2fs/data.c +0 -0
index 94f7b084f601..f772fbc7f331 100644
@@ -2816,6 +2816,9 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
 
Quoted 8 lines
Quoted 6 lines

fs/f2fs/data.c int f2fs_write_single_data_page(struct folio *folio, int *submitted, · line 2820

Quoted 4 lines
fs/f2fs/data.c +2 -0
       trace_f2fs_writepage(folio, DATA);
 
+     if (submitted)
+             *submitted = 0;

I don't think this is correct, as callers should handle it.

Hi, Chao, what do you think?

Both are fine to me, previously I suggest to handle it in f2fs_write_single_data_page(), because I'm worried about we may miss to handle it in any possible caller in further.

Thanks,

Quoted 10 lines

Thanks

Quoted 7 lines
Quoted 7 lines
fs/f2fs/data.c +1 -1
+
       /* we should bypass data pages to proceed the kworker jobs */
       if (unlikely(f2fs_cp_error(sbi))) {
               mapping_set_error(folio->mapping, -EIO);
--

2.43.2

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#4 lore raw
Quoted 33 lines · Chao Yu
Quoted 31 lines · 臧阳阳
Quoted 28 lines · Jaegeuk Kim <[email protected]> 于2025年1月9日周四 02:29写道:
Quoted 19 lines · zangyangyang

From: zangyangyang1 <[email protected]>

When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors

---
v3: No logical changes, just format patch
v2: Initialize "submitted" in f2fs_write_single_data_page()

---
  fs/f2fs/data.c | 3 +++
  1 file changed, 3 insertions(+)
fs/f2fs/data.c +0 -0
index 94f7b084f601..f772fbc7f331 100644

fs/f2fs/data.c int f2fs_write_single_data_page(struct folio *folio, int *submitted, · line 2820

Quoted 5 lines
fs/f2fs/data.c +2 -0
@@ -2816,6 +2816,9 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
 
       trace_f2fs_writepage(folio, DATA);
 
+     if (submitted)
+             *submitted = 0;

I don't think this is correct, as callers should handle it.

Quoted 5 lines
Quoted 1 line

Hi, Chao, what do you think?

Both are fine to me, previously I suggest to handle it in f2fs_write_single_data_page(), because I'm worried about we may miss to handle it in any possible caller in further.

Thank you very much, Chao.

Hi, Kim, If you still think callers should handle it, I'll send a new patch.

Thanks,

Quoted 14 lines

Thanks,

Quoted 10 lines

Thanks

Quoted 7 lines
Quoted 7 lines
fs/f2fs/data.c +1 -1
+
       /* we should bypass data pages to proceed the kworker jobs */
       if (unlikely(f2fs_cp_error(sbi))) {
               mapping_set_error(folio->mapping, -EIO);
--

2.43.2

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel