Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.25-rc7 /fs/fs-writeback.c

Filename:/fs/fs-writeback.c
Lines Added:23
Lines Deleted:23
Also changed in: (Previous) 2.6.25-rc6-git8  2.6.25-rc6-git7  2.6.25-rc6-git6  2.6.25-rc6-git5  2.6.25-rc6-git4  2.6.25-rc6 
(Following) 2.6.25-rc8  2.6.25-rc9  2.6.25  2.6.25-git14  2.6.25-git15  2.6.25-git16 

Location
[  2.6.25-rc7
  [  fs
     o  fs-writeback.c

Patch

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 300324b..0655767 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -284,7 +284,17 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
              * soon as the queue becomes uncongested.
              */
             inode->i_state |= I_DIRTY_PAGES;
-            requeue_io(inode);
+            if (wbc->nr_to_write <= 0) {
+               /*
+                * slice used up: queue for next turn
+                */
+               requeue_io(inode);
+            } else {
+               /*
+                * somehow blocked: retry later
+                */
+               redirty_tail(inode);
+            }
          } else {
             /*
              * Otherwise fully redirty the inode so that
@@ -334,9 +344,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
       WARN_ON(inode->i_state & I_WILL_FREE);
 
    if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_SYNC)) {
-      struct address_space *mapping = inode->i_mapping;
-      int ret;
-
       /*
        * We're skipping this inode because it's locked, and we're not
        * doing writeback-for-data-integrity.  Move it to s_more_io so
@@ -345,15 +352,7 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
        * completed a full scan of s_io.
        */
       requeue_io(inode);
-
-      /*
-       * Even if we don't actually write the inode itself here,
-       * we can at least start some of the data writeout..
-       */
-      spin_unlock(&inode_lock);
-      ret = do_writepages(mapping, wbc);
-      spin_lock(&inode_lock);
-      return ret;
+      return 0;
    }
 
    /*
@@ -479,8 +478,12 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
       iput(inode);
       cond_resched();
       spin_lock(&inode_lock);
-      if (wbc->nr_to_write <= 0)
+      if (wbc->nr_to_write <= 0) {
+         wbc->more_io = 1;
          break;
+      }
+      if (!list_empty(&sb->s_more_io))
+         wbc->more_io = 1;
    }
    return;      /* Leave any unwritten inodes on s_io */
 }
@@ -512,8 +515,7 @@ writeback_inodes(struct writeback_control *wbc)
    might_sleep();
    spin_lock(&sb_lock);
 restart:
-   sb = sb_entry(super_blocks.prev);
-   for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) {
+   list_for_each_entry_reverse(sb, &super_blocks, s_list) {
       if (sb_has_dirty_inodes(sb)) {
          /* we're making our own get_super here */
          sb->s_count++;
@@ -578,10 +580,8 @@ static void set_sb_syncing(int val)
 {
    struct super_block *sb;
    spin_lock(&sb_lock);
-   sb = sb_entry(super_blocks.prev);
-   for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) {
+   list_for_each_entry_reverse(sb, &super_blocks, s_list)
       sb->s_syncing = val;
-   }
    spin_unlock(&sb_lock);
 }
 
@@ -655,7 +655,7 @@ int write_inode_now(struct inode *inode, int sync)
    int ret;
    struct writeback_control wbc = {
       .nr_to_write = LONG_MAX,
-      .sync_mode = WB_SYNC_ALL,
+      .sync_mode = sync ? WB_SYNC_ALL : WB_SYNC_NONE,
       .range_start = 0,
       .range_end = LLONG_MAX,
    };
@@ -751,7 +751,7 @@ int generic_osync_inode(struct inode *inode, struct address_space *mapping, int
 EXPORT_SYMBOL(generic_osync_inode);
 
 /**
- * writeback_acquire: attempt to get exclusive writeback access to a device
+ * writeback_acquire - attempt to get exclusive writeback access to a device
  * @bdi: the device's backing_dev_info structure
  *
  * It is a waste of resources to have more than one pdflush thread blocked on
@@ -768,7 +768,7 @@ int writeback_acquire(struct backing_dev_info *bdi)
 }
 
 /**
- * writeback_in_progress: determine whether there is writeback in progress
+ * writeback_in_progress - determine whether there is writeback in progress
  * @bdi: the device's backing_dev_info structure.
  *
  * Determine whether there is writeback in progress against a backing device.
@@ -779,7 +779,7 @@ int writeback_in_progress(struct backing_dev_info *bdi)
 }
 
 /**
- * writeback_release: relinquish exclusive writeback access against a device.
+ * writeback_release - relinquish exclusive writeback access against a device.
  * @bdi: the device's backing_dev_info structure
  */
 void writeback_release(struct backing_dev_info *bdi)


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.