- patches.suse/slab-handle-memoryless-nodes-v2a.patch: Refresh.
[linux-flexiantxendom0-3.2.10.git] / fs / fs-writeback.c
index d42f634..1a7c42c 100644 (file)
@@ -242,6 +242,7 @@ static void bdi_sync_writeback(struct backing_dev_info *bdi,
 /**
  * bdi_start_writeback - start writeback
  * @bdi: the backing device to write from
+ * @sb: write inodes from this super_block
  * @nr_pages: the number of pages to write
  *
  * Description:
@@ -614,7 +615,6 @@ static void writeback_inodes_wb(struct bdi_writeback *wb,
                                struct writeback_control *wbc)
 {
        struct super_block *sb = wbc->sb, *pin_sb = NULL;
-       const int is_blkdev_sb = sb_is_blkdev_sb(sb);
        const unsigned long start = jiffies;    /* livelock avoidance */
 
        spin_lock(&inode_lock);
@@ -635,36 +635,11 @@ static void writeback_inodes_wb(struct bdi_writeback *wb,
                        continue;
                }
 
-               if (!bdi_cap_writeback_dirty(wb->bdi)) {
-                       redirty_tail(inode);
-                       if (is_blkdev_sb) {
-                               /*
-                                * Dirty memory-backed blockdev: the ramdisk
-                                * driver does this.  Skip just this inode
-                                */
-                               continue;
-                       }
-                       /*
-                        * Dirty memory-backed inode against a filesystem other
-                        * than the kernel-internal bdev filesystem.  Skip the
-                        * entire superblock.
-                        */
-                       break;
-               }
-
                if (inode->i_state & (I_NEW | I_WILL_FREE)) {
                        requeue_io(inode);
                        continue;
                }
 
-               if (wbc->nonblocking && bdi_write_congested(wb->bdi)) {
-                       wbc->encountered_congestion = 1;
-                       if (!is_blkdev_sb)
-                               break;          /* Skip a congested fs */
-                       requeue_io(inode);
-                       continue;               /* Skip a congested blockdev */
-               }
-
                /*
                 * Was this inode dirtied after sync_sb_inodes was called?
                 * This keeps sync from extra jobs and livelock.
@@ -756,6 +731,7 @@ static long wb_writeback(struct bdi_writeback *wb,
                .sync_mode              = args->sync_mode,
                .older_than_this        = NULL,
                .for_kupdate            = args->for_kupdate,
+               .for_background         = args->for_background,
                .range_cyclic           = args->range_cyclic,
        };
        unsigned long oldest_jif;
@@ -787,7 +763,6 @@ static long wb_writeback(struct bdi_writeback *wb,
                        break;
 
                wbc.more_io = 0;
-               wbc.encountered_congestion = 0;
                wbc.nr_to_write = MAX_WRITEBACK_PAGES;
                wbc.pages_skipped = 0;
                writeback_inodes_wb(wb, &wbc);
@@ -1213,6 +1188,23 @@ void writeback_inodes_sb(struct super_block *sb)
 EXPORT_SYMBOL(writeback_inodes_sb);
 
 /**
+ * writeback_inodes_sb_if_idle -       start writeback if none underway
+ * @sb: the superblock
+ *
+ * Invoke writeback_inodes_sb if no writeback is currently underway.
+ * Returns 1 if writeback was started, 0 if not.
+ */
+int writeback_inodes_sb_if_idle(struct super_block *sb)
+{
+       if (!writeback_in_progress(sb->s_bdi)) {
+               writeback_inodes_sb(sb);
+               return 1;
+       } else
+               return 0;
+}
+EXPORT_SYMBOL(writeback_inodes_sb_if_idle);
+
+/**
  * sync_inodes_sb      -       sync sb inode pages
  * @sb: the superblock
  *
@@ -1280,57 +1272,3 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc)
        return ret;
 }
 EXPORT_SYMBOL(sync_inode);
-
-/**
- * generic_osync_inode - flush all dirty data for a given inode to disk
- * @inode: inode to write
- * @mapping: the address_space that should be flushed
- * @what:  what to write and wait upon
- *
- * This can be called by file_write functions for files which have the
- * O_SYNC flag set, to flush dirty writes to disk.
- *
- * @what is a bitmask, specifying which part of the inode's data should be
- * written and waited upon.
- *
- *    OSYNC_DATA:     i_mapping's dirty data
- *    OSYNC_METADATA: the buffers at i_mapping->private_list
- *    OSYNC_INODE:    the inode itself
- */
-
-int generic_osync_inode(struct inode *inode, struct address_space *mapping, int what)
-{
-       int err = 0;
-       int need_write_inode_now = 0;
-       int err2;
-
-       if (what & OSYNC_DATA)
-               err = filemap_fdatawrite(mapping);
-       if (what & (OSYNC_METADATA|OSYNC_DATA)) {
-               err2 = sync_mapping_buffers(mapping);
-               if (!err)
-                       err = err2;
-       }
-       if (what & OSYNC_DATA) {
-               err2 = filemap_fdatawait(mapping);
-               if (!err)
-                       err = err2;
-       }
-
-       spin_lock(&inode_lock);
-       if ((inode->i_state & I_DIRTY) &&
-           ((what & OSYNC_INODE) || (inode->i_state & I_DIRTY_DATASYNC)))
-               need_write_inode_now = 1;
-       spin_unlock(&inode_lock);
-
-       if (need_write_inode_now) {
-               err2 = write_inode_now(inode, 1);
-               if (!err)
-                       err = err2;
-       }
-       else
-               inode_sync_wait(inode);
-
-       return err;
-}
-EXPORT_SYMBOL_GPL(generic_osync_inode);