ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Tinguely <mark.tinguely@oracle.com>,
	ocfs2-devel@lists.linux.dev, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2] ocfs2: Use b_folio in ocfs2_symlink_get_block()
Date: Thu, 13 Feb 2025 18:58:39 +0000	[thread overview]
Message-ID: <Z65A3yJ_40TtsGko@casper.infradead.org> (raw)
In-Reply-To: <20250213183730.2141556-1-willy@infradead.org>

On Thu, Feb 13, 2025 at 06:37:27PM +0000, Matthew Wilcox (Oracle) wrote:
>  		 * copy, the data is still good. */
> -		if (buffer_jbd(buffer_cache_bh)
> -		    && ocfs2_inode_is_new(inode)) {
> -			kaddr = kmap_atomic(bh_result->b_page);
> -			if (!kaddr) {
> -				mlog(ML_ERROR, "couldn't kmap!\n");
> -				goto bail;
> -			}
> -			memcpy(kaddr + (bh_result->b_size * iblock),
> -			       buffer_cache_bh->b_data,
> -			       bh_result->b_size);
> -			kunmap_atomic(kaddr);
> +		if (buffer_jbd(buffer_cache_bh) && ocfs2_inode_is_new(inode)) {
> +			kaddr = kmap_local_folio(bh_result->b_folio,
> +					bh_result->b_size * iblock);
> +			memcpy(kaddr, buffer_cache_bh->b_data,
> +					bh_result->b_size);
> +			kunmap_local(kaddr);
>  			set_buffer_uptodate(bh_result);

hm, now that I look at this again, I think this should actually be:

                if (buffer_jbd(buffer_cache_bh) && ocfs2_inode_is_new(inode)) {
-                       kaddr = kmap_local_folio(bh_result->b_folio,
-                                       bh_result->b_size * iblock);
-                       memcpy(kaddr, buffer_cache_bh->b_data,
+                       memcpy_to_folio(bh_result->b_folio,
+                                       bh_result->b_size * iblock,
+                                       buffer_cache_bh->b_data,
                                        bh_result->b_size);
-                       kunmap_local(kaddr);
                        set_buffer_uptodate(bh_result);

ie use the helper instead of open-coding it.  I'll send a replacement
patch.

      parent reply	other threads:[~2025-02-13 18:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 18:37 [PATCH 1/2] ocfs2: Use b_folio in ocfs2_symlink_get_block() Matthew Wilcox (Oracle)
2025-02-13 18:37 ` [PATCH 2/2] ocfs2: Remove reference to bh->b_page Matthew Wilcox (Oracle)
2025-02-13 18:58 ` Matthew Wilcox [this message]

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=Z65A3yJ_40TtsGko@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mark.tinguely@oracle.com \
    --cc=ocfs2-devel@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).