Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4796220imm; Fri, 18 May 2018 10:47:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp6RXXe9k9JAhEfUOKzwlmF5ZAvvY8+qc6o+oCQaxTd09yMhRqNw8ZT4QW8e4VcXykLsMNF X-Received: by 2002:a17:902:6687:: with SMTP id e7-v6mr10735483plk.242.1526665631303; Fri, 18 May 2018 10:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526665631; cv=none; d=google.com; s=arc-20160816; b=dm9v3XxChu7MnJXpULfKjN/s8QK8+pAvl1vh2nd6EhLB+WvbDH6IBAS66+GalmhRKj ckjN44mc3sXY9Rq6Z/RUHT9aNbe8EZwACIt4qTqzkHr+2zXiYqoAdF6THIx7AsUpzsH2 NIxmjL5d2Hpl3Z4NREtBV9XSNZw7dImWERY4pvM8mMmX4EConJ0D3FP7FVbmI1e8RQAG kXsP+U+gAqTcZoGLjAkZdcg1UufGYpYmoWhKuZbnwMkLWjfuR4OfD90k50CkieTU8Cq7 HVN5Nm3UGBK2rVRr2brM5TVklDDtGtg8uL/TrTdKuevXtCh5PuWyt8IyNqll+S3n+fRJ mAxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=PM91e7VZZN3pN8Cvh5+ANMXzQ6q9lNdjuXONpkRxxuE=; b=bYQXXmpQT8TWU9pcjb467xnqSDSwMegHhbQIVOrUl1OsIzvmqVDiS8n8hN+MvB7ECu vPZk1eWQgrjkW4kwsSQz/Lslt/oQIiYCenj/61r0YXfwZGGaOJDgwQdB2FY8O09r2J7r /OuijP7AjsKZ3J0bAw6aJ7Nn/1Jil9M7qMJCydPZIUXUZvUPHwb9nGrrBw9TFZGpDyyl cBaxPEaL7WNwz16y0Ift7PDrCFlffJPLOG0Mf70DvTTPsSGtIwh4hsoQu9WmRlf+a1xh hG68YsecjGZjux4wou7nS54An53adb3O5e+8ZbfvIIwYNG5Uj6iDBMCmswE+oausiYW7 DLzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=Wc/MgHtf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4-v6si8291116pff.24.2018.05.18.10.46.57; Fri, 18 May 2018 10:47:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=Wc/MgHtf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752230AbeERRpm (ORCPT + 99 others); Fri, 18 May 2018 13:45:42 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:33024 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752153AbeERRpj (ORCPT ); Fri, 18 May 2018 13:45:39 -0400 Received: by mail-qk0-f194.google.com with SMTP id c11-v6so7094528qkm.0 for ; Fri, 18 May 2018 10:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PM91e7VZZN3pN8Cvh5+ANMXzQ6q9lNdjuXONpkRxxuE=; b=Wc/MgHtfZ55XLtbHDnk0++bVifiIl3t/fIBz5XlM/pc0k/XD7+tGaq5Cc90CByMeW4 IlAT9Z5J3YW1w0A9HUNmyaEp5HOSDlTOSy3CxTzxTzzOdwBEl3R0GrdiM3d+F1wuPadn UnIFiNKxVdiPrHRrgYQcrwlP4SruooSb/eZ3/TuSIjtoAC8C/2gcFYbEQAN5g4GXEJQW by23FTS3ItHvgb4syzJHRgEWGWX3OoS6IBCOgq234CIME7kbWrASq06jDppwJDRlnAB0 YM4UFR4CIJDmdtHW0uOj+45dhc0/o+vyy2ATICJP8trjWJo5M93+KAP2n2gzA5xikL1S +c3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PM91e7VZZN3pN8Cvh5+ANMXzQ6q9lNdjuXONpkRxxuE=; b=evUsylC3/geApE0Ur1XPNvTJ/QMbeoxHTwgQUnLxx1FvopK7KC1MVLbh9k5V1TmuCO Mkj/qYW+62FmsKrEtnty/VlN1dtgj96ENkHirJdYx/HQKbjjyplBCw+i0P79TnM5ujXQ eaZ5HuTs0A+V1j8kvEOeh5NT4ZEBtwzk2yOQZT10NIZ925K3RQGl9vi4kofP+P0WZdWM R4wu/mxJOLi88/CTEv23cTwyrlm+GNS3ge/09NLeBJUn9JbhMsch0PqUVM1n+3pV4W13 KmhHkd7W1kxIzRBvX/ClZ5ZeHGoG8S5YJJ8ggZqYPkmeTHCEk4Fx/ctA4vuB21k1WOgG iTWw== X-Gm-Message-State: ALKqPwdX9nQZgWEKsS55DmoTDjOzXtURPx59lQIPOR3VKfVWKc0NYLUs /2sMiUvHEIyU3t1GbktGy8AsPg== X-Received: by 2002:a37:b8c4:: with SMTP id i187-v6mr9334275qkf.231.1526665538167; Fri, 18 May 2018 10:45:38 -0700 (PDT) Received: from localhost (cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com. [2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id i25-v6sm6493197qte.26.2018.05.18.10.45.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 10:45:38 -0700 (PDT) Date: Fri, 18 May 2018 13:45:36 -0400 From: Josef Bacik To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Dave Chinner , darrick.wong@oracle.com, tytso@mit.edu, linux-btrfs@vger.kernel.org, clm@fb.com, jbacik@fb.com, viro@zeniv.linux.org.uk, willy@infradead.org, peterz@infradead.org Subject: Re: [PATCH 00/10] RFC: assorted bcachefs patches Message-ID: <20180518174536.ai26bg3bhlvzq4pi@destiny> References: <20180518074918.13816-1-kent.overstreet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518074918.13816-1-kent.overstreet@gmail.com> User-Agent: NeoMutt/20170714 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 18, 2018 at 03:48:58AM -0400, Kent Overstreet wrote: > These are all the remaining patches in my bcachefs tree that touch stuff outside > fs/bcachefs. Not all of them are suitable for inclusion as is, I wanted to get > some discussion first. > > * pagecache add lock > > This is the only one that touches existing code in nontrivial ways. The problem > it's solving is that there is no existing general mechanism for shooting down > pages in the page and keeping them removed, which is a real problem if you're > doing anything that modifies file data and isn't buffered writes. > > Historically, the only problematic case has been direct IO, and people have been > willing to say "well, if you mix buffered and direct IO you get what you > deserve", and that's probably not unreasonable. But now we have fallocate insert > range and collapse range, and those are broken in ways I frankly don't want to > think about if they can't ensure consistency with the page cache. > > Also, the mechanism truncate uses (i_size and sacrificing a goat) has > historically been rather fragile, IMO it might be a good think if we switched it > to a more general rigorous mechanism. > > I need this solved for bcachefs because without this mechanism, the page cache > inconsistencies lead to various assertions popping (primarily when we didn't > think we need to get a disk reservation going by page cache state, but then do > the actual write and disk space accounting says oops, we did need one). And > having to reason about what can happen without a locking mechanism for this is > not something I care to spend brain cycles on. > > That said, my patch is kind of ugly, and it requires filesystem changes for > other filesystems to take advantage of it. And unfortunately, since one of the > code paths that needs locking is readahead, I don't see any realistic way of > implementing the locking within just bcachefs code. > > So I'm hoping someone has an idea for something cleaner (I think I recall > Matthew Wilcox saying he had an idea for how to use xarray to solve this), but > if not I'll polish up my pagecache add lock patch and see what I can do to make > it less ugly, and hopefully other people find it palatable or at least useful. > > * lglocks > > They were removed by Peter Zijlstra when the last in kernel user was removed, > but I've found them useful. His commit message seems to imply he doesn't think > people should be using them, but I'm not sure why. They are a bit niche though, > I can move them to fs/bcachefs if people would prefer. > > * Generic radix trees > > This is a very simple radix tree implementation that can store types of > arbitrary size, not just pointers/unsigned long. It could probably replace > flex arrays. > > * Dynamic fault injection > I've not looked at this at all so this may not cover your usecase, but I implemeted a bpf_override_return() to do focused error injection a year ago. I have this script https://github.com/josefbacik/debug-scripts/blob/master/inject-error.py that does it generically, all you have to do is tag the function you want to be error injectable with ALLOW_ERROR_INJECTION() and then you get all these nice things like a debugfs interface to trigger them or use the above script to trigger specific errors and such. Thanks, Josef