Message ID | 163906965274.143852.11487892388439890377.stgit@warthog.procyon.org.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-nfs-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BDB2C433FE for <linux-nfs@archiver.kernel.org>; Thu, 9 Dec 2021 17:08:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239031AbhLIRLl (ORCPT <rfc822;linux-nfs@archiver.kernel.org>); Thu, 9 Dec 2021 12:11:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43301 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233985AbhLIRLk (ORCPT <rfc822;linux-nfs@vger.kernel.org>); Thu, 9 Dec 2021 12:11:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639069686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pAJiHrOcvAJQ2Gwmj0Q3Mj+KlP/03WjOznw/Bcn+pVg=; b=BFBx2vw2ZVjVvzCOEs9u3lUQRtmTQI2L0GfSE9wOSyoajxVL06527s6Ht5lpZl9U8Ktj1p f/4en+RMHg3v8yyO0Ip4DxVDyiQiCHF0Djsm1G6gU2035Q2/XLyLuGrN7WPEc38br3Vgu6 UINqeA1iKCz7iH7O3v2gPvLeJFhguI4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-20-hbSaPwq0Ne-Z2yD6afTaTQ-1; Thu, 09 Dec 2021 12:08:03 -0500 X-MC-Unique: hbSaPwq0Ne-Z2yD6afTaTQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16EA681CCB6; Thu, 9 Dec 2021 17:08:01 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id A18921002390; Thu, 9 Dec 2021 17:07:33 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH v2 55/67] afs: Handle len being extending over page end in write_begin/write_end From: David Howells <dhowells@redhat.com> To: linux-cachefs@redhat.com Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, Jeff Layton <jlayton@kernel.org>, Marc Dionne <marc.dionne@auristor.com>, linux-afs@lists.infradead.org, dhowells@redhat.com, Trond Myklebust <trondmy@hammerspace.com>, Anna Schumaker <anna.schumaker@netapp.com>, Steve French <sfrench@samba.org>, Dominique Martinet <asmadeus@codewreck.org>, Jeff Layton <jlayton@kernel.org>, Matthew Wilcox <willy@infradead.org>, Alexander Viro <viro@zeniv.linux.org.uk>, Omar Sandoval <osandov@osandov.com>, JeffleXu <jefflexu@linux.alibaba.com>, Linus Torvalds <torvalds@linux-foundation.org>, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 09 Dec 2021 17:07:32 +0000 Message-ID: <163906965274.143852.11487892388439890377.stgit@warthog.procyon.org.uk> In-Reply-To: <163906878733.143852.5604115678965006622.stgit@warthog.procyon.org.uk> References: <163906878733.143852.5604115678965006622.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: <linux-nfs.vger.kernel.org> X-Mailing-List: linux-nfs@vger.kernel.org |
Series |
fscache, cachefiles: Rewrite
|
expand
|
diff --git a/fs/afs/write.c b/fs/afs/write.c index ca4909baf5e6..8e4e87d66855 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -25,7 +25,8 @@ int afs_set_page_dirty(struct page *page) } /* - * prepare to perform part of a write to a page + * Prepare to perform part of a write to a page. Note that len may extend + * beyond the end of the page. */ int afs_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, @@ -36,7 +37,6 @@ int afs_write_begin(struct file *file, struct address_space *mapping, unsigned long priv; unsigned f, from; unsigned t, to; - pgoff_t index; int ret; _enter("{%llx:%llu},%llx,%x", @@ -51,8 +51,8 @@ int afs_write_begin(struct file *file, struct address_space *mapping, if (ret < 0) return ret; - index = folio_index(folio); - from = pos - index * PAGE_SIZE; + from = offset_in_folio(folio, pos); + len = min_t(size_t, len, folio_size(folio) - from); to = from + len; try_again: @@ -103,7 +103,8 @@ int afs_write_begin(struct file *file, struct address_space *mapping, } /* - * finalise part of a write to a page + * Finalise part of a write to a page. Note that len may extend beyond the end + * of the page. */ int afs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,