From patchwork Mon Feb 5 22:57:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13546383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65953C4828D for ; Mon, 5 Feb 2024 22:58:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 611E86B009E; Mon, 5 Feb 2024 17:58:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BED96B009F; Mon, 5 Feb 2024 17:58:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C4016B00A0; Mon, 5 Feb 2024 17:58:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 276B36B009E for ; Mon, 5 Feb 2024 17:58:03 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 00FB7C01BC for ; Mon, 5 Feb 2024 22:58:02 +0000 (UTC) X-FDA: 81759264846.30.48B808E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 3DD2C18001B for ; Mon, 5 Feb 2024 22:58:01 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DNt9MYjW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707173881; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gEDfM0YmOVVjZkqrLm5MW20CtKMi1zvofDx7AFNwinE=; b=sqQc872/UY/nGlVjiy9H771JL9lJg50zHPe8TQH8X6EO4En+XIN0qbgUT63FpVivaEKFzq Rz8Q/61J4G+VOYSMakBjTE3uYC475zsi3MaUYovU9KvcHiRbStShjo6pyTjXi00oF1nV0X kBBz6+XsuCnNve4e6cSxIESAY5cD+Wk= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DNt9MYjW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707173881; a=rsa-sha256; cv=none; b=HSeQJ5LDiunR0hV1UXJVWB6vEbHUEI6Z3nG2Lyp3udjH4PyZca7JDierHpoHlvvdOvZN3E ZmM7TdleJ+mxkQNc3a+j0c2sBu6jK0vjiEzd0C7V4OqcpWNoLC8MkBTuMeoZo1zHhAiaB2 XbzXc332bhhVkuG0eGGPVmJdHm1Q/8w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707173880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gEDfM0YmOVVjZkqrLm5MW20CtKMi1zvofDx7AFNwinE=; b=DNt9MYjW+LT1/XrwrE9TOB+Z1ODZmhhUwaDPP+L5OHCPt1kSx+R/WG2yuhLN0Kfsi6FE88 C5DIdqTUS9NfU86j3xNjiP8VK96e/YsTmods84SkJla1tycgXqw6NA9Hg4/3xZrBohey78 koqrigNbcEA2r8hI7S7Ac5oaeIph+dk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-45-jLdc7QWiO9W-lp1ehv9R1A-1; Mon, 05 Feb 2024 17:57:54 -0500 X-MC-Unique: jLdc7QWiO9W-lp1ehv9R1A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0A521C05EC0; Mon, 5 Feb 2024 22:57:52 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE9961C060AF; Mon, 5 Feb 2024 22:57:50 +0000 (UTC) From: David Howells To: Steve French Cc: David Howells , Jeff Layton , Matthew Wilcox , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Christian Brauner , netfs@lists.linux.dev, linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Steve French , Shyam Prasad N , Rohith Surabattula Subject: [PATCH v5 08/12] cifs: Move cifs_loose_read_iter() and cifs_file_write_iter() to file.c Date: Mon, 5 Feb 2024 22:57:20 +0000 Message-ID: <20240205225726.3104808-9-dhowells@redhat.com> In-Reply-To: <20240205225726.3104808-1-dhowells@redhat.com> References: <20240205225726.3104808-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspamd-Queue-Id: 3DD2C18001B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 3bs47g3dww811pfdz7jj9z6yrxxcy7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7HdfUSi2J0GOmforT/j09eLpt7Nyz+fnbICl0EiOGo1RpK/ynbJuWboHWJpqhdo7XjVNCAI0RWDNBLcPOtp5TWmaAwV8YkRp5cL1e5Yj2PKpCDhoT2NG0vJYJb2lEfXuwwPfLmDP2RAEITAYz9YbCyeDwuy1JvTu8h/FvU1ItuFtpeWrpXkBhck9nOgcZz2wjQ7u7iZTkCxJo3zFF+NbRckzy/TqKqyEBBHe5rQEW7w02cJJ/8sI6ElhLwA1V8KaaH0TQ/4/rrCFr2jDAhV7qAB0HW9pgVpqVp1NK2w700NUDaB4P2Erqpz4+aU7IjsmaEj4J2uHR/GulnLqSoESdlZclFdf/fc5JzY/C2XqH88jsy7TDgSRugUzSwDYijs10CwA9yUROu/uWLQQhCJKxF/6fn2icun38JEQV/a3vE1AkdA0KAUU286tenC+iOek+ivlI+7tE8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Move cifs_loose_read_iter() and cifs_file_write_iter() to file.c so that they are colocated with similar functions rather than being split with cifsfs.c. Signed-off-by: David Howells cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton 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 | 55 ------------------------------------------ fs/smb/client/cifsfs.h | 2 ++ fs/smb/client/file.c | 53 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 41617541d175..4b6d1a5e4741 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -984,61 +984,6 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, return root; } - -static ssize_t -cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter) -{ - ssize_t rc; - struct inode *inode = file_inode(iocb->ki_filp); - - if (iocb->ki_flags & IOCB_DIRECT) - return cifs_user_readv(iocb, iter); - - rc = cifs_revalidate_mapping(inode); - if (rc) - return rc; - - return generic_file_read_iter(iocb, iter); -} - -static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) -{ - struct inode *inode = file_inode(iocb->ki_filp); - struct cifsInodeInfo *cinode = CIFS_I(inode); - ssize_t written; - int rc; - - if (iocb->ki_filp->f_flags & O_DIRECT) { - written = cifs_user_writev(iocb, from); - if (written > 0 && CIFS_CACHE_READ(cinode)) { - cifs_zap_mapping(inode); - cifs_dbg(FYI, - "Set no oplock for inode=%p after a write operation\n", - inode); - cinode->oplock = 0; - } - return written; - } - - written = cifs_get_writer(cinode); - if (written) - return written; - - written = generic_file_write_iter(iocb, from); - - if (CIFS_CACHE_WRITE(CIFS_I(inode))) - goto out; - - rc = filemap_fdatawrite(inode->i_mapping); - if (rc) - cifs_dbg(FYI, "cifs_file_write_iter: %d rc on %p inode\n", - rc, inode); - -out: - cifs_put_writer(cinode); - return written; -} - static loff_t cifs_llseek(struct file *file, loff_t offset, int whence) { struct cifsFileInfo *cfile = file->private_data; diff --git a/fs/smb/client/cifsfs.h b/fs/smb/client/cifsfs.h index 685f7d1139c6..e8e0f863e935 100644 --- a/fs/smb/client/cifsfs.h +++ b/fs/smb/client/cifsfs.h @@ -100,6 +100,8 @@ extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to); extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from); extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from); extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from); +ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from); +ssize_t cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter); extern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock); extern int cifs_lock(struct file *, int, struct file_lock *); extern int cifs_fsync(struct file *, loff_t, loff_t, int); diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 14602ed6bc39..a1e6a4c83dc6 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -4570,6 +4570,59 @@ ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to) return __cifs_readv(iocb, to, false); } +ssize_t cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter) +{ + ssize_t rc; + struct inode *inode = file_inode(iocb->ki_filp); + + if (iocb->ki_flags & IOCB_DIRECT) + return cifs_user_readv(iocb, iter); + + rc = cifs_revalidate_mapping(inode); + if (rc) + return rc; + + return generic_file_read_iter(iocb, iter); +} + +ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) +{ + struct inode *inode = file_inode(iocb->ki_filp); + struct cifsInodeInfo *cinode = CIFS_I(inode); + ssize_t written; + int rc; + + if (iocb->ki_filp->f_flags & O_DIRECT) { + written = cifs_user_writev(iocb, from); + if (written > 0 && CIFS_CACHE_READ(cinode)) { + cifs_zap_mapping(inode); + cifs_dbg(FYI, + "Set no oplock for inode=%p after a write operation\n", + inode); + cinode->oplock = 0; + } + return written; + } + + written = cifs_get_writer(cinode); + if (written) + return written; + + written = generic_file_write_iter(iocb, from); + + if (CIFS_CACHE_WRITE(CIFS_I(inode))) + goto out; + + rc = filemap_fdatawrite(inode->i_mapping); + if (rc) + cifs_dbg(FYI, "cifs_file_write_iter: %d rc on %p inode\n", + rc, inode); + +out: + cifs_put_writer(cinode); + return written; +} + ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to) {