From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752757AbbHNUzb (ORCPT ); Fri, 14 Aug 2015 16:55:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57054 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752627AbbHNUz3 (ORCPT ); Fri, 14 Aug 2015 16:55:29 -0400 From: Jeff Moyer To: Andreas Dilger Cc: matthew.r.wilcox@intel.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@ml01.01.org Subject: Re: [PATCH 2/2] blockdev: don't set S_DAX for misaligned partitions References: <1439583332-13754-1-git-send-email-jmoyer@redhat.com> <1439583332-13754-3-git-send-email-jmoyer@redhat.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Fri, 14 Aug 2015 16:55:28 -0400 In-Reply-To: (Andreas Dilger's message of "Fri, 14 Aug 2015 14:46:04 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andreas Dilger writes: > On Aug 14, 2015, at 2:15 PM, Jeff Moyer wrote: >> >> The dax code doesn't currently support misaligned partitions, >> so disable O_DIRECT via dax until such time as that support >> materializes. >> >> Suggested-by: Boaz Harrosh >> Signed-off-by: Jeff Moyer >> --- >> fs/block_dev.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/fs/block_dev.c b/fs/block_dev.c >> index 1982437..1170f8c 100644 >> --- a/fs/block_dev.c >> +++ b/fs/block_dev.c >> @@ -1241,6 +1241,13 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) >> goto out_clear; >> } >> bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); >> + /* >> + * If the partition is not aligned on a page >> + * boundary, we can't do dax I/O to it. >> + */ >> + if ((bdev->bd_part->start_sect % (PAGE_SIZE / 512)) || >> + (bdev->bd_part->nr_sects % (PAGE_SIZE / 512))) > > Maybe I'm missing something, but doesn't the second condition above > disable DAX for the case that the 1/2 patch is fixing (i.e. the last > sectors at the end of a non-PAGE_SIZE-multiple device)? It seems a > shame to disable DAX for the whole device because of the last sector. No. Patch 1/2 fixes a 512 byte read of the last sector of a properly aligned partiton. The goal is to eventually fix things so we can enable the dax path for misaligned partitions, but it's not going to happen in time for 4.2. Also, keep in mind that this is just for opening the block device itself with O_DIRECT. Thanks for taking a look. Cheers, Jeff