identify multipage ->writepages() calls
authorAndrew Morton <akpm@osdl.org>
Wed, 16 Nov 2005 23:07:01 +0000 (15:07 -0800)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 6 Jan 2006 19:58:38 +0000 (14:58 -0500)
 NFS needs to be able to distinguish between single-page ->writepage() calls and
 multipage ->writepages() calls.

 For the single-page writepage calls NFS can kick off the I/O within the
 context of ->writepage().

 For multipage ->writepages calls, nfs_writepage() will leave the I/O pending
 and nfs_writepages() will kick off the I/O when it all has been queued up
 within NFS.

Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
include/linux/writeback.h
mm/page-writeback.c

index 64a36ba43b2f051cc74ad32329b59b8dfcbc336e..b096159086e8c772ab4ef8fc5931ecb35a137021 100644 (file)
@@ -53,10 +53,11 @@ struct writeback_control {
        loff_t start;
        loff_t end;
 
-       unsigned nonblocking:1;                 /* Don't get stuck on request queues */
-       unsigned encountered_congestion:1;      /* An output: a queue is full */
-       unsigned for_kupdate:1;                 /* A kupdate writeback */
-       unsigned for_reclaim:1;                 /* Invoked from the page allocator */
+       unsigned nonblocking:1;         /* Don't get stuck on request queues */
+       unsigned encountered_congestion:1; /* An output: a queue is full */
+       unsigned for_kupdate:1;         /* A kupdate writeback */
+       unsigned for_reclaim:1;         /* Invoked from the page allocator */
+       unsigned for_writepages:1;      /* This is a writepages() call */
 };
 
 /*
index 0166ea15c9ee8d61f08ddc6e100de841e59205c7..5240e426c1f771d24febb3ac60c8b375e794d28d 100644 (file)
@@ -550,11 +550,17 @@ void __init page_writeback_init(void)
 
 int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {
+       int ret;
+
        if (wbc->nr_to_write <= 0)
                return 0;
+       wbc->for_writepages = 1;
        if (mapping->a_ops->writepages)
-               return mapping->a_ops->writepages(mapping, wbc);
-       return generic_writepages(mapping, wbc);
+               ret =  mapping->a_ops->writepages(mapping, wbc);
+       else
+               ret = generic_writepages(mapping, wbc);
+       wbc->for_writepages = 0;
+       return ret;
 }
 
 /**