From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Moyer Subject: Re: regression introduced by "block: Add support for DAX reads/writes to block devices" Date: Fri, 07 Aug 2015 16:41:10 -0400 Message-ID: References: <100D68C7BA14664A8938383216E40DE04091408C@FMSMSX114.amr.corp.intel.com> <100D68C7BA14664A8938383216E40DE0409144D9@FMSMSX114.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain Cc: "linda.knippers\@hp.com" , "linux-kernel\@vger.kernel.org" , "linux-fsdevel\@vger.kernel.org" To: "Wilcox\, Matthew R" Return-path: In-Reply-To: <100D68C7BA14664A8938383216E40DE0409144D9@FMSMSX114.amr.corp.intel.com> (Matthew R. Wilcox's message of "Fri, 7 Aug 2015 18:11:14 +0000") Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org "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