On Fri, Nov 09, 2018 at 07:18:19AM -0800, Christoph Hellwig wrote: > > static blk_qc_t > > iomap_dio_zero(struct iomap_dio *dio, struct iomap *iomap, loff_t pos, > > unsigned len) > > { > > struct page *page = ZERO_PAGE(0); > > struct bio *bio; > > + int npages = howmany(len, PAGE_SIZE); > > + > > + WARN_ON_ONCE(npages > 16); > > Where does this magic 16 come from? 4k page size, 64k block size. Debug code, essentially. > > + WARN_ON(len != 0); > > WARN_ON_ONCE please to avoid making the log unreadable if it ever > triggers. Debug code, too, so it'll get removed eventually. > > +/* > > + * This is lifted almost straight from xfs_flush_unmap_range(). Need a generic > > + * version of the block size rounding for these purposes. > > + */ > > Can you just add a generic version of this in a separate patch and > also switch XFS over to it? Well, they do different things. The xfs code must truncate the page cache over the range (because we are removing the underlying storage) while this just attempts to invalidate the pages and simply says "have a nice day" if it fails. So they really are two different functions. The comment was written when I expected that I was going to need to do lots more block size rounding for invalidation in the generic code., but it seems that may actually not be necessary.... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx