mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: Jiale Yao <yaojiale02@163.com>,
	Joanne Koong <joannelkoong@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Namjae Jeon <linkinjeon@kernel.org>
Subject: linux-next: manual merge of the vfs-brauner tree with the exfat tree
Date: Tue, 13 Oct 2026 14:21:43 +0100	[thread overview]
Message-ID: <as4wZyJGLZ-u1ldu@sirena.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 5863 bytes --]

Hi all,

Today's linux-next merge of the vfs-brauner tree got a conflict in:

  fs/exfat/file.c

between commit:

  9965754d857fc ("exfat: drain in-flight DIO before buffered writes")

from the exfat tree and commit:

  d874f8060847c ("iomap: pass iomap_iter_next_fn directly instead of struct iomap_ops")

from the vfs-brauner tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

The fixup below is obviously part done, and I had to do subsequent
fixups on top of that due to wider semantic changes.  Together with all
the other conflicts today this merge has been an absolute mess, it seems
like we could use better coordination here.

diff --cc fs/exfat/file.c
index f106db945d8dd,188d921aacd13..0000000000000
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@@ -712,42 -654,98 +712,102 @@@ int exfat_file_fsync(struct file *filp
  }
  
  /*
 - * exfat_zero_new_range - zero [start, end) without overwriting uptodate blocks
 + * exfat_prepare_valid_range - populate and dirty folios covering [start, end)
   *
 - * Uptodate blocks may contain data written through a shared mapping beyond
 - * valid_size.
 + * Populate missing blocks via the read path, which zero-fills data
 + * beyond the current valid_size and skips uptodate blocks.
 + * Mark entire folios dirty so the newly valid range is written back.
 + *
 + * Call before advancing valid_size.
   */
 -static int exfat_zero_new_range(struct inode *inode, loff_t start, loff_t end)
 +static int exfat_prepare_valid_range(struct inode *inode, loff_t start,
 +				    loff_t end)
  {
  	struct address_space *mapping = inode->i_mapping;
 -	unsigned int blocksize = i_blocksize(inode);
 -	loff_t pos = start;
 -	int err;
 +	loff_t next, pos = start;
 +	struct folio *folio;
 +	pgoff_t index;
 +
 +	if (pos >= end)
 +		return 0;
  
  	while (pos < end) {
 -		loff_t next = min_t(loff_t,
 -				round_down(pos, PAGE_SIZE) + PAGE_SIZE, end);
 -		struct folio *folio;
 -		loff_t bpos;
 +		index = pos >> PAGE_SHIFT;
 +		next = min(((loff_t)index + 1) << PAGE_SHIFT, end);
  
++<<<<<<< HEAD
 +		balance_dirty_pages_ratelimited(mapping);
++=======
+ 		folio = filemap_get_folio(mapping, pos >> PAGE_SHIFT);
+ 		if (IS_ERR(folio)) {
+ 			err = iomap_zero_range(inode, pos, next - pos, NULL,
+ 					       exfat_iomap_next, NULL, NULL);
+ 			if (err < 0)
+ 				return err;
+ 			pos = next;
+ 			continue;
+ 		}
++>>>>>>> vfs-brauner/vfs.all
  
 -		if (folio_test_uptodate(folio)) {
 -			folio_lock(folio);
 -			if (folio->mapping == mapping)
 -				folio_mark_dirty(folio);
 -			folio_unlock(folio);
 -			folio_put(folio);
 -			pos = next;
 -			continue;
 -		}
 +		folio = read_mapping_folio(mapping, index, NULL);
 +		if (IS_ERR(folio))
 +			return PTR_ERR(folio);
  
 -		/*
 -		 * Zero not-uptodate block runs. iomap_zero_range() requires an
 -		 * unlocked folio, so recheck ->mapping after each call.
 -		 */
  		folio_lock(folio);
++<<<<<<< HEAD
 +		if (folio->mapping == mapping) {
++=======
+ 		bpos = pos;
+ 		while (bpos < next) {
+ 			loff_t rstart, rend;
+ 
+ 			if (folio->mapping != mapping) {
+ 				folio_unlock(folio);
+ 				err = iomap_zero_range(inode, bpos, next - bpos,
+ 						NULL, exfat_iomap_next, NULL, NULL);
+ 				if (err < 0) {
+ 					folio_put(folio);
+ 					return err;
+ 				}
+ 				folio_lock(folio);
+ 				break;
+ 			}
+ 
+ 			if (iomap_is_partially_uptodate(folio,
+ 					offset_in_folio(folio, bpos), blocksize)) {
+ 				bpos += blocksize;
+ 				continue;
+ 			}
+ 
+ 			rstart = bpos;
+ 			rend = min_t(loff_t, bpos + blocksize, next);
+ 			while (rend < next &&
+ 			       !iomap_is_partially_uptodate(folio,
+ 					offset_in_folio(folio, rend), blocksize))
+ 				rend = min_t(loff_t, rend + blocksize, next);
+ 
+ 			folio_unlock(folio);
+ 			err = iomap_zero_range(inode, rstart, rend - rstart,
+ 					NULL, exfat_iomap_next, NULL, NULL);
+ 			if (err < 0) {
+ 				folio_put(folio);
+ 				return err;
+ 			}
+ 			folio_lock(folio);
+ 			bpos = rend;
+ 		}
+ 
+ 		/*
+ 		 * Dirty only a fully uptodate folio. Dirtying a partial folio could
+ 		 * write uninitialised cache contents over valid on-disk blocks.
+ 		 */
+ 		if (folio->mapping == mapping && folio_test_uptodate(folio))
++>>>>>>> vfs-brauner/vfs.all
  			folio_mark_dirty(folio);
 +			pos = next;
 +		}
  		folio_unlock(folio);
  		folio_put(folio);
 -		pos = next;
  	}
  
  	return 0;
@@@ -813,9 -807,7 +873,9 @@@ static ssize_t exfat_fallback_buffered_
  
  	iocb->ki_flags &= ~IOCB_DIRECT;
  
 +	inode_dio_wait(file_inode(iocb->ki_filp));
 +
- 	written = iomap_file_buffered_write(iocb, from, &exfat_write_iomap_ops,
+ 	written = iomap_file_buffered_write(iocb, from, exfat_write_iomap_next,
  			NULL, NULL);
  	if (written < 0)
  		return written;
@@@ -894,21 -887,13 +954,22 @@@ static ssize_t exfat_file_write_iter(st
  		}
  		if (ret < 0)
  			goto unlock;
 +
 +		pos = valid_size;
  	}
  
 -	if (iocb->ki_flags & IOCB_DIRECT)
 +	if (iocb->ki_flags & IOCB_DIRECT) {
  		ret = exfat_dio_write_iter(iocb, iter);
 -	else
 +	} else {
 +		/*
 +		 * Prevent concurrent direct I/O and buffered I/O to the same file
 +		 * range. Wait for in-flight DIO to finish before dirtying pages.
 +		 */
 +		inode_dio_wait(inode);
  		ret = iomap_file_buffered_write(iocb, iter,
 +				&exfat_write_iomap_ops, NULL, NULL);
+ 				exfat_write_iomap_next, NULL, NULL);
 +	}
  	if (ret < 0)
  		goto unlock;
  

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2026-10-13 13:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 13:21 Mark Brown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-10-13 13:21 Mark Brown
2026-03-27 17:35 Mark Brown
2026-03-28  1:01 ` Namjae Jeon
2024-08-11 22:10 Stephen Rothwell
2024-08-12  0:54 ` Namjae Jeon
2024-09-16 22:22 ` Stephen Rothwell
2024-09-17  6:44   ` Namjae Jeon

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=as4wZyJGLZ-u1ldu@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=brauner@kernel.org \
    --cc=joannelkoong@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=yaojiale02@163.com \
    /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®