public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] ntfs: use add_to_page_cache_lru
@ 2010-04-05 15:46 Minchan Kim
  2010-04-06 15:47 ` Nick Piggin
  0 siblings, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2010-04-05 15:46 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Anton Altaparmakov, Al Viro, Jiri Kosina, Christoph Hellwig,
	linux-kernel, linux-ntfs-dev, Nick Piggin


While I discuss exportable add_to_page_cache_lru, 
http://marc.info/?l=linux-mm&m=127047788612445&w=2
I found that 
http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg04472.html.

Let's change to use it in ntfs.

== CUT_HERE ==

Quote from Nick piggin's about btrfs patch
- http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg04472.html.

"add_to_page_cache_lru is exported, so it should be used. Benefits over
using a private pagevec: neater code, 128 bytes fewer stack used, percpu
lru ordering is preserved, and finally don't need to flush pagevec
before returning so batching may be shared with other LRU insertions."

Let's use it instead of private pagevec in ntfs, too.

Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
 fs/ntfs/file.c |   19 ++++---------------
 1 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index 41ffdcc..f05b650 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -398,18 +398,13 @@ static inline void ntfs_fault_in_pages_readable_iovec(const struct iovec *iov,
  * Obtain @nr_pages locked page cache pages from the mapping @mapping and
  * starting at index @index.
  *
- * If a page is newly created, increment its refcount and add it to the
- * caller's lru-buffering pagevec @lru_pvec.
- *
- * This is the same as mm/filemap.c::__grab_cache_page(), except that @nr_pages
- * are obtained at once instead of just one page and that 0 is returned on
- * success and -errno on error.
+ * If a page is newly created, add it to lru list
  *
  * Note, the page locks are obtained in ascending page index order.
  */
 static inline int __ntfs_grab_cache_pages(struct address_space *mapping,
 		pgoff_t index, const unsigned nr_pages, struct page **pages,
-		struct page **cached_page, struct pagevec *lru_pvec)
+		struct page **cached_page)
 {
 	int err, nr;
 
@@ -425,7 +420,7 @@ static inline int __ntfs_grab_cache_pages(struct address_space *mapping,
 					goto err_out;
 				}
 			}
-			err = add_to_page_cache(*cached_page, mapping, index,
+			err = add_to_page_cache_lru(*cached_page, mapping, index,
 					GFP_KERNEL);
 			if (unlikely(err)) {
 				if (err == -EEXIST)
@@ -433,9 +428,6 @@ static inline int __ntfs_grab_cache_pages(struct address_space *mapping,
 				goto err_out;
 			}
 			pages[nr] = *cached_page;
-			page_cache_get(*cached_page);
-			if (unlikely(!pagevec_add(lru_pvec, *cached_page)))
-				__pagevec_lru_add_file(lru_pvec);
 			*cached_page = NULL;
 		}
 		index++;
@@ -1795,7 +1787,6 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,
 	ssize_t status, written;
 	unsigned nr_pages;
 	int err;
-	struct pagevec lru_pvec;
 
 	ntfs_debug("Entering for i_ino 0x%lx, attribute type 0x%x, "
 			"pos 0x%llx, count 0x%lx.",
@@ -1907,7 +1898,6 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,
 			}
 		}
 	}
-	pagevec_init(&lru_pvec, 0);
 	written = 0;
 	/*
 	 * If the write starts beyond the initialized size, extend it up to the
@@ -2006,7 +1996,7 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,
 			ntfs_fault_in_pages_readable_iovec(iov, iov_ofs, bytes);
 		/* Get and lock @do_pages starting at index @start_idx. */
 		status = __ntfs_grab_cache_pages(mapping, start_idx, do_pages,
-				pages, &cached_page, &lru_pvec);
+				pages, &cached_page);
 		if (unlikely(status))
 			break;
 		/*
@@ -2071,7 +2061,6 @@ err_out:
 	*ppos = pos;
 	if (cached_page)
 		page_cache_release(cached_page);
-	pagevec_lru_add_file(&lru_pvec);
 	ntfs_debug("Done.  Returning %s (written 0x%lx, status %li).",
 			written ? "written" : "status", (unsigned long)written,
 			(long)status);
-- 
1.6.5




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ntfs: use add_to_page_cache_lru
  2010-04-05 15:46 [PATCH 2/2] ntfs: use add_to_page_cache_lru Minchan Kim
@ 2010-04-06 15:47 ` Nick Piggin
  2010-04-06 16:30   ` Minchan Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Piggin @ 2010-04-06 15:47 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, Anton Altaparmakov, Al Viro, Jiri Kosina,
	Christoph Hellwig, linux-kernel, linux-ntfs-dev

On Tue, Apr 06, 2010 at 12:46:05AM +0900, Minchan Kim wrote:
> 
> While I discuss exportable add_to_page_cache_lru, 
> http://marc.info/?l=linux-mm&m=127047788612445&w=2
> I found that 
> http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg04472.html.
> 
> Let's change to use it in ntfs.

Thanks, I went through most filesystems and changed it in those too,
including ntfs. Haven't had much feedback but I'll just send the
patches to Andrew if they haven't been merged by next release.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ntfs: use add_to_page_cache_lru
  2010-04-06 15:47 ` Nick Piggin
@ 2010-04-06 16:30   ` Minchan Kim
  2010-04-06 17:11     ` Nick Piggin
  0 siblings, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2010-04-06 16:30 UTC (permalink / raw)
  To: Nick Piggin
  Cc: Andrew Morton, Anton Altaparmakov, Al Viro, Jiri Kosina,
	Christoph Hellwig, linux-kernel, linux-ntfs-dev

Hi, Nick.

On Wed, Apr 7, 2010 at 12:47 AM, Nick Piggin <npiggin@suse.de> wrote:
> On Tue, Apr 06, 2010 at 12:46:05AM +0900, Minchan Kim wrote:
>>
>> While I discuss exportable add_to_page_cache_lru,
>> http://marc.info/?l=linux-mm&m=127047788612445&w=2
>> I found that
>> http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg04472.html.
>>
>> Let's change to use it in ntfs.
>
> Thanks, I went through most filesystems and changed it in those too,
> including ntfs. Haven't had much feedback but I'll just send the
> patches to Andrew if they haven't been merged by next release.
>

Please, let me know it.
That's because actually I had a plan to change about some filesystem.
If you already did it, I don't need to do. :)

Thanks, Nick.



-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ntfs: use add_to_page_cache_lru
  2010-04-06 16:30   ` Minchan Kim
@ 2010-04-06 17:11     ` Nick Piggin
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Piggin @ 2010-04-06 17:11 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, Anton Altaparmakov, Al Viro, Jiri Kosina,
	Christoph Hellwig, linux-kernel, linux-ntfs-dev

On Wed, Apr 07, 2010 at 01:30:24AM +0900, Minchan Kim wrote:
> Hi, Nick.
> 
> On Wed, Apr 7, 2010 at 12:47 AM, Nick Piggin <npiggin@suse.de> wrote:
> > On Tue, Apr 06, 2010 at 12:46:05AM +0900, Minchan Kim wrote:
> >>
> >> While I discuss exportable add_to_page_cache_lru,
> >> http://marc.info/?l=linux-mm&m=127047788612445&w=2
> >> I found that
> >> http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg04472.html.
> >>
> >> Let's change to use it in ntfs.
> >
> > Thanks, I went through most filesystems and changed it in those too,
> > including ntfs. Haven't had much feedback but I'll just send the
> > patches to Andrew if they haven't been merged by next release.
> >
> 
> Please, let me know it.
> That's because actually I had a plan to change about some filesystem.
> If you already did it, I don't need to do. :)

I did most of them and cc'ed linux-fsdevel last month. btrfs, cifs,
nfs, ntfs. If you find any others, fix em up :)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-06 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-05 15:46 [PATCH 2/2] ntfs: use add_to_page_cache_lru Minchan Kim
2010-04-06 15:47 ` Nick Piggin
2010-04-06 16:30   ` Minchan Kim
2010-04-06 17:11     ` Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox