Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72E08374E66 for ; Mon, 27 Apr 2026 23:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777334342; cv=none; b=QExADO1aRjaOFQXhHxxB1p0UKmmI/GQYlc9mQWPYSWrYekSCbq7IXWgFQ6CqhCBqjsqTJBXUY3j/rxwBL7dKthoBy7KfU/GkaJBnqeZAYtJmx2rBSdd73MQCF2UX+8M3lAFRgfPIi2z+03gwfMNs/UUg0RZJCbfstkxpCV6QWEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777334342; c=relaxed/simple; bh=rGwiSZSuCJN90UEHrs7if55dKFDEqUosqK90h/qiDsw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sS58XHZbz8aBwOCNev1aEt0x3CMVkNU+64iqsRjoB0UhggSaNet2/sh4KJ5NNtc9j5ih9w7QlY8evg+aviapopiqMtWLxLinf4OAy4oHNYwr74ab/LBRXXSmMdKkAT6o8724oUOzVpPKYd8Z7YHNM9E1GbvWN7AbembpCTbkiig= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zabbo.net; spf=pass smtp.mailfrom=zabbo.net; dkim=pass (1024-bit key) header.d=zabbo.net header.i=@zabbo.net header.b=rTlmCohR; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zabbo.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zabbo.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zabbo.net header.i=@zabbo.net header.b="rTlmCohR" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2adff872068so52574645ad.1 for ; Mon, 27 Apr 2026 16:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zabbo.net; s=google; t=1777334341; x=1777939141; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=NK23r3kypTwyagw9dycaaV9bWkAjRRjU8m5TVPRDb2o=; b=rTlmCohRfH0lh4n1kl1i8L/Qyb6fJLEU7wQqrW7mytFFAfbNerP6Tzv6owG6ijQWiE EUnOmDJS9bJrjOTHz6H0TelwqrGE/CHUXiutY0Rz4EJRu7aivEH9RHbNmLEpXGT/cTWT 9OuLWhmsd0ZUJ5DjAQGZgv/vpNAQQhzr9tvsE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777334341; x=1777939141; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NK23r3kypTwyagw9dycaaV9bWkAjRRjU8m5TVPRDb2o=; b=WhXkzK3rl/X5qS3tu1GL5Z7koBWm7TfObBUu3sXg02u/aYGuNeXy5znXYrJ0Li05C8 abFwGAMQT0wTkz7BDZQcUj4mLFAhn9hKzVieHwzujU/317v1T/Px0HHO6+pVNvRhQeIg 6wwaJfvHZID8FZ95gL4oKATX8ZqN2hVfJNeyXyDTQqsAoZ9dJqN/+cQrDvBaoe8ziAjF xhk1g4Izj0gsArjb9m5g8Wl8XSN9pkvhwH+3O7KYCXrUg9tgNObjKC31e44usBVzoacn fsRSdAKV69CRUIg9bjWV4SJsfHazSxByHkC2vf2iuvewpxDWlZpbU/SfFrBS2Zts1LDf l+Jg== X-Gm-Message-State: AOJu0YySoDHcO3X/A01jGURQO22GLlnqxHpdo0zuF5h9+2pdaaY90DXc FiFSh5QhLY0pcb9ZwkuGZk1M+PWgSbZj78Oe7BRXSoly+Q74RzK0p9KAoCTMj5/wF2Eivmg4KmS obSrT X-Gm-Gg: AeBDiet/cmWPnBHhE+xpSzA1MMqOY0eRdnC5BbWXnD/EQz9IGpDAMD5qQrbbFz78Kfm BHGo3ogw1YJj56MgIUv0yyJvU+2Kci0hVO6tH9erJ/C6LBTo31VGJ8pQBQ3NxpL/L7Hy8ja16ad 8LlrtxXbA0SLaJH6L3YNLhPforOxzxhYb9GDo92hyxpWZO4JxaPlO+G0M4t+HF4icgEzntCDHG5 BS86a6AQJzoa2Sno29fb+NgwMFih2XfM4nv4Udtt0Sr+KQlQQBZXmCmwYt5YdWzS6wbA3sTfSfy pJBXwNE+vRXB49jLaa3Q44Pz67cSbRJfNbB75A+7ROnikO/UHRg2AT642JH64t9V+Y1+W+f6Wvr QvcDCE2oo4xedhlOc8+ruzBBVTiynCb8dDszp3OnFRrIXehejzKpUapDDJqbLx90kK0v81zBd/y zK6IvC9Ynmq6S476U/FYkU X-Received: by 2002:a17:902:c412:b0:2b0:5cb4:d89d with SMTP id d9443c01a7336-2b97c499589mr6692335ad.29.1777334340617; Mon, 27 Apr 2026 16:59:00 -0700 (PDT) Received: from localhost ([50.39.133.72]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b97aabaecfsm5931035ad.36.2026.04.27.16.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2026 16:59:00 -0700 (PDT) Date: Mon, 27 Apr 2026 16:58:59 -0700 From: Zach Brown To: Valerie Aurora Cc: rpdfs-devel@lists.linux.dev Subject: Re: [PATCH 8/8] rpdfs: add read_folio, dirty_folio, write_begin, write_end Message-ID: <20260427235859.GH3280715@localhost.localdomain> References: <20260424140520.3443624-1-val@versity.com> <20260424140520.3443624-9-val@versity.com> Precedence: bulk X-Mailing-List: rpdfs-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260424140520.3443624-9-val@versity.com> On Fri, Apr 24, 2026 at 04:05:20PM +0200, Valerie Aurora wrote: > This commit completes basic file data read/write support. Currently it > will deadlock with multiple clients, so much more work is needed. > +/* > + * TODO: cannot block on block acquisition while holding the folio lock. There's not much to it. ret = acquire(, RBAF_NONBLOCK_MODE); if (ret == -EAGAIN) { folio_unlock(folio); ret = acquire(, 0); if (ret == 0) release(&hnd); ret = AOP_TRUNCATED_PAGE; goto out; } The caller will retry and this time it'll be able to acquire the block without waiting. > +/* > + * Do whatever preparation is necessary before the VFS copies the data > + * from the user buffer into the folio pages. Must return a folio. > + * > + * Called before a write starts with the page lock held. Due to this, we > + * can't do anything that blocks on acquisition of a block. Right now it > + * just gets the folio. In the future it might check quotas, file system > + * error state, etc. > + */ It's not called with the page lock held. That's what the __filemap_get_folio() is doing. FGP_WRITEBGIN includes FGP_LOCK. We have the freedom to place the page lock in whatever order we need. (holy moly is it hard to type FGP_ without typing GFP_) Most of what's in write_end should be brought up in to write_begin. Interestingly, I don't think we need to communicate the txn to write_end. write_begin just needs to make sure that all our dirty blocks for the change (inode, mapping, data blocks) are all in one atomic write. write_end just needs to do the vfs work. Ala generic_write_end(). > + /* copy the data into the actual block */ > + memcpy(blk_hnd->data + offset, folio_address(folio) + offset, len); Let's do this by wiring up writepages and having our network IO reference the page. > + rpdfs_prd("i_size %lld ret %d", i_size_read(inode), ret); > + return ret; I'm hoping we can get away with not causing errors in write_end. It'd avoid having to unwind the mapping and folio insertions that we did in write_begin. (Poke around ext2_write_failed()). - z