From mboxrd@z Thu Jan 1 00:00:00 1970 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 A4BAEC4332F for ; Mon, 17 Oct 2022 16:56:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C61846B0074; Mon, 17 Oct 2022 12:56:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C11356B0075; Mon, 17 Oct 2022 12:56:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B003D6B0078; Mon, 17 Oct 2022 12:56:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9CD2D6B0074 for ; Mon, 17 Oct 2022 12:56:48 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 672F61A0483 for ; Mon, 17 Oct 2022 16:56:48 +0000 (UTC) X-FDA: 80031045696.06.F0AA862 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf30.hostedemail.com (Postfix) with ESMTP id 20F978002E for ; Mon, 17 Oct 2022 16:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=83HfgXyt1fnZGMmK4nQ7n8nfSmpn8od1B8gLuX+LwHY=; b=qBC6TDZlB3i8imxlXD/g7zRcJf jf4EA0n7DQ1N/e0YAOQexbZVxhjV6+a5hS4WlZS/ATV4qfUVTKBwZAondrx63RNrK7wkMoZb52WVy sImZzqiob3gMY07YftS5VFT+npmDONCyOhi/f3drznjbYpXgHYfcaismrphe3S1V4Bg9dEQ/rK8O6 jst1T6wMheKn6r5EzJksGGFiT9Kpe05Um8fq1fN0F03kx5q2Nhu52jxYRn0s4v3iN+iQ5R0bXt8Z9 QyKEJXbTRQvxjlUOnXaP04GOU7H84G4lBmCUiMwH5sm58iNM3CCH7Yx7XmzQbXa3puTug2WuKCRG6 2Ruryt2g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1okTPw-009zMo-8r; Mon, 17 Oct 2022 16:56:44 +0000 Date: Mon, 17 Oct 2022 17:56:44 +0100 From: Matthew Wilcox To: "Vishal Moola (Oracle)" Cc: akpm@linux-foundation.org, hughd@google.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] filemap: find_lock_entries() now updates start offset Message-ID: References: <20221017161800.2003-1-vishal.moola@gmail.com> <20221017161800.2003-2-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221017161800.2003-2-vishal.moola@gmail.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666025808; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=83HfgXyt1fnZGMmK4nQ7n8nfSmpn8od1B8gLuX+LwHY=; b=Y5s4780mDiMk0o/xMaBkL2O8z9GiecQAus0FYV9J6MXw4zTw4PlzrVGMu2cPXaNvBMowC+ VpZn3TXGin2M3DZm84gMZCYuiTOr7klAyctnaBQhrBiQ4z3UADKT/yjmIvfvzcuivQZRin wIBcTKfD1/tQyFHpUIjG0PSjGoZrOfU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=qBC6TDZl; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666025808; a=rsa-sha256; cv=none; b=tUBXki5EkUcAoEoDkGkQjSCYlzgtTHavFCNVAMMSn4w+hcNw0XzkkoscrcVOnJgbRKPlhU 4gMuAjQ3Nmv+V+0wt4J0IOXHAzfy97IogZ4r0k/sfFe+AQSNTEU1catTe/EvMDsLFxIDGe dwZ95yXGWRz6pPswGSClnJRtHcdjHIY= X-Rspamd-Server: rspam12 X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=qBC6TDZl; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Stat-Signature: yu9brdth1ngaijyh9yt6ux1f9u4xog17 X-Rspamd-Queue-Id: 20F978002E X-HE-Tag: 1666025806-48138 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: On Mon, Oct 17, 2022 at 09:17:59AM -0700, Vishal Moola (Oracle) wrote: > +++ b/mm/shmem.c > @@ -932,21 +932,18 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, > > folio_batch_init(&fbatch); > index = start; > - while (index < end && find_lock_entries(mapping, index, end - 1, > + while (index < end && find_lock_entries(mapping, &index, end - 1, Sorry for not spotting this in earlier revisions, but this is wrong. Before, find_lock_entries() would go up to (end - 1) and then the index++ at the end of the loop would increment index to "end", causing the loop to terminate. Now we don't increment index any more, so the condition is wrong. I suggest just removing the 'index < end" half of the condition. > @@ -361,9 +361,8 @@ void truncate_inode_pages_range(struct address_space *mapping, > > folio_batch_init(&fbatch); > index = start; > - while (index < end && find_lock_entries(mapping, index, end - 1, > + while (index < end && find_lock_entries(mapping, &index, end - 1, > &fbatch, indices)) { Similarly here. > @@ -510,20 +509,17 @@ unsigned long invalidate_mapping_pagevec(struct address_space *mapping, > int i; > > folio_batch_init(&fbatch); > - while (find_lock_entries(mapping, index, end, &fbatch, indices)) { > + while (find_lock_entries(mapping, &index, end, &fbatch, indices)) { While this one had the check removed already, so is fine ;-)