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 69E21C47258 for ; Sun, 28 Jan 2024 16:54:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC2C56B0075; Sun, 28 Jan 2024 11:54:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4A536B007B; Sun, 28 Jan 2024 11:54:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9C916B0080; Sun, 28 Jan 2024 11:54:41 -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 96FAD6B0075 for ; Sun, 28 Jan 2024 11:54:41 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1047840425 for ; Sun, 28 Jan 2024 16:54:41 +0000 (UTC) X-FDA: 81729318762.22.64CF0EF Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf03.hostedemail.com (Postfix) with ESMTP id 28C3A20002 for ; Sun, 28 Jan 2024 16:54:38 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706460879; a=rsa-sha256; cv=none; b=aSuQgbXnBSIFLwfOn37bwEexkyjn+2i/nukhvL0iasShP1+EArPyTm1nl7Pp6nYgz9n3iE hm6DZDEqPPPe4ApaAGb0tqfMlFgbIy0pa1TCGcoFziyzUB6mAk9Qfxx3IeIl3P55C1BPGQ g3YxDe4nWtQ5cQRZGswut6AFcAKY1Fk= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706460879; 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; bh=rnaLjxSphdr8rbk6wt4Dj1eHePeRjIMR9Lh6srfrii0=; b=xBBptK29r48aPknmLJ20cgORh0MgkyBOvBchdH/P3vBNrev+zo5LV3K3UuP61QeBI/BDrR nnKxirx5a1pqvltOMyNNbCSQY8XcGH6QpwuSuw3USACgohH/TrZxI0IWyWpmXn/bzTOH62 GdOkNxDc9ttiWQ7fj3245S6YaGm6X2E= Received: by verein.lst.de (Postfix, from userid 2407) id 4BAD168B05; Sun, 28 Jan 2024 17:54:34 +0100 (CET) Date: Sun, 28 Jan 2024 17:54:34 +0100 From: Christoph Hellwig To: Matthew Wilcox Cc: Christoph Hellwig , Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton , linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 07/21] shmem: document how to "persist" data when using shmem_*file_setup Message-ID: <20240128165434.GA5605@lst.de> References: <20240126132903.2700077-1-hch@lst.de> <20240126132903.2700077-8-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 28C3A20002 X-Stat-Signature: ydfbe7irwkw6cnbqqikgjcbtq8iesozm X-HE-Tag: 1706460878-840185 X-HE-Meta: U2FsdGVkX1+euyI9h353mzyGxW4EylN+pe8UKkT3KnTA/GgiSFuzl+WFg5o8oRZHcZJ3fmttj4j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ulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Jan 26, 2024 at 03:49:30PM +0000, Matthew Wilcox wrote: > This doesn't quite make sense to me. Do you mean: > > * If the caller modifies data in the folio, it must call folio_mark_dirty() > * before unlocking the folio to ensure that the folio is not reclaimed. > * There is no equivalent to write_begin/write_end for shmem. > > (also this should go before the Return: section; the return section > should be the last thing in the kernel-doc) So the first sentence and moving the section makes total sense. The second sentence I don't think is very useful. write_begin/write_end are relaly just a way for generic_perform_write to do the space reservation and extending i_size and not really methods in the classic sense. They should go away from a_ops and certainly don't end up being mentioned in shmem.c. What I have now is this: If the caller modifies data in the folio, it must call folio_mark_dirty() before unlocking the folio to ensure that the folio is not reclaimed. These is no need to reserve space before calling folio_mark_dirty(). but I'm open to further improvements.