Linux-Fsdevel Archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Steve French <smfrench@gmail.com>
Cc: David Howells <dhowells@redhat.com>,
	Jeff Layton <jlayton@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	Paulo Alcantara <pc@manguebit.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>,
	Christian Brauner <christian@brauner.io>,
	netfs@lists.linux.dev, linux-cifs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Steve French <sfrench@samba.org>,
	Shyam Prasad N <nspmangalore@gmail.com>,
	Rohith Surabattula <rohiths.msft@gmail.com>
Subject: [PATCH v7 08/16] cifs: Set zero_point in the copy_file_range() and remap_file_range()
Date: Tue, 30 Apr 2024 15:09:20 +0100	[thread overview]
Message-ID: <20240430140930.262762-9-dhowells@redhat.com> (raw)
In-Reply-To: <20240430140930.262762-1-dhowells@redhat.com>

Set zero_point in the copy_file_range() and remap_file_range()
implementations so that we don't skip reading data modified on a
server-side copy.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
---
 fs/smb/client/cifsfs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 847df5152835..9d656a08f617 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -1287,6 +1287,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
 	rc = cifs_flush_folio(target_inode, destend, &fstart, &fend, false);
 	if (rc)
 		goto unlock;
+	if (fend > target_cifsi->netfs.zero_point)
+		target_cifsi->netfs.zero_point = fend + 1;
 
 	/* Discard all the folios that overlap the destination region. */
 	cifs_dbg(FYI, "about to discard pages %llx-%llx\n", fstart, fend);
@@ -1305,6 +1307,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
 			fscache_resize_cookie(cifs_inode_cookie(target_inode),
 					      new_size);
 		}
+		if (rc == 0 && new_size > target_cifsi->netfs.zero_point)
+			target_cifsi->netfs.zero_point = new_size;
 	}
 
 	/* force revalidate of size and timestamps of target file now
@@ -1396,6 +1400,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
 	rc = cifs_flush_folio(target_inode, destend, &fstart, &fend, false);
 	if (rc)
 		goto unlock;
+	if (fend > target_cifsi->netfs.zero_point)
+		target_cifsi->netfs.zero_point = fend + 1;
 
 	/* Discard all the folios that overlap the destination region. */
 	truncate_inode_pages_range(&target_inode->i_data, fstart, fend);


  parent reply	other threads:[~2024-04-30 14:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 14:09 [PATCH v7 00/16] netfs, cifs: Delegate high-level I/O to netfslib David Howells
2024-04-30 14:09 ` [PATCH v7 01/16] cifs: Use alternative invalidation to using launder_folio David Howells
2024-04-30 14:09 ` [PATCH v7 02/16] cifs: Replace cifs_readdata with a wrapper around netfs_io_subrequest David Howells
2024-04-30 14:09 ` [PATCH v7 03/16] cifs: Replace cifs_writedata " David Howells
2024-04-30 14:09 ` [PATCH v7 04/16] cifs: Use more fields from netfs_io_subrequest David Howells
2024-04-30 14:09 ` [PATCH v7 05/16] cifs: Make wait_mtu_credits take size_t args David Howells
2024-04-30 14:09 ` [PATCH v7 06/16] cifs: Replace the writedata replay bool with a netfs sreq flag David Howells
2024-04-30 14:09 ` [PATCH v7 07/16] cifs: Move cifs_loose_read_iter() and cifs_file_write_iter() to file.c David Howells
2024-04-30 14:09 ` David Howells [this message]
2024-04-30 14:09 ` [PATCH v7 09/16] cifs: Add mempools for cifs_io_request and cifs_io_subrequest structs David Howells
2024-04-30 14:09 ` [PATCH v7 10/16] cifs: Make add_credits_and_wake_if() clear deducted credits David Howells
2024-04-30 14:09 ` [PATCH v7 11/16] cifs: Implement netfslib hooks David Howells
2024-04-30 14:09 ` [PATCH v7 12/16] cifs: Cut over to using netfslib David Howells
2024-04-30 14:09 ` [PATCH v7 13/16] cifs: Remove some code that's no longer used, part 1 David Howells
2024-04-30 14:09 ` [PATCH v7 14/16] cifs: Remove some code that's no longer used, part 2 David Howells
2024-04-30 14:09 ` [PATCH v7 15/16] cifs: Remove some code that's no longer used, part 3 David Howells
2024-04-30 14:09 ` [PATCH v7 16/16] cifs: Enable large folio support David Howells
2024-04-30 14:47 ` [PATCH v7 00/16] netfs, cifs: Delegate high-level I/O to netfslib David Howells
2024-04-30 14:58   ` Steve French
2024-05-02 14:13   ` Christian Brauner

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=20240430140930.262762-9-dhowells@redhat.com \
    --to=dhowells@redhat.com \
    --cc=christian@brauner.io \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netfs@lists.linux.dev \
    --cc=nspmangalore@gmail.com \
    --cc=pc@manguebit.com \
    --cc=rohiths.msft@gmail.com \
    --cc=sfrench@samba.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).