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 16EFAC43217 for ; Sat, 26 Nov 2022 00:52:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D05F6B0071; Fri, 25 Nov 2022 19:52:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 480966B0073; Fri, 25 Nov 2022 19:52:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36FCE6B0074; Fri, 25 Nov 2022 19:52:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2B4C76B0071 for ; Fri, 25 Nov 2022 19:52:47 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EBBCD120121 for ; Sat, 26 Nov 2022 00:52:46 +0000 (UTC) X-FDA: 80173768332.17.6590F9C Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf11.hostedemail.com (Postfix) with ESMTP id 6CFC64000D for ; Sat, 26 Nov 2022 00:52:46 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 59660B82C78; Sat, 26 Nov 2022 00:52:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCB43C433C1; Sat, 26 Nov 2022 00:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1669423963; bh=23uMlPI2b38Pk/HLBQWrKukbXUGQaLxTVt8eFQGlz7Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nq0wbB1Ta+GNBrk92HU880jJ1B+pW/zAYuF6oHY1q0MOvSeihnjz3NQGV6k04hazX zDPH1hYvHSC7SfMZLvIjEa/x5BR7N9QBZyYx/LysiISrLxUfev2xL6P36uld/pvIhv mDW0selFgwz0Pnwx17PG2ARdv+guOVKnQ/RgQlnY= Date: Fri, 25 Nov 2022 16:52:42 -0800 From: Andrew Morton To: Jiachen Zhang Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, xieyongji@bytedance.com Subject: Re: [PATCH] filemap: Fix some misleading comments Message-Id: <20221125165242.a33918e30cc9dc70750ed95f@linux-foundation.org> In-Reply-To: <20221125070959.49027-1-zhangjiachen.jaycee@bytedance.com> References: <20221125070959.49027-1-zhangjiachen.jaycee@bytedance.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669423966; a=rsa-sha256; cv=none; b=wPZ6wkRTRWi05TuTpJPL6uuQRlCCWvUM4v1+3S4kJvpUh5ifvviZUYUhQzIEemYy0V5IxI kCy5YRd5lhWFBxQXY9Ulfv+oH3AXktX525h6bUBMYzIBRhO/nVWwSas0tbQ5EzHMCRXxxb WVYK4ry9ZP1EqF3oQL8K5EigBfVCbFY= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=nq0wbB1T; spf=pass (imf11.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669423966; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=o0UzEePGgWL0S2XL6eh9mFCyxzDn7orEb5/3fdvuqZs=; b=fn04J9xxwG0nlRKeMFFI1VNn6v8JAcLhkblXamllMC3XFEp1cbmpkTvf8nNFXF7/t7MQkp B9NHL/Kn8dFQdb2Dh1be00wdVU6fXgSa/aSllL+Aw0UrbOFg5yW/vBRhGj+AXv04Vyqz0C YYvSOaC1Om2xMsoIj/cHI3XhZG/xWJ0= X-Rspamd-Queue-Id: 6CFC64000D X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=nq0wbB1T; spf=pass (imf11.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam07 X-Stat-Signature: irdtkar3c9ccs1mgm1mctxqbjaokqkp6 X-HE-Tag: 1669423966-279697 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 Fri, 25 Nov 2022 15:09:59 +0800 Jiachen Zhang wrote: > The users of filemap_write_and_wait_range() and file_write_and_wait_range() > interfaces should set the lend parameter to LLONG_MAX, rather than -1, to > indicate they want to writeback to the very end-of-file, as several kernel > code paths are checking the 'wbc->range_end == LLONG_MAX' conditions. Unclear. LLONG_MAX differs from -1 on 64-bit and differs differently on 32-bit. > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -661,7 +661,8 @@ EXPORT_SYMBOL_GPL(filemap_range_has_writeback); > * Write out and wait upon file offsets lstart->lend, inclusive. > * > * Note that @lend is inclusive (describes the last byte to be written) so > - * that this function can be used to write to the very end-of-file (end = -1). > + * that this function can be used to write to the very end-of-file (@lend = > + * LLONG_MAX). > * The write(2) manpage says "According to POSIX.1, if count is greater than SSIZE_MAX, the result is implementation-defined; see NOTES for the upper limit on Linux." And filemap_fdatawrite_wbc() enforces LONG_MAX, which differs from LLONG_MAX on 32-bit. I suspect more research is needed here.