From patchwork Mon Aug 15 19:09:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 9281969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1CC36607FD for ; Mon, 15 Aug 2016 19:13:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11AD928E58 for ; Mon, 15 Aug 2016 19:13:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 062B928E5D; Mon, 15 Aug 2016 19:13:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AE3028E58 for ; Mon, 15 Aug 2016 19:13:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753220AbcHOTMh (ORCPT ); Mon, 15 Aug 2016 15:12:37 -0400 Received: from mga02.intel.com ([134.134.136.20]:13282 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753322AbcHOTLJ (ORCPT ); Mon, 15 Aug 2016 15:11:09 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 15 Aug 2016 12:09:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,526,1464678000"; d="scan'208";a="749052628" Received: from theros.lm.intel.com ([10.232.112.92]) by FMSMGA003.fm.intel.com with ESMTP; 15 Aug 2016 12:09:24 -0700 From: Ross Zwisler To: linux-kernel@vger.kernel.org Cc: Ross Zwisler , "Theodore Ts'o" , Alexander Viro , Andreas Dilger , Andrew Morton , Dan Williams , Dave Chinner , Jan Kara , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@lists.01.org Subject: [PATCH 2/7] ext4: tell DAX the size of allocation holes Date: Mon, 15 Aug 2016 13:09:13 -0600 Message-Id: <20160815190918.20672-3-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160815190918.20672-1-ross.zwisler@linux.intel.com> References: <20160815190918.20672-1-ross.zwisler@linux.intel.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When DAX calls _ext4_get_block() and the file offset points to a hole we currently don't set bh->b_size. When we re-enable PMD faults DAX will need bh->b_size to tell it the size of the hole so it can decide whether to fault in a 4 KiB zero page or a 2 MiB zero page. _ext4_get_block() has the hole size information from ext4_map_blocks(), so populate bh->b_size. Signed-off-by: Ross Zwisler Reviewed-by: Jan Kara --- fs/ext4/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 3131747..1808013 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -759,6 +759,9 @@ static int _ext4_get_block(struct inode *inode, sector_t iblock, ext4_update_bh_state(bh, map.m_flags); bh->b_size = inode->i_sb->s_blocksize * map.m_len; ret = 0; + } else if (ret == 0) { + /* hole case, need to fill in bh->b_size */ + bh->b_size = inode->i_sb->s_blocksize * map.m_len; } return ret; }