Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4799693imm; Fri, 18 May 2018 10:50:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr3KsWq6g9ZRKC9AKb8cBG0Pwl8zZFXCizVlUyUVmOtcg0/lR1QkOQ6bDuEMMMe+KAHVOHn X-Received: by 2002:a62:ee15:: with SMTP id e21-v6mr10357561pfi.203.1526665852992; Fri, 18 May 2018 10:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526665852; cv=none; d=google.com; s=arc-20160816; b=CId6wkPEPSvF7ApqH3I71KD0JQpdIolrVkfN09zg7F6z57tBwVL9k+KQG4va5sGTub RM/5zYl70YQ2xtNcSl937KHUWPJ5qnLst26FWEcpGB1eyxMj0sIKQrbk0WIKgFDgvcrm r3zFFGAPIDqfWbwBIQd5Wf0O5vLg+/1cguQu+2AZfzTjtgI6zI5VKDYiSnLYe50QhFMD dobP/eWQuTTwV+NnhqcGdimAX+3s7Iv1m2IH1fKu4+HEi1YJ1ox9wmgLgLU1bEIYZQqT Z3JaCET0Xmu01DcIEvtWpaGL1VCpNLtur+j46tIM7VhniKyFNhbNcJ4Qi9l0+5+mkHj6 xpDg== 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=PBCiSGU4HP/TUmJQfIZknYCpkcR2ZYTdqF+miGFuuaI=; b=cHuZVFt4geZ2Wgv4p31iEbunLaVGYREKQoD7dPcD2BsiiZoOnJ6J8Ry9cw9aDNn7oN WL3yn+WlETmAPkpGWe2xTJncqnyhlIYkz8js7PW1MsZQKaI0bhFSS3QXgdVaVFDLRz+l EPFc+cNEBQMBPaN5IH42pbKsyLA1D7OklrR8cHPOSZ4pzu+xpFAhSY1uv2MpWuNSETVL xTzNwd2sUfswTyFCQxF9VBW/64Huwqxqw+UAjwHYLT/3Mx+MZ5IU2ENyigpH0Qu/mbfA 7zod0HzKBqx/I2QSGgwvZkFM9ux7dksjJChqya6YSbjMUDK9kCJmrgukwElEKZuXnvqL tjLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LqCRCiRN; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11-v6si7862787plc.466.2018.05.18.10.50.38; Fri, 18 May 2018 10:50:52 -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=@gmail.com header.s=20161025 header.b=LqCRCiRN; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752334AbeERRtW (ORCPT + 99 others); Fri, 18 May 2018 13:49:22 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:33952 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751851AbeERRtR (ORCPT ); Fri, 18 May 2018 13:49:17 -0400 Received: by mail-qk0-f196.google.com with SMTP id p186-v6so7107265qkd.1; Fri, 18 May 2018 10:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PBCiSGU4HP/TUmJQfIZknYCpkcR2ZYTdqF+miGFuuaI=; b=LqCRCiRNC2wKwQDCvFncANsNtTgbc5RyKNa/QTt7zEszD6sMZ23OMlj9FDGKtDDwbD 0mrYhncACtHWynpb+tJcBXEdtBP5StYfcXHSl1IAT34R2qOAUPCz4Kf7qJ3gWDwkRF2c FM9Xm/N6gYV4joIyIyjwOjFbZ2JaNqjiklG7+cnBCHYUiesQnLfIyqGmqZsRsytKGdWL FJ5ZOZNB6gQ6YnL9xwSI33veEiu36SYnBerHnaBefJqfsTFhmq3CWR5kgPQU5b2P0Mxc 5RIpUxzf8Bkc3Wu+ijlXjdnJl/fN3J+DvGDOsfvDVn/tfPaBR0kQPmhPDcmDZuU88EU/ B01Q== 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=PBCiSGU4HP/TUmJQfIZknYCpkcR2ZYTdqF+miGFuuaI=; b=O/SYVF6/O90tnjZXX3DbftlD2+f6JF83G1ey2aM5DOK0IKvS7Yj1qZ9fTU1ad9Ac7S JlhwjpXOiLzAHIrt0Icv/mB3L6p1zof+L0I0QsdWuzRfczZDP2JUWi2WiEqbIlgoPxQL wmBkvEtwwanT1MvxUrFkvvzAmj3tIHHpa8hmrKAxk1P6pk9g+b6qPoccKRrBBTAUIAC3 Fe48ds8kDgcYvLOOB7X+folC31+jxPfALtPTEdjy3uP3vLeH0WGx2htpQ3KgeFZahNSX 0Ib35WXhMz0cxyL4smXI1aJgO9lYqb+3r/BtZsDoy+zDmTYtxDn+9/zgi/VUkTtm6mN7 WHPA== X-Gm-Message-State: ALKqPweQ2aLAjtbN836opBvr22k0UUTgklVx6rDJjRCHwAjFbaLjvjkF RJGw3rl9X3LfB6UKZPusjg== X-Received: by 2002:a37:62ca:: with SMTP id w193-v6mr7282401qkb.312.1526665756813; Fri, 18 May 2018 10:49:16 -0700 (PDT) Received: from kmo-pixel (c-71-234-172-214.hsd1.vt.comcast.net. [71.234.172.214]) by smtp.gmail.com with ESMTPSA id n29-v6sm6607845qta.94.2018.05.18.10.49.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 10:49:15 -0700 (PDT) Date: Fri, 18 May 2018 13:49:12 -0400 From: Kent Overstreet To: Josef Bacik 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: <20180518174912.GE31737@kmo-pixel> References: <20180518074918.13816-1-kent.overstreet@gmail.com> <20180518174536.ai26bg3bhlvzq4pi@destiny> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518174536.ai26bg3bhlvzq4pi@destiny> User-Agent: Mutt/1.9.5 (2018-04-13) 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 01:45:36PM -0400, Josef Bacik wrote: > 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, That sounds pretty cool... What about being able to add a random fault injection point in the middle of an existing function? Being able to stick race_fault() in random places was a pretty big win in terms of getting good code coverage out of realistic tests.