All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH v3] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages
@ 2025-01-06  3:36 zangyangyang
  2025-01-08 18:29 ` Jaegeuk Kim via Linux-f2fs-devel
  0 siblings, 1 reply; 5+ messages in thread
From: zangyangyang @ 2025-01-06  3:36 UTC (permalink / raw)
  To: chao; +Cc: jaegeuk, zangyangyang1, linux-f2fs-devel

From: zangyangyang1 <zangyangyang1@xiaomi.com>

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

Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
---
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(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 94f7b084f601..f772fbc7f331 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -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



_______________________________________________
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] 5+ messages in thread

* Re: [f2fs-dev] [PATCH v3] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages
  2025-01-06  3:36 [f2fs-dev] [PATCH v3] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages zangyangyang
@ 2025-01-08 18:29 ` Jaegeuk Kim via Linux-f2fs-devel
  2025-01-09  2:23   ` 臧阳阳
  0 siblings, 1 reply; 5+ messages in thread
From: Jaegeuk Kim via Linux-f2fs-devel @ 2025-01-08 18:29 UTC (permalink / raw)
  To: zangyangyang; +Cc: zangyangyang1, linux-f2fs-devel

On 01/06, zangyangyang wrote:
> From: zangyangyang1 <zangyangyang1@xiaomi.com>
> 
> 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
> 
> Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
> ---
> 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(+)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 94f7b084f601..f772fbc7f331 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -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.

> +
>  	/* 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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v3] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages
  2025-01-08 18:29 ` Jaegeuk Kim via Linux-f2fs-devel
@ 2025-01-09  2:23   ` 臧阳阳
  2025-01-09 10:19     ` Chao Yu via Linux-f2fs-devel
  0 siblings, 1 reply; 5+ messages in thread
From: 臧阳阳 @ 2025-01-09  2:23 UTC (permalink / raw)
  To: chao; +Cc: Jaegeuk Kim, zangyangyang1, linux-f2fs-devel

Jaegeuk Kim <jaegeuk@kernel.org> 于2025年1月9日周四 02:29写道:

>
> On 01/06, zangyangyang wrote:
> > From: zangyangyang1 <zangyangyang1@xiaomi.com>
> >
> > 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
> >
> > Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
> > ---
> > 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(+)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 94f7b084f601..f772fbc7f331 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -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.

Hi, Chao, what do you think?

Thanks

>
> > +
> >       /* 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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v3] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages
  2025-01-09  2:23   ` 臧阳阳
@ 2025-01-09 10:19     ` Chao Yu via Linux-f2fs-devel
  2025-01-09 12:46       ` YangYang Zang
  0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-01-09 10:19 UTC (permalink / raw)
  To: 臧阳阳; +Cc: zangyangyang1, Jaegeuk Kim, linux-f2fs-devel

On 1/9/25 10:23, 臧阳阳 wrote:
> Jaegeuk Kim <jaegeuk@kernel.org> 于2025年1月9日周四 02:29写道:
> 
>>
>> On 01/06, zangyangyang wrote:
>>> From: zangyangyang1 <zangyangyang1@xiaomi.com>
>>>
>>> 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
>>>
>>> Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
>>> ---
>>> 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(+)
>>>
>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>> index 94f7b084f601..f772fbc7f331 100644
>>> --- a/fs/f2fs/data.c
>>> +++ b/fs/f2fs/data.c
>>> @@ -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.
> 
> 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,

> 
> Thanks
> 
>>
>>> +
>>>        /* 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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v3] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages
  2025-01-09 10:19     ` Chao Yu via Linux-f2fs-devel
@ 2025-01-09 12:46       ` YangYang Zang
  0 siblings, 0 replies; 5+ messages in thread
From: YangYang Zang @ 2025-01-09 12:46 UTC (permalink / raw)
  To: chao, Jaegeuk Kim; +Cc: zangyangyang1, linux-f2fs-devel

On Thu, Jan 9, 2025 at 6:19 PM Chao Yu <chao@kernel.org> wrote:
>
> On 1/9/25 10:23, 臧阳阳 wrote:
> > Jaegeuk Kim <jaegeuk@kernel.org> 于2025年1月9日周四 02:29写道:
> >
> >>
> >> On 01/06, zangyangyang wrote:
> >>> From: zangyangyang1 <zangyangyang1@xiaomi.com>
> >>>
> >>> 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
> >>>
> >>> Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
> >>> ---
> >>> 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(+)
> >>>
> >>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>> index 94f7b084f601..f772fbc7f331 100644
> >>> --- a/fs/f2fs/data.c
> >>> +++ b/fs/f2fs/data.c
> >>> @@ -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.
> >
> > 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,
>
> Thanks,
>
> >
> > Thanks
> >
> >>
> >>> +
> >>>        /* 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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2025-01-09 12:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-06  3:36 [f2fs-dev] [PATCH v3] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages zangyangyang
2025-01-08 18:29 ` Jaegeuk Kim via Linux-f2fs-devel
2025-01-09  2:23   ` 臧阳阳
2025-01-09 10:19     ` Chao Yu via Linux-f2fs-devel
2025-01-09 12:46       ` YangYang Zang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.