Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp611398ybl; Fri, 6 Dec 2019 03:24:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxQIe5aIqLTUlAxEO0B55uuk0xThJsJ8BBFL40+DBBmyvfRpAKtuLrLxzFfQWN1qaJVSylv X-Received: by 2002:aca:cdca:: with SMTP id d193mr6003663oig.152.1575631489839; Fri, 06 Dec 2019 03:24:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575631489; cv=none; d=google.com; s=arc-20160816; b=ixmMIOGDux9/57/Z2887JfusyNiUvngO+/+h8kCkY8fOw36BtrT2jcKOfMkuL1W6V0 1W+9vcAFinxBhUvCbDTDyTSWSGc8PUjXuCqhB4+DRFnF8JGTGHvmablsXskYEC2I5iDm RS0UIhh/PlVh30PDM5RC2t1dwywvOZLFG/LP0L8aEzigpzqmrRID3QdopZRDoubCr7ft VK2OUZOrsCmjgvH/Bb4MB2V/65280a4QkFc7yvB8Zwv1SS7ZWw8rHcQKDI61vbhxB1Vw x2J+iKs8R3F5hBnyrCv9xax8lQBEWNTjesB6AC5shgNdwjzUV605KUw+9NRNrS3oY5u9 9vXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lCXoIWakRU3V5oXHzk/54lcFuPvdsHqcKCN0u+YlFk8=; b=m1gvW7nqG6XgmSdMeHt6bldb55oDdW03wBZX4zmYS8K8jkjT0RVZeghQ04I2zUXrCT bwtCG5JmMbc1EbY7z61KvJDCUWVQPMfoYB8Q09jnUJq1VCkM/07jDgqjI3k+TDCYdfLd hhBR9q4py7XNrZJ2zwbK0i1Bkz/5BKY9scLSC29keI2UNsF8HyLvkhZyZNYdK0TwndUV iDtnouPgg4aYctCSNyzvNnTkvjTay2F+8AWnuLK8vQCSJypq6Ofo2EcjE2z9y3LJce/I sNg4JqLQddoh38QkE4sVjCIRKvJDyvdEyo6z5dEemH9Ss51kR7ZPKnbqI+bdkgZnrUs2 ESOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DUzVap8v; 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 r26si6143117otc.163.2019.12.06.03.24.37; Fri, 06 Dec 2019 03:24:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DUzVap8v; 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 S1726258AbfLFLXr (ORCPT + 99 others); Fri, 6 Dec 2019 06:23:47 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:33545 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbfLFLXr (ORCPT ); Fri, 6 Dec 2019 06:23:47 -0500 Received: by mail-qk1-f194.google.com with SMTP id c124so6220900qkg.0; Fri, 06 Dec 2019 03:23:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lCXoIWakRU3V5oXHzk/54lcFuPvdsHqcKCN0u+YlFk8=; b=DUzVap8v4VirQVTep3A6dGYG+uytH67cmP4XN8Lne0knjj/yCEiW72bk2E3dXh5dic Bs+Yq6xfOiNDdmmxipv39ecbcWapH/HGi9qxBZ84jeo3hBH1bFWvBnEICJeeOWN4MzoU uVeUF8NZhXv2sBm+78UIrC53wY+mzPByWqmLYYp0hMfMz4kc09VVIH5Lu2K8C1zx/PwN 2qxBeqMsoeSLmM+HooR9qmaGTEcgmHJuSqB4z1bi4FY6FaMugCDvyq9/7pUSHXmmdpQv U/Lisw/iHSVU+KX1csgzKA2I9r/xOaKEjC9H8ET8kGkmFi+pGy4Q3xLBHWiScb7M9AnZ OULw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lCXoIWakRU3V5oXHzk/54lcFuPvdsHqcKCN0u+YlFk8=; b=ahnGE1Rz7wDBvbZyi+QGUQlRQX2DeN1AkkP/vnURUwJnagD71leaJDv8G6gzLG41s3 1UVkA8ynDoiFse7MZlPCLKI/D9+mPHhVCTRkCd8F8VIjhmPczVggB8skOB+DYPUk1Fh4 Z8eEMR8KHDRlBjjxndh6WRP0r/HYGX5leJ//JIcKxF/WjZFmM2wOvfWYp/FWy20gIptZ VVAkUttG7iXyclO1J/z00LNM4g/pnF0zWdXPJT1mSyq8spi0Qv4YWFaSmi+N9Gg2pGMN BLlnmXRILtMwql6PzuXgayx8alMABagFwHJI2KJcnWoutXMCQ6xkcnvk4afup0mU6tlw VbUQ== X-Gm-Message-State: APjAAAX+F6y3FJc8Dnjif2pIJnEf7LCS9sdyw+4twXi14D5jtd+TlQcB rvSy7194JTy6lYER4q4gwCXqspOWkzcCWDrVNm0= X-Received: by 2002:ae9:ee11:: with SMTP id i17mr10179649qkg.333.1575631426316; Fri, 06 Dec 2019 03:23:46 -0800 (PST) MIME-Version: 1.0 References: <1575622543-22470-1-git-send-email-liangchen.linux@gmail.com> <1575622543-22470-2-git-send-email-liangchen.linux@gmail.com> <20191206092336.GA7650@infradead.org> In-Reply-To: <20191206092336.GA7650@infradead.org> From: Liang C Date: Fri, 6 Dec 2019 19:23:35 +0800 Message-ID: Subject: Re: [PATCH 2/2] [PATCH] bcache: __write_super to handle page sizes other than 4k To: Christoph Hellwig Cc: Coly Li , Kent Overstreet , linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for the advise. Yeah, calculating the offset based on the buffer size is possible. I just wanted to avoid making a dependency on some buffer head internal logic here, like the way it dividesthe page into equal sized buffers, and at the same time keep the patch less intrusive. On Fri, Dec 6, 2019 at 5:23 PM Christoph Hellwig wrote: > > On Fri, Dec 06, 2019 at 04:55:43PM +0800, Liang Chen wrote: > > __write_super assumes super block data starts at offset 0 of the page > > read in with __bread from read_super, which is not true when page size > > is not 4k. We encountered the issue on system with 64K page size - commonly > > seen on aarch64 architecture. > > > > Instead of making any assumption on the offset of the data within the page, > > this patch calls __bread again to locate the data. That should not introduce > > an extra io since the page has been held when it's read in from read_super, > > and __write_super is not on performance critical code path. > > No need to use buffer heads here, you can just use offset_in_page > to calculate the offset. Similarly I think the read side shouldn't > use buffer heads either (it is the only use of buffer heads in bcache!), > a siple read_cache_page should be all that is needed.