Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp1186791ima; Wed, 6 Feb 2019 15:28:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IYNa9GcHwdHjXP87u3hG93JkcKhVAA+YzjTVKYf3z8EaNFKytKYl2KgNGPuozw69Ina/8m5 X-Received: by 2002:a62:28c9:: with SMTP id o192mr13329835pfo.57.1549495725698; Wed, 06 Feb 2019 15:28:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549495725; cv=none; d=google.com; s=arc-20160816; b=kettoJ8HJB+Kf0CXPHFsduAMb4atjaNcl0K/fcyuwUntwUOj+8RIN0Y8kamDMx153Y E7YC3/cZt16+UFNLLNBal7ItTLyxuECgRiKSH1TggTzRjBc3SsnUpMRXrjlKow6+PEUc /CiT8ek5dSFlmb/49JOVNkhc6bzGMv0XcxOH/fJ9MtThapXsYuVJl3ldpe6FJhi9PPXt 2iqfzLOx4WU8tyjWUieVSzY9+P5pFGMTGAyfgDtwIUV1aMDvv+JQuImuu3vZof8/jhYc n9KbR+qBmktv0O9hsYBlrJE6Ca3L4uFJ+QhrH+vsqm3JdOcWUEj9k71TklG2TPoFdfaS WS/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id:date :emacs:subject:cc:to:from; bh=a9EZA9MTQamib++L0PqmyqUjQUlhtZxcv1R/E/wTRd8=; b=GsNv4LV8+Sq0byIQgvYlBOKku9OwLyEQVR6i3oTOhVceBRvr9EjZyroRl8+RPQ3Omr uwy1IvvV2Ka5v92doYvekZ3YwWXPVQ5Exm37AVxFbh8wh0hOqLRoEVX6uxJi0O546xvW 5iCif4uziqdOJn+QvsvD/xPB7haCrwlkM4NRAIRlhaUDTh2GP0cWRMjaExdV9CCvYEHc ApZVlvl3QV94Y/R3W5Ilb5zTQuupZbFoxkaxuBDufEXyC/NJsHCYPDSieaeYZP2IWNHW wDUk22XN8UTKpNn8I4KmIC3LipHkoNVelhcZM82tpnGNtBk9X8dDg0kezx7t3a0fMbtq CobQ== ARC-Authentication-Results: i=1; mx.google.com; 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 12si7437617pfx.102.2019.02.06.15.28.29; Wed, 06 Feb 2019 15:28:45 -0800 (PST) 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; 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 S1726645AbfBFX0k (ORCPT + 99 others); Wed, 6 Feb 2019 18:26:40 -0500 Received: from icebox.esperi.org.uk ([81.187.191.129]:36954 "EHLO mail.esperi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbfBFX0j (ORCPT ); Wed, 6 Feb 2019 18:26:39 -0500 X-Greylist: delayed 4516 seconds by postgrey-1.27 at vger.kernel.org; Wed, 06 Feb 2019 18:26:39 EST Received: from loom (nix@sidle.srvr.nix [192.168.14.8]) by mail.esperi.org.uk (8.15.2/8.15.2) with ESMTP id x16LvpO0001523; Wed, 6 Feb 2019 21:57:51 GMT From: Nix To: linux-bcache@vger.kernel.org, linux-xfs@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: bcache on XFS: metadata I/O (dirent I/O?) not getting cached at all? Emacs: because Hell was full. Date: Wed, 06 Feb 2019 22:11:21 +0000 Message-ID: <87h8dgefee.fsf@esperi.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DCC--Metrics: loom 1102; Body=3 Fuz1=3 Fuz2=3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So I just upgraded to 4.20 and revived my long-turned-off bcache now that the metadata corruption leading to mount failure on dirty close may have been identified (applying Tang Junhui's patch to do so)... and I spotted something a bit disturbing. It appears that XFS directory and metadata I/O is going more or less entirely uncached. Here's some bcache stats before and after a git status of a *huge* uncached tree (Chromium) on my no-writeback readaround cache. It takes many minutes and pounds the disk with massively seeky metadata I/O in the process: Before: stats_total/bypassed: 48.3G stats_total/cache_bypass_hits: 7942 stats_total/cache_bypass_misses: 861045 stats_total/cache_hit_ratio: 3 stats_total/cache_hits: 16286 stats_total/cache_miss_collisions: 25 stats_total/cache_misses: 411575 stats_total/cache_readaheads: 0 After: stats_total/bypassed: 49.3G stats_total/cache_bypass_hits: 7942 stats_total/cache_bypass_misses: 1154887 stats_total/cache_hit_ratio: 3 stats_total/cache_hits: 16291 stats_total/cache_miss_collisions: 25 stats_total/cache_misses: 411625 stats_total/cache_readaheads: 0 Huge increase in bypassed reads, essentially no new cached reads. This is... basically the optimum case for bcache, and it's not caching it! From my reading of xfs_dir2_leaf_readbuf(), it looks like essentially all directory reads in XFS appear to bcache as a single non-readahead followed by a pile of readahead I/O: bcache bypasses readahead bios, so all directory reads (or perhaps all directory reads larger than a single block) are going to be bypassed out of hand. This seems... suboptimal, but so does filling up the cache with read-ahead blocks (particularly for non-metadata) that are never used. Anyone got any ideas, 'cos I'm currently at a loss: XFS doesn't appear to let us distinguish between "read-ahead just in case but almost certain to be accessed" (like directory blocks) and "read ahead on the offchance because someone did a single-block file read and what the hell let's suck in a bunch more". As it is, this seems to render bcache more or less useless with XFS, since bcache's primary raison d'etre is precisely to cache seeky stuff like metadata. :(