[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dhjvmhfpmyf5ncbutlev6mmtgxatnuorfiv7i4q55wpzl7jrvn@asxbr2hv3xfv>
Date: Mon, 15 Sep 2025 12:50:54 +0200
From: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
To: alexjlzheng@...il.com
Cc: hch@...radead.org, brauner@...nel.org, djwong@...nel.org,
yi.zhang@...wei.com, linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Jinliang Zheng <alexjlzheng@...cent.com>
Subject: Re: [PATCH 4/4] iomap: don't abandon the whole copy when we have
iomap_folio_state
> +static int iomap_trim_tail_partial(struct inode *inode, loff_t pos,
> + size_t copied, struct folio *folio)
> +{
> + struct iomap_folio_state *ifs = folio->private;
> + unsigned block_size, last_blk, last_blk_bytes;
> +
> + if (!ifs || !copied)
> + return 0;
> +
> + block_size = 1 << inode->i_blkbits;
> + last_blk = offset_in_folio(folio, pos + copied - 1) >> inode->i_blkbits;
> + last_blk_bytes = (pos + copied) & (block_size - 1);
> +
> + if (!ifs_block_is_uptodate(ifs, last_blk))
> + copied -= min(copied, last_blk_bytes);
If pos is aligned to block_size, is there a scenario where
copied < last_blk_bytes?
Trying to understand why you are using a min() here.
--
Pankaj
Powered by blists - more mailing lists