Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946252AbbHGUlN (ORCPT ); Fri, 7 Aug 2015 16:41:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60454 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbbHGUlM (ORCPT ); Fri, 7 Aug 2015 16:41:12 -0400 From: Jeff Moyer To: "Wilcox\, Matthew R" Cc: "linda.knippers\@hp.com" , "linux-kernel\@vger.kernel.org" , "linux-fsdevel\@vger.kernel.org" Subject: Re: regression introduced by "block: Add support for DAX reads/writes to block devices" References: <100D68C7BA14664A8938383216E40DE04091408C@FMSMSX114.amr.corp.intel.com> <100D68C7BA14664A8938383216E40DE0409144D9@FMSMSX114.amr.corp.intel.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, 07 Aug 2015 16:41:10 -0400 In-Reply-To: <100D68C7BA14664A8938383216E40DE0409144D9@FMSMSX114.amr.corp.intel.com> (Matthew R. Wilcox's message of "Fri, 7 Aug 2015 18:11:14 +0000") 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 Content-Length: 1199 Lines: 32 "Wilcox, Matthew R" writes: > So ... what you're doing here is if somebody requests the last 512 > bytes, you're asking for the last page. That's going to work as long > as the partition is a multiple of PAGE_SIZE, but not if the partition > happens to be misaligned. It's an improvement, although I'd be > tempted to do this as: > > if (pos == max) { > unsigned blkbits = inode->i_blkbits; > - sector_t block = pos >> blkbits; > + long page = pos >> PAGE_SHIFT; > + sector_t block = page << (PAGE_SHIFT - blkbits); > unsigned first = pos - (block << blkbits); > long size; Yeah, that's easier to read. > We need to cope with the case where the end of a partition isn't on a > page boundary though. Well, that's usually done by falling back to buffered I/O. I gave that a try and panicked the box. :) I'll keep looking into it, but probably won't have another patch until next week. Cheers, Jeff -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/