Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux...
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 21 Sep 2009 09:09:22 +0000 (12:09 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 21 Sep 2009 09:09:22 +0000 (12:09 +0300)
Conflicts:
fs/ubifs/super.c

Merge the upstream tree in order to resolve a conflict with the
per-bdi writeback changes from the linux-2.6-block tree.

1  2 
fs/ubifs/budget.c
fs/ubifs/super.c

diff --combined fs/ubifs/budget.c
index c1f3f99b2939772071a210a13f65b8bae335631d,ee1ce68fd98b74bb5e46fd6eb589a68d7e8e7054..076ca50e99336fad10e256ddc3d103ae93fd527a
   * @nr_to_write: how many dirty pages to write-back
   *
   * This function shrinks UBIFS liability by means of writing back some amount
-  * of dirty inodes and their pages. Returns the amount of pages which were
-  * written back. The returned value does not include dirty inodes which were
-  * synchronized.
+  * of dirty inodes and their pages.
   *
   * Note, this function synchronizes even VFS inodes which are locked
   * (@i_mutex) by the caller of the budgeting function, because write-back does
   * not touch @i_mutex.
   */
- static int shrink_liability(struct ubifs_info *c, int nr_to_write)
+ static void shrink_liability(struct ubifs_info *c, int nr_to_write)
  {
-       int nr_written;
-       struct writeback_control wbc = {
-               .sync_mode   = WB_SYNC_NONE,
-               .range_end   = LLONG_MAX,
-               .nr_to_write = nr_to_write,
-       };
-       generic_sync_sb_inodes(c->vfs_sb, &wbc);
-       nr_written = nr_to_write - wbc.nr_to_write;
-       if (!nr_written) {
-               /*
-                * Re-try again but wait on pages/inodes which are being
-                * written-back concurrently (e.g., by pdflush).
-                */
-               memset(&wbc, 0, sizeof(struct writeback_control));
-               wbc.sync_mode   = WB_SYNC_ALL;
-               wbc.range_end   = LLONG_MAX;
-               wbc.nr_to_write = nr_to_write;
-               generic_sync_sb_inodes(c->vfs_sb, &wbc);
-               nr_written = nr_to_write - wbc.nr_to_write;
-       }
-       dbg_budg("%d pages were written back", nr_written);
-       return nr_written;
+       writeback_inodes_sb(c->vfs_sb);
  }
  
  /**
@@@ -741,7 -715,7 +715,7 @@@ long long ubifs_get_free_space_nolock(s
   * ubifs_get_free_space - return amount of free space.
   * @c: UBIFS file-system description object
   *
 - * This function calculates and retuns amount of free space to report to
 + * This function calculates and returns amount of free space to report to
   * user-space.
   */
  long long ubifs_get_free_space(struct ubifs_info *c)
diff --combined fs/ubifs/super.c
index 7e2b3d4d487ad154900dbc8ad94f72ed54283e18,c4af069df1adbc30e05798815ddfdc5a2395a92c..333e181ee9877ed4b992967b268ea193cf9ee894
@@@ -36,6 -36,7 +36,6 @@@
  #include <linux/mount.h>
  #include <linux/math64.h>
  #include <linux/writeback.h>
 -#include <linux/smp_lock.h>
  #include "ubifs.h"
  
  /*
@@@ -317,8 -318,6 +317,8 @@@ static int ubifs_write_inode(struct ino
                if (err)
                        ubifs_err("can't write inode %lu, error %d",
                                  inode->i_ino, err);
 +              else
 +                      err = dbg_check_inode_size(c, inode, ui->ui_size);
        }
  
        ui->dirty = 0;
@@@ -448,6 -447,17 +448,6 @@@ static int ubifs_sync_fs(struct super_b
        if (!wait)
                return 0;
  
 -      /*
 -       * VFS calls '->sync_fs()' before synchronizing all dirty inodes and
 -       * pages, so synchronize them first, then commit the journal. Strictly
 -       * speaking, it is not necessary to commit the journal here,
 -       * synchronizing write-buffers would be enough. But committing makes
 -       * UBIFS free space predictions much more accurate, so we want to let
 -       * the user be able to get more accurate results of 'statfs()' after
 -       * they synchronize the file system.
 -       */
 -      sync_inodes_sb(sb);
 -
        /*
         * Synchronize write buffers, because 'ubifs_run_commit()' does not
         * do this if it waits for an already running commit.
                        return err;
        }
  
 +      /*
 +       * Strictly speaking, it is not necessary to commit the journal here,
 +       * synchronizing write-buffers would be enough. But committing makes
 +       * UBIFS free space predictions much more accurate, so we want to let
 +       * the user be able to get more accurate results of 'statfs()' after
 +       * they synchronize the file system.
 +       */
        err = ubifs_run_commit(c);
        if (err)
                return err;
@@@ -1717,6 -1720,8 +1717,6 @@@ static void ubifs_put_super(struct supe
        ubifs_msg("un-mount UBI device %d, volume %d", c->vi.ubi_num,
                  c->vi.vol_id);
  
 -      lock_kernel();
 -
        /*
         * The following asserts are only valid if there has not been a failure
         * of the media. For example, there will be dirty inodes if we failed
        ubi_close_volume(c->ubi);
        mutex_unlock(&c->umount_mutex);
        kfree(c);
 -
 -      unlock_kernel();
  }
  
  static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
                return err;
        }
  
 -      lock_kernel();
        if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
                if (c->ro_media) {
                        ubifs_msg("cannot re-mount due to prior errors");
 -                      unlock_kernel();
                        return -EROFS;
                }
                err = ubifs_remount_rw(c);
 -              if (err) {
 -                      unlock_kernel();
 +              if (err)
                        return err;
 -              }
        } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
                if (c->ro_media) {
                        ubifs_msg("cannot re-mount due to prior errors");
 -                      unlock_kernel();
                        return -EROFS;
                }
                ubifs_remount_ro(c);
        }
  
        ubifs_assert(c->lst.taken_empty_lebs > 0);
 -      unlock_kernel();
        return 0;
  }
  
@@@ -1952,6 -1965,7 +1952,7 @@@ static int ubifs_fill_super(struct supe
         *
         * Read-ahead will be disabled because @c->bdi.ra_pages is 0.
         */
+       c->bdi.name = "ubifs",
        c->bdi.capabilities = BDI_CAP_MAP_COPY;
        c->bdi.unplug_io_fn = default_unplug_io_fn;
        err  = bdi_init(&c->bdi);
        if (err)
                goto out_bdi;
  
+       sb->s_bdi = &c->bdi;
        sb->s_fs_info = c;
        sb->s_magic = UBIFS_SUPER_MAGIC;
        sb->s_blocksize = UBIFS_BLOCK_SIZE;