From patchwork Thu Dec 24 16:20:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wilcox, Matthew R" X-Patchwork-Id: 7919401 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9F6EF9F716 for ; Thu, 24 Dec 2015 16:20:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C73C20628 for ; Thu, 24 Dec 2015 16:20:50 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3450620618 for ; Thu, 24 Dec 2015 16:20:49 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 587EC1A253C; Thu, 24 Dec 2015 08:20:47 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ml01.01.org (Postfix) with ESMTP id EAAE31A248D for ; Thu, 24 Dec 2015 08:20:45 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 24 Dec 2015 08:20:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,474,1444719600"; d="scan'208";a="18758582" Received: from ndattani-mobl1.amr.corp.intel.com (HELO thog.int.wil.cx) ([10.252.130.112]) by fmsmga004.fm.intel.com with SMTP; 24 Dec 2015 08:20:46 -0800 Received: by thog.int.wil.cx (Postfix, from userid 1000) id 15AAB5FB83; Thu, 24 Dec 2015 11:20:44 -0500 (EST) From: Matthew Wilcox To: Subject: [PATCH 8/8] ext4: Transparent support for PUD-sized transparent huge pages Date: Thu, 24 Dec 2015 11:20:37 -0500 Message-Id: <1450974037-24775-9-git-send-email-matthew.r.wilcox@intel.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1450974037-24775-1-git-send-email-matthew.r.wilcox@intel.com> References: <1450974037-24775-1-git-send-email-matthew.r.wilcox@intel.com> Cc: linux-nvdimm@lists.01.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Matthew Wilcox Call into DAX to provide support for PUD pages, just like the PMD cases. Signed-off-by: Matthew Wilcox --- fs/ext4/file.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 60683ab..b0cba51 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -262,6 +262,42 @@ static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr, return result; } +static int ext4_dax_pud_fault(struct vm_area_struct *vma, unsigned long addr, + pud_t *pud, unsigned int flags) +{ + int result; + handle_t *handle = NULL; + struct inode *inode = file_inode(vma->vm_file); + struct super_block *sb = inode->i_sb; + bool write = flags & FAULT_FLAG_WRITE; + + if (write) { + sb_start_pagefault(sb); + file_update_time(vma->vm_file); + down_read(&EXT4_I(inode)->i_mmap_sem); + handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE, + ext4_chunk_trans_blocks(inode, + PMD_SIZE / PAGE_SIZE)); + } else + down_read(&EXT4_I(inode)->i_mmap_sem); + + if (IS_ERR(handle)) + result = VM_FAULT_SIGBUS; + else + result = __dax_pud_fault(vma, addr, pud, flags, + ext4_dax_mmap_get_block, NULL); + + if (write) { + if (!IS_ERR(handle)) + ext4_journal_stop(handle); + up_read(&EXT4_I(inode)->i_mmap_sem); + sb_end_pagefault(sb); + } else + up_read(&EXT4_I(inode)->i_mmap_sem); + + return result; +} + static int ext4_dax_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) { int err; @@ -309,6 +345,7 @@ static int ext4_dax_pfn_mkwrite(struct vm_area_struct *vma, static const struct vm_operations_struct ext4_dax_vm_ops = { .fault = ext4_dax_fault, .pmd_fault = ext4_dax_pmd_fault, + .pud_fault = ext4_dax_pud_fault, .page_mkwrite = ext4_dax_mkwrite, .pfn_mkwrite = ext4_dax_pfn_mkwrite, };