From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id 782431A1E2C for ; Mon, 15 Aug 2016 12:09:25 -0700 (PDT) From: Ross Zwisler Subject: [PATCH 3/7] dax: remove buffer_size_valid() Date: Mon, 15 Aug 2016 13:09:14 -0600 Message-Id: <20160815190918.20672-4-ross.zwisler@linux.intel.com> In-Reply-To: <20160815190918.20672-1-ross.zwisler@linux.intel.com> References: <20160815190918.20672-1-ross.zwisler@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: linux-kernel@vger.kernel.org Cc: Theodore Ts'o , Andrew Morton , linux-nvdimm@lists.01.org, Dave Chinner , linux-mm@kvack.org, Andreas Dilger , Alexander Viro , Jan Kara , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org List-ID: Now that all our supported filesystems (ext2, ext4 and XFS) all properly set bh.b_size when we call get_block() for a hole, rely on that value and remove the buffer_size_valid() sanity check. Signed-off-by: Ross Zwisler --- fs/dax.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 993dc6f..8030f93 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -121,19 +121,6 @@ static bool buffer_written(struct buffer_head *bh) return buffer_mapped(bh) && !buffer_unwritten(bh); } -/* - * When ext4 encounters a hole, it returns without modifying the buffer_head - * which means that we can't trust b_size. To cope with this, we set b_state - * to 0 before calling get_block and, if any bit is set, we know we can trust - * b_size. Unfortunate, really, since ext4 knows precisely how long a hole is - * and would save us time calling get_block repeatedly. - */ -static bool buffer_size_valid(struct buffer_head *bh) -{ - return bh->b_state != 0; -} - - static sector_t to_sector(const struct buffer_head *bh, const struct inode *inode) { @@ -175,8 +162,6 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter, rc = get_block(inode, block, bh, rw == WRITE); if (rc) break; - if (!buffer_size_valid(bh)) - bh->b_size = 1 << blkbits; bh_max = pos - first + bh->b_size; bdev = bh->b_bdev; /* @@ -1010,12 +995,7 @@ int dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, bdev = bh.b_bdev; - /* - * If the filesystem isn't willing to tell us the length of a hole, - * just fall back to PTEs. Calling get_block 512 times in a loop - * would be silly. - */ - if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) { + if (bh.b_size < PMD_SIZE) { dax_pmd_dbg(&bh, address, "allocated block too small"); return VM_FAULT_FALLBACK; } -- 2.9.0 _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932250AbcHOTLO (ORCPT ); Mon, 15 Aug 2016 15:11:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:36178 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753388AbcHOTLK (ORCPT ); Mon, 15 Aug 2016 15:11:10 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,526,1464678000"; d="scan'208";a="749052636" 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@ml01.01.org Subject: [PATCH 3/7] dax: remove buffer_size_valid() Date: Mon, 15 Aug 2016 13:09:14 -0600 Message-Id: <20160815190918.20672-4-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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that all our supported filesystems (ext2, ext4 and XFS) all properly set bh.b_size when we call get_block() for a hole, rely on that value and remove the buffer_size_valid() sanity check. Signed-off-by: Ross Zwisler --- fs/dax.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 993dc6f..8030f93 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -121,19 +121,6 @@ static bool buffer_written(struct buffer_head *bh) return buffer_mapped(bh) && !buffer_unwritten(bh); } -/* - * When ext4 encounters a hole, it returns without modifying the buffer_head - * which means that we can't trust b_size. To cope with this, we set b_state - * to 0 before calling get_block and, if any bit is set, we know we can trust - * b_size. Unfortunate, really, since ext4 knows precisely how long a hole is - * and would save us time calling get_block repeatedly. - */ -static bool buffer_size_valid(struct buffer_head *bh) -{ - return bh->b_state != 0; -} - - static sector_t to_sector(const struct buffer_head *bh, const struct inode *inode) { @@ -175,8 +162,6 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter, rc = get_block(inode, block, bh, rw == WRITE); if (rc) break; - if (!buffer_size_valid(bh)) - bh->b_size = 1 << blkbits; bh_max = pos - first + bh->b_size; bdev = bh->b_bdev; /* @@ -1010,12 +995,7 @@ int dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, bdev = bh.b_bdev; - /* - * If the filesystem isn't willing to tell us the length of a hole, - * just fall back to PTEs. Calling get_block 512 times in a loop - * would be silly. - */ - if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) { + if (bh.b_size < PMD_SIZE) { dax_pmd_dbg(&bh, address, "allocated block too small"); return VM_FAULT_FALLBACK; } -- 2.9.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 3/7] dax: remove buffer_size_valid() Date: Mon, 15 Aug 2016 13:09:14 -0600 Message-Id: <20160815190918.20672-4-ross.zwisler@linux.intel.com> In-Reply-To: <20160815190918.20672-1-ross.zwisler@linux.intel.com> References: <20160815190918.20672-1-ross.zwisler@linux.intel.com> Sender: owner-linux-mm@kvack.org List-ID: Now that all our supported filesystems (ext2, ext4 and XFS) all properly set bh.b_size when we call get_block() for a hole, rely on that value and remove the buffer_size_valid() sanity check. Signed-off-by: Ross Zwisler --- fs/dax.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 993dc6f..8030f93 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -121,19 +121,6 @@ static bool buffer_written(struct buffer_head *bh) return buffer_mapped(bh) && !buffer_unwritten(bh); } -/* - * When ext4 encounters a hole, it returns without modifying the buffer_head - * which means that we can't trust b_size. To cope with this, we set b_state - * to 0 before calling get_block and, if any bit is set, we know we can trust - * b_size. Unfortunate, really, since ext4 knows precisely how long a hole is - * and would save us time calling get_block repeatedly. - */ -static bool buffer_size_valid(struct buffer_head *bh) -{ - return bh->b_state != 0; -} - - static sector_t to_sector(const struct buffer_head *bh, const struct inode *inode) { @@ -175,8 +162,6 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter, rc = get_block(inode, block, bh, rw == WRITE); if (rc) break; - if (!buffer_size_valid(bh)) - bh->b_size = 1 << blkbits; bh_max = pos - first + bh->b_size; bdev = bh->b_bdev; /* @@ -1010,12 +995,7 @@ int dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, bdev = bh.b_bdev; - /* - * If the filesystem isn't willing to tell us the length of a hole, - * just fall back to PTEs. Calling get_block 512 times in a loop - * would be silly. - */ - if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) { + if (bh.b_size < PMD_SIZE) { dax_pmd_dbg(&bh, address, "allocated block too small"); return VM_FAULT_FALLBACK; } -- 2.9.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ross Zwisler Subject: [PATCH 3/7] dax: remove buffer_size_valid() Date: Mon, 15 Aug 2016 13:09:14 -0600 Message-ID: <20160815190918.20672-4-ross.zwisler@linux.intel.com> References: <20160815190918.20672-1-ross.zwisler@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Theodore Ts'o , Andrew Morton , linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org, Dave Chinner , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Andreas Dilger , Alexander Viro , Jan Kara , linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Return-path: In-Reply-To: <20160815190918.20672-1-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org Sender: "Linux-nvdimm" List-Id: linux-ext4.vger.kernel.org Now that all our supported filesystems (ext2, ext4 and XFS) all properly set bh.b_size when we call get_block() for a hole, rely on that value and remove the buffer_size_valid() sanity check. Signed-off-by: Ross Zwisler --- fs/dax.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 993dc6f..8030f93 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -121,19 +121,6 @@ static bool buffer_written(struct buffer_head *bh) return buffer_mapped(bh) && !buffer_unwritten(bh); } -/* - * When ext4 encounters a hole, it returns without modifying the buffer_head - * which means that we can't trust b_size. To cope with this, we set b_state - * to 0 before calling get_block and, if any bit is set, we know we can trust - * b_size. Unfortunate, really, since ext4 knows precisely how long a hole is - * and would save us time calling get_block repeatedly. - */ -static bool buffer_size_valid(struct buffer_head *bh) -{ - return bh->b_state != 0; -} - - static sector_t to_sector(const struct buffer_head *bh, const struct inode *inode) { @@ -175,8 +162,6 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter, rc = get_block(inode, block, bh, rw == WRITE); if (rc) break; - if (!buffer_size_valid(bh)) - bh->b_size = 1 << blkbits; bh_max = pos - first + bh->b_size; bdev = bh->b_bdev; /* @@ -1010,12 +995,7 @@ int dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, bdev = bh.b_bdev; - /* - * If the filesystem isn't willing to tell us the length of a hole, - * just fall back to PTEs. Calling get_block 512 times in a loop - * would be silly. - */ - if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) { + if (bh.b_size < PMD_SIZE) { dax_pmd_dbg(&bh, address, "allocated block too small"); return VM_FAULT_FALLBACK; } -- 2.9.0