Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2645301pxv; Sun, 11 Jul 2021 21:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDUV0lMnDdMsLWjiI3VrD3R4SNMnGBYdP24aDP4oPV+iYxvupLZwgwc/gn2Xr7CR6+aMq4 X-Received: by 2002:a92:c0cc:: with SMTP id t12mr21436477ilf.47.1626063507691; Sun, 11 Jul 2021 21:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626063507; cv=none; d=google.com; s=arc-20160816; b=EKP+nyu2AVNjLOXgbKrIvQB+k45y/HGzoFI1ncK0meaN6rf+IqpwMmIcW38CKXPLSw JzWtcGarCP3cbYbIodRPXYYjFllVHzTQkMr+ZroPrX9OFs6e8tK+VF/c9Hpeh9j9Sl1U sEA9k5BdA+kux9z/86aUZS9sJ/XllKtRA+kAQ3TU8rTmwv71+ynE9eY83UgQH+NwBaVj Q94t+5f0WxAv8BvdEGuN5j47meXYmmkEmMtc7yga7fHjeWecxrrVPi/71eCJkR4tKA8V ZJ6LfJOhMQnf8VF+8oEQi2X1z1MnO5lRUzDsYdklEJU1vsq4xrwRRujA8k01KSyn/JML 0NyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OEayz0vZXxwwb3sWZ+SAgeiLQoq44uIs+KhQN0qQl24=; b=c+fVPdledh1GisNVT/L2Z0kyAIo3c0jpUwIjpFOtR9PuyaQa/dTT3U1PO78umqSon7 EEqUuq2PnULRVyxFk2gTbNj+TFNo9uVLmwniFl2H44CLGVZQUuN7c8zAmeTgFrixX15b UEGdAwyH2Qw1YbupoHIEDsR6irqgvCeREvZWPHIr49QT/p26tdtynJf2lZ/jv26RJf8h u/6DboS4zPvVVTXY5n4FToDesZvfuK5WGmjUgRALSgdStB+NbyKqAhV9it8ao6NKjLI8 P+uQxRE6NPMaA8ZPTPkP2Ehf4SDMT3sUHGICwbbBDkgHGjlYJwxlOTvlnn36Zmd3otqV 6uyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Rp9yMScE; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o7si351853ilc.64.2021.07.11.21.18.15; Sun, 11 Jul 2021 21:18:27 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Rp9yMScE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbhGLETA (ORCPT + 99 others); Mon, 12 Jul 2021 00:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbhGLETA (ORCPT ); Mon, 12 Jul 2021 00:19:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB69C0613DD; Sun, 11 Jul 2021 21:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=OEayz0vZXxwwb3sWZ+SAgeiLQoq44uIs+KhQN0qQl24=; b=Rp9yMScEt68IGGHILwaVcB11he tEr51zQ7OKh17g75hHAtgNjnH9U/aw+nvSx1yM7ufe6qbcfzyh0GLjshoJaHA1wUmc8ulR9m+FUTC VEHS/WBxbHdGJpj5SC/3aScmVMRF4t8fs1uIKbyNZgMNVW3eCLfp9mlmttpT4r7HhkAu5xhI5GBK8 kemXqbOBPGZbq8hE/R1XWlJx8rPufeVGEtqTcVsnT2ofr7feU2DyRnKPASTdSWn2qyivJIoiKIpim Uk0YmhdGMWlnlHOZ5ft6SLAaBMliXZmijQmQfxumHHK/X3nWaVgZn+H4vFgK/Id/eNwLZDtDmYJSq qqwrbfsQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2nLJ-00GrXi-QL; Mon, 12 Jul 2021 04:14:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v13 128/137] xfs: Support THPs Date: Mon, 12 Jul 2021 04:06:52 +0100 Message-Id: <20210712030701.4000097-129-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712030701.4000097-1-willy@infradead.org> References: <20210712030701.4000097-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is one place which assumes the size of a page; fix it. Signed-off-by: Matthew Wilcox (Oracle) --- fs/xfs/xfs_aops.c | 11 ++++++----- fs/xfs/xfs_super.c | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index cb4e0fcf4c76..9ffbd116592a 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -432,10 +432,11 @@ xfs_discard_page( struct page *page, loff_t fileoff) { - struct inode *inode = page->mapping->host; + struct folio *folio = page_folio(page); + struct inode *inode = folio->mapping->host; struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; - unsigned int pageoff = offset_in_page(fileoff); + size_t pageoff = offset_in_folio(folio, fileoff); xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, fileoff); xfs_fileoff_t pageoff_fsb = XFS_B_TO_FSBT(mp, pageoff); int error; @@ -445,14 +446,14 @@ xfs_discard_page( xfs_alert_ratelimited(mp, "page discard on page "PTR_FMT", inode 0x%llx, offset %llu.", - page, ip->i_ino, fileoff); + folio, ip->i_ino, fileoff); error = xfs_bmap_punch_delalloc_range(ip, start_fsb, - i_blocks_per_page(inode, page) - pageoff_fsb); + i_blocks_per_folio(inode, folio) - pageoff_fsb); if (error && !XFS_FORCED_SHUTDOWN(mp)) xfs_alert(mp, "page discard unable to remove delalloc mapping."); out_invalidate: - iomap_invalidatepage(page, pageoff, PAGE_SIZE - pageoff); + iomap_invalidatepage(&folio->page, pageoff, folio_size(folio) - pageoff); } static const struct iomap_writeback_ops xfs_writeback_ops = { diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 2c9e26a44546..24adea02b887 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1891,7 +1891,8 @@ static struct file_system_type xfs_fs_type = { .init_fs_context = xfs_init_fs_context, .parameters = xfs_fs_parameters, .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | \ + FS_THP_SUPPORT, }; MODULE_ALIAS_FS("xfs"); -- 2.30.2