From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Chinner Subject: Re: [patch 18/19] Use page_cache_xxx for fs/xfs Date: Thu, 29 Nov 2007 14:58:33 +1100 Message-ID: <20071129035833.GY119954183@sgi.com> References: <20071129011052.866354847@sgi.com> <20071129011148.509714554@sgi.com> <20071129030314.GR119954183@sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Chinner , akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , Mel Gorman , William Lee Irwin III , Jens Axboe , Badari Pulavarty , Maxim Levitsky , Fengguang Wu , swin wang , totty.lu@gmail.com, hugh@veritas.com, joern@lazybastard.org To: Christoph Lameter Return-path: Received: from relay1.sgi.com ([192.48.171.29]:42111 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751239AbXK2D7B (ORCPT ); Wed, 28 Nov 2007 22:59:01 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Nov 28, 2007 at 07:28:17PM -0800, Christoph Lameter wrote: > In other words the following patch? > Index: mm/fs/xfs/linux-2.6/xfs_aops.c > =================================================================== > --- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:13:13.323382722 -0800 > +++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:22:15.686920219 -0800 > @@ -75,7 +75,7 @@ xfs_page_trace( > xfs_inode_t *ip; > bhv_vnode_t *vp = vn_from_inode(inode); > loff_t isize = i_size_read(inode); > - loff_t offset = page_cache_offset(page->mapping); > + loff_t offset = page_cache_pos(page->mapping, page->index, 0); > int delalloc = -1, unmapped = -1, unwritten = -1; > > if (page_has_buffers(page)) Good. > @@ -780,13 +780,11 @@ xfs_convert_page( > * count of buffers on the page. > */ > end_offset = min_t(unsigned long long, > - (xfs_off_t)(page->index + 1) << page_cache_shift(map), > + (xfs_off_t)page_cache_pos(map, page->index + 1, 0), > i_size_read(inode)); > > len = 1 << inode->i_blkbits; > - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), > - page_cache_size(map)); > - p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map); > + p_offset = page_cache_offset(map, end_offset); No, still need the roundup. i.e.: - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), - page_cache_size(map)); + p_offset = page_cache_offset(map, end_offset); p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map); > page_dirty = p_offset / len; > > bh = head = page_buffers(page); > @@ -943,7 +941,6 @@ xfs_page_state_convert( > int trylock = 0; > int all_bh = unmapped; > struct address_space *map = inode->i_mapping; > - int pagesize = page_cache_size(map); > > if (startio) { > if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking) > @@ -979,9 +976,7 @@ xfs_page_state_convert( > end_offset = min_t(unsigned long long, > (xfs_off_t)page_cache_pos(map, page->index + 1, 0), offset); > len = 1 << inode->i_blkbits; > - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), > - pagesize); > - p_offset = p_offset ? roundup(p_offset, len) : pagesize; > + p_offset = page_cache_offset(map, end_offset); And still need the roundup here as well. > page_dirty = p_offset / len; > > bh = head = page_buffers(page); > @@ -1132,8 +1127,8 @@ xfs_page_state_convert( > xfs_start_page_writeback(page, wbc, 1, count); > > if (ioend && iomap_valid) { > - offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >> > - page_cache_shift(map); > + offset = page_cache_index(map, > + (iomap.iomap_offset + iomap.iomap_bsize - 1)); Good. > tlast = min_t(pgoff_t, offset, last_index); > xfs_cluster_write(inode, page->index + 1, &iomap, &ioend, > wbc, startio, all_bh, tlast); > Index: mm/fs/xfs/linux-2.6/xfs_lrw.c > =================================================================== > --- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:35.454383115 -0800 > +++ mm/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:59.222132796 -0800 > @@ -142,7 +142,7 @@ xfs_iozero( > unsigned offset, bytes; > void *fsdata; > > - offset = page_cache_offset(mapping, pos); /* Within page */ > + offset = page_cache_offset(mapping, pos); Ok. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group