mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: Chao Yu <chao@kernel.org>, "jaegeuk@kernel.org" <jaegeuk@kernel.org>
Cc: "linux-f2fs-devel@lists.sourceforge.net"
	<linux-f2fs-devel@lists.sourceforge.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Daejun Park <daejun7.park@samsung.com>
Subject: RE: [PATCH] f2fs: don't break allocation when crossing contiguous sections
Date: Wed, 30 Jul 2025 10:53:57 +0900	[thread overview]
Message-ID: <20250730015357epcms2p63d8a9d98265a526f959e33fa2d7c610b@epcms2p6> (raw)
In-Reply-To: <20250721020231.2482090-1-chao@kernel.org>

Hi Chao Yu,

> +        lfs_dio_write = (flag == F2FS_GET_BLOCK_DIO && f2fs_lfs_mode(sbi) &&
> +                                map->m_may_create);
> +

Consider moving the lfs_dio_write assignment to just after the if (!map->m_may_create …) check
so it isn’t evaluated when creation isn’t allowed.

> @@ -4171,6 +4172,10 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>          map.m_next_pgofs = &next_pgofs;
>          map.m_seg_type = f2fs_rw_hint_to_seg_type(F2FS_I_SB(inode),
>                                                  inode->i_write_hint);
> +        if (flags & IOMAP_WRITE && iomap->private) {

Since iomap->private is only set on the LFS DIO path, you can drop the flags & IOMAP_WRITE and
test the pointer directly.

> +                map.m_last_pblk = (unsigned long)iomap->private;
> +                iomap->private = NULL;
> +        }
> 
>          /*
>           * If the blocks being overwritten are already allocated,
> @@ -4209,6 +4214,9 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>                  iomap->flags = IOMAP_F_MERGED;
>                  iomap->bdev = map.m_bdev;
>                  iomap->addr = F2FS_BLK_TO_BYTES(map.m_pblk);
> +
> +                if (flags & IOMAP_WRITE && map.m_last_pblk)
> +                        iomap->private = (void *)map.m_last_pblk;

Likewise, checking only map.m_last_pblk is sufficient for restoring.

Reviewed-by: Daejun Park <daejun7.park@samsung.com>


  parent reply	other threads:[~2025-07-30  1:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21  2:02 Chao Yu
2025-07-24 20:30 ` [f2fs-dev] " patchwork-bot+f2fs
     [not found] ` <CGME20250721020241epcas2p1481962181d9f81f127e122736923fe20@epcms2p6>
2025-07-30  1:53   ` Daejun Park [this message]
2025-07-30  7:39     ` Chao Yu

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=20250730015357epcms2p63d8a9d98265a526f959e33fa2d7c610b@epcms2p6 \
    --to=daejun7.park@samsung.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®