Skip to contentSkip to conversation

f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages

PATCH In review zangyangyang1 via Linux-f2fs-devel 1 participant 3 messages Dec 27, 2024 – Jan 3, 2025 F2FS file system

lore
Share & tools
lore
#0 lore raw

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

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

---
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);

--
2.43.2

#/******���ʼ����丽������С�׹�˾�ı�����Ϣ�������ڷ��͸������ַ���г��ĸ��˻�Ⱥ�顣��ֹ�κ����������κ���ʽʹ�ã�������������ȫ���򲿷ֵ�й¶�����ơ���ɢ�������ʼ��е���Ϣ������������˱��ʼ������������绰���ʼ�֪ͨ�����˲�ɾ�����ʼ��� This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

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

author Reviewed-by Chao Yu on v2 1/1
#1 lore raw
Quoted 5 lines · On 2024/12/27 11:39, zangyangyang1 wrote:

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

Thanks,

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

#2 lore raw
In reply to zangyangyang1 via Linux-f2fs-devel
Quoted 16 lines · On 2024/12/27 11:39, zangyangyang1 wrote:

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

---
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;

Tab has been converted to spaces in your patch, can you please check format of this patch?

Thanks,

Quoted 8 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

#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

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