From patchwork Tue Aug 23 22:04:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 9296521 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 5A40B60757 for ; Tue, 23 Aug 2016 22:07:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4018828D65 for ; Tue, 23 Aug 2016 22:07:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34D4428D69; Tue, 23 Aug 2016 22:07:39 +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 BD4B028D65 for ; Tue, 23 Aug 2016 22:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758390AbcHWWH2 (ORCPT ); Tue, 23 Aug 2016 18:07:28 -0400 Received: from mga05.intel.com ([192.55.52.43]:64450 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754969AbcHWWEc (ORCPT ); Tue, 23 Aug 2016 18:04:32 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP; 23 Aug 2016 15:04:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,567,1464678000"; d="scan'208";a="752634144" Received: from theros.lm.intel.com ([10.232.112.92]) by FMSMGA003.fm.intel.com with ESMTP; 23 Aug 2016 15:04:30 -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, Matthew Wilcox Subject: [PATCH v2 2/9] ext2: tell DAX the size of allocation holes Date: Tue, 23 Aug 2016 16:04:12 -0600 Message-Id: <20160823220419.11717-3-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160823220419.11717-1-ross.zwisler@linux.intel.com> References: <20160823220419.11717-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 ext2_get_block() and the file offset points to a hole we currently don't set bh_result->b_size. When we re-enable PMD faults DAX will need bh_result->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. Signed-off-by: Ross Zwisler --- fs/ext2/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index d5c7d09..dd55d74 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -773,6 +773,9 @@ int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_ if (ret > 0) { bh_result->b_size = (ret << inode->i_blkbits); ret = 0; + } else if (ret == 0) { + /* hole case, need to fill in bh_result->b_size */ + bh_result->b_size = 1 << inode->i_blkbits; } return ret;