Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp105pxk; Tue, 15 Sep 2020 15:54:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDrLmoCGChwkEYl/zxaA0QEouow4duPk1os5bz1Dkzd46I3xMBnmt1dN7g8VSZ+mjuy02I X-Received: by 2002:a05:6402:1386:: with SMTP id b6mr24677904edv.296.1600210443107; Tue, 15 Sep 2020 15:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600210443; cv=none; d=google.com; s=arc-20160816; b=fFPDNUIy8xCO83wiQTeZG0RalHgwL+LZY2pCtv/uHVwK1fAREhrSoxrOCx5XC/hOQ3 Uj2f4wzrQjHqZ4PEPTI/tvbw/LW/tD9etFhzWk5oDFEM15iSuCYsP3pgKK1F3jQFPfeJ cgwrLN8LRjHOEfyuze9hWGyWkKnie/OuZpQVGoJ5WzMIK7gl+25RK4Copu50Bh/U88tz 91+kG1/b6RyglJENk2oXHlH2u2yUOARdKSya3NwKWECpn+Oty3ER5I9RkOrKacsqyv1b mil0szo+bk2WZVFhX+/Fxm0AH8tmT1WZtw3/ef3S1pOL3nf2BrTRJf+4f5RtPBXaOtc0 ou3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from; bh=HYIWNXu9fSENHckSJjVWYTpkIqrQZitNRNCXgsFV9uU=; b=LV5bcIx+ZCNKWUGR9CguAO/YuCdPe9CiU1GE00NdkJ3+7PlKIaf7Zfj3rPEreajMyb 0p/mqNnJsXeAWB2qIzBE02ekepWQEW9PZt0jk2BoAU3atidxSbjjso0cDhY/eTgUEJ5f BzdhtiGKkRuqVgzmzIcsdQtSiiXVSXZnjusWqkg1U/f0k0Tu4xEp4ZFJMxGuAlCk7+Of RHUnJdFFQ6shHTfrIEpxrhbkBYtAGHAa54GdP5RjpxNoTGtKprLGQbirZdNzzyV9b4w/ a7Q8SeEnEQMAEXJgqfwgaLU0Qy+HNvcdepAOvfbsGIex0D70FOV1v7LN34ayCRkOK8Yc AfPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si10522550ejg.134.2020.09.15.15.53.40; Tue, 15 Sep 2020 15:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727639AbgIOWxJ convert rfc822-to-8bit (ORCPT + 99 others); Tue, 15 Sep 2020 18:53:09 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:57891 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727413AbgIOPk5 (ORCPT ); Tue, 15 Sep 2020 11:40:57 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-53-W38LQ2b8OBS5NKJlBcK7FA-1; Tue, 15 Sep 2020 16:40:53 +0100 X-MC-Unique: W38LQ2b8OBS5NKJlBcK7FA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 15 Sep 2020 16:40:52 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 15 Sep 2020 16:40:52 +0100 From: David Laight To: "'Matthew Wilcox (Oracle)'" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" CC: "Darrick J . Wong" , Christoph Hellwig , "linux-nvdimm@lists.01.org" , "linux-kernel@vger.kernel.org" , Dave Kleikamp , "jfs-discussion@lists.sourceforge.net" , Christoph Hellwig , "Dave Chinner" Subject: RE: [PATCH v2 2/9] fs: Introduce i_blocks_per_page Thread-Topic: [PATCH v2 2/9] fs: Introduce i_blocks_per_page Thread-Index: AQHWh8zSUX5EB+iAm0+PkXaO9U0VzKlp3UwQ Date: Tue, 15 Sep 2020 15:40:52 +0000 Message-ID: <0c874f14499c4d819f3e8e09f5086d77@AcuMS.aculab.com> References: <20200910234707.5504-1-willy@infradead.org> <20200910234707.5504-3-willy@infradead.org> In-Reply-To: <20200910234707.5504-3-willy@infradead.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox (Oracle) > Sent: 11 September 2020 00:47 > This helper is useful for both THPs and for supporting block size larger > than page size. Convert all users that I could find (we have a few > different ways of writing this idiom, and I may have missed some). > ... > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index d81a9a86c5aa..330f86b825d7 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -46,7 +46,7 @@ iomap_page_create(struct inode *inode, struct page *page) > { > struct iomap_page *iop = to_iomap_page(page); > > - if (iop || i_blocksize(inode) == PAGE_SIZE) > + if (iop || i_blocks_per_page(inode, page) <= 1) > return iop; > > iop = kmalloc(sizeof(*iop), GFP_NOFS | __GFP_NOFAIL); > @@ -147,7 +147,7 @@ iomap_iop_set_range_uptodate(struct page *page, unsigned off, unsigned len) > unsigned int i; > > spin_lock_irqsave(&iop->uptodate_lock, flags); > - for (i = 0; i < PAGE_SIZE / i_blocksize(inode); i++) { > + for (i = 0; i < i_blocks_per_page(inode, page); i++) { You probably don't want to call the helper every time around the loop. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)