public inbox for gfs2@lists.linux.dev
 help / color / mirror / Atom feed
From: Su Yue <l@damenly.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Su Yue <glass.su@suse.com>,  gfs2@lists.linux.dev,  agruenba@redhat.com
Subject: Re: [PATCH 2/2] gfs2: do not call gfs2_jdata_writepages for jdata
Date: Mon, 09 Jun 2025 08:18:51 +0800	[thread overview]
Message-ID: <5xh5zs0k.fsf@damenly.org> (raw)
In-Reply-To: <aELevNcGGuS5lSSI@casper.infradead.org> (Matthew Wilcox's message of "Fri, 6 Jun 2025 13:27:40 +0100")

On Fri 06 Jun 2025 at 13:27, Matthew Wilcox <willy@infradead.org> 
wrote:

> On Fri, Jun 06, 2025 at 05:47:56PM +0800, Su Yue wrote:
>> +++ b/fs/gfs2/aops.c
>> @@ -138,6 +138,46 @@ static int __gfs2_jdata_write_folio(struct 
>> folio *folio,
>>  	return gfs2_write_jdata_full_folio(folio, wbc);
>>  }
>>
>> +/**
>> + * gfs2_write_jdata_folio - Write folio
>> + * @folio: folio to write
>> + * @wbc: The writeback control
>> + *
>> + * Returns: errno
>> + *
>> + */
>> +
>> +static int gfs2_write_jdata_folio(struct folio *folio, struct 
>> writeback_control *wbc)
>> +{
>> +	struct inode *inode = folio->mapping->host;
>> +	struct gfs2_inode *ip = GFS2_I(inode);
>> +	struct gfs2_sbd *sdp = GFS2_SB(inode);
>> +
>> +	if (gfs2_assert_withdraw(sdp, ip->i_gl->gl_state == 
>> LM_ST_EXCLUSIVE))
>> +		goto out;
>> +	if (folio_test_checked(folio) || current->journal_info)
>> +		goto out_ignore;
>> +	return __gfs2_jdata_write_folio(folio, wbc);
>> +
>> +out_ignore:
>> +	folio_redirty_for_writepage(wbc, folio);
>> +out:
>> +	folio_unlock(folio);
>> +	return 0;
>> +}
>> +
>> +int gfs2_write_jdata_folios(struct address_space *mapping, 
>> struct writeback_control *wbc)
>> +{
>> +	struct folio *folio = NULL;
>> +	int error;
>> +
>> +	while ((folio = writeback_iter(mapping, wbc, folio, 
>> &error)))
>> +		error = gfs2_write_jdata_folio(folio, wbc);
>> +
>> +	return error;
>> +}
>
> The great thing about using an iterator pattern rather than a 
> callback
> pattern is that we don't need this stupid extra function.  So 
> you can
> drop patch 1 and just do this:
>
Thanks. That's what Andreas wrote in his patch 5a90f8d49922  :)

--
Su
> +	struct inode *inode = mapping->host;
> +	struct gfs2_inode *ip = GFS2_I(inode);
> +	struct gfs2_sbd *sdp = GFS2_SB(inode);
> +
> +	if (gfs2_assert_withdraw(sdp, ip->i_gl->gl_state == 
> LM_ST_EXCLUSIVE))
> +		return -Ewhatever;
> +
> +	while ((folio = writeback_iter(mapping, wbc, folio, &error))) 
> {
> +		if (folio_test_checked(folio) || current->journal_info)
> +			goto ignore;
> +		error = __gfs2_jdata_write_folio(folio, wbc);
> +		continue;
> +
> +ignore:
> +		folio_redirty_for_writepage(wbc, folio);
> +		folio_unlock(folio);
> +	}
> +
> +	return error;

  reply	other threads:[~2025-06-09  0:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06  9:47 [PATCH 0/2] GFS2: Fix wrong call of new trans for jdata Su Yue
2025-06-06  9:47 ` [PATCH 1/2] gfs2: rename gfs2_write_jdata_folio to gfs2_write_jdata_full_folio Su Yue
2025-06-06  9:47 ` [PATCH 2/2] gfs2: do not call gfs2_jdata_writepages for jdata Su Yue
2025-06-06 12:27   ` Matthew Wilcox
2025-06-09  0:18     ` Su Yue [this message]
2025-06-09  0:20 ` [PATCH 0/2] GFS2: Fix wrong call of new trans " Su Yue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5xh5zs0k.fsf@damenly.org \
    --to=l@damenly.org \
    --cc=agruenba@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=glass.su@suse.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox