Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Apr 2011 14:35:17 +0000 (07:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Apr 2011 14:35:17 +0000 (07:35 -0700)
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
  quota: Don't write quota info in dquot_commit()
  ext3: Fix writepage credits computation for ordered mode

1  2 
fs/ext3/inode.c
fs/quota/dquot.c

diff --combined fs/ext3/inode.c
@@@ -1894,6 -1894,7 +1894,6 @@@ static const struct address_space_opera
        .readpage               = ext3_readpage,
        .readpages              = ext3_readpages,
        .writepage              = ext3_ordered_writepage,
 -      .sync_page              = block_sync_page,
        .write_begin            = ext3_write_begin,
        .write_end              = ext3_ordered_write_end,
        .bmap                   = ext3_bmap,
@@@ -1909,6 -1910,7 +1909,6 @@@ static const struct address_space_opera
        .readpage               = ext3_readpage,
        .readpages              = ext3_readpages,
        .writepage              = ext3_writeback_writepage,
 -      .sync_page              = block_sync_page,
        .write_begin            = ext3_write_begin,
        .write_end              = ext3_writeback_write_end,
        .bmap                   = ext3_bmap,
@@@ -1924,6 -1926,7 +1924,6 @@@ static const struct address_space_opera
        .readpage               = ext3_readpage,
        .readpages              = ext3_readpages,
        .writepage              = ext3_journalled_writepage,
 -      .sync_page              = block_sync_page,
        .write_begin            = ext3_write_begin,
        .write_end              = ext3_journalled_write_end,
        .set_page_dirty         = ext3_journalled_set_page_dirty,
@@@ -2055,7 -2058,7 +2055,7 @@@ static inline int all_zeroes(__le32 *p
   *
   *    When we do truncate() we may have to clean the ends of several
   *    indirect blocks but leave the blocks themselves alive. Block is
 - *    partially truncated if some data below the new i_size is refered
 + *    partially truncated if some data below the new i_size is referred
   *    from it (and it is on the path to the first completely truncated
   *    data block, indeed).  We have to free the top of that path along
   *    with everything to the right of the path. Since no allocation
@@@ -2184,7 -2187,7 +2184,7 @@@ static void ext3_clear_blocks(handle_t 
   * @first:    array of block numbers
   * @last:     points immediately past the end of array
   *
 - * We are freeing all blocks refered from that array (numbers are stored as
 + * We are freeing all blocks referred from that array (numbers are stored as
   * little-endian 32-bit) and updating @inode->i_blocks appropriately.
   *
   * We accumulate contiguous runs of blocks to free.  Conveniently, if these
@@@ -2272,7 -2275,7 +2272,7 @@@ static void ext3_free_data(handle_t *ha
   *    @last:  pointer immediately past the end of array
   *    @depth: depth of the branches to free
   *
 - *    We are freeing all blocks refered from these branches (numbers are
 + *    We are freeing all blocks referred from these branches (numbers are
   *    stored as little-endian 32-bit) and updating @inode->i_blocks
   *    appropriately.
   */
@@@ -3291,7 -3294,7 +3291,7 @@@ static int ext3_writepage_trans_blocks(
        if (ext3_should_journal_data(inode))
                ret = 3 * (bpp + indirects) + 2;
        else
-               ret = 2 * (bpp + indirects) + 2;
+               ret = 2 * (bpp + indirects) + indirects + 2;
  
  #ifdef CONFIG_QUOTA
        /* We know that structure was already allocated during dquot_initialize so
diff --combined fs/quota/dquot.c
@@@ -76,7 -76,7 +76,7 @@@
  #include <linux/buffer_head.h>
  #include <linux/capability.h>
  #include <linux/quotaops.h>
 -#include <linux/writeback.h> /* for inode_lock, oddly enough.. */
 +#include "../internal.h" /* ugh */
  
  #include <asm/uaccess.h>
  
@@@ -442,7 -442,7 +442,7 @@@ EXPORT_SYMBOL(dquot_acquire)
   */
  int dquot_commit(struct dquot *dquot)
  {
-       int ret = 0, ret2 = 0;
+       int ret = 0;
        struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
  
        mutex_lock(&dqopt->dqio_mutex);
        spin_unlock(&dq_list_lock);
        /* Inactive dquot can be only if there was error during read/init
         * => we have better not writing it */
-       if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
+       if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
                ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot);
-               if (info_dirty(&dqopt->info[dquot->dq_type])) {
-                       ret2 = dqopt->ops[dquot->dq_type]->write_file_info(
-                                               dquot->dq_sb, dquot->dq_type);
-               }
-               if (ret >= 0)
-                       ret = ret2;
-       }
+       else
+               ret = -EIO;
  out_sem:
        mutex_unlock(&dqopt->dqio_mutex);
        return ret;
@@@ -900,38 -895,33 +895,38 @@@ static void add_dquot_ref(struct super_
        int reserved = 0;
  #endif
  
 -      spin_lock(&inode_lock);
 +      spin_lock(&inode_sb_list_lock);
        list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
 -              if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW))
 +              spin_lock(&inode->i_lock);
 +              if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) ||
 +                  !atomic_read(&inode->i_writecount) ||
 +                  !dqinit_needed(inode, type)) {
 +                      spin_unlock(&inode->i_lock);
                        continue;
 +              }
  #ifdef CONFIG_QUOTA_DEBUG
                if (unlikely(inode_get_rsv_space(inode) > 0))
                        reserved = 1;
  #endif
 -              if (!atomic_read(&inode->i_writecount))
 -                      continue;
 -              if (!dqinit_needed(inode, type))
 -                      continue;
 -
                __iget(inode);
 -              spin_unlock(&inode_lock);
 +              spin_unlock(&inode->i_lock);
 +              spin_unlock(&inode_sb_list_lock);
  
                iput(old_inode);
                __dquot_initialize(inode, type);
 -              /* We hold a reference to 'inode' so it couldn't have been
 -               * removed from s_inodes list while we dropped the inode_lock.
 -               * We cannot iput the inode now as we can be holding the last
 -               * reference and we cannot iput it under inode_lock. So we
 -               * keep the reference and iput it later. */
 +
 +              /*
 +               * We hold a reference to 'inode' so it couldn't have been
 +               * removed from s_inodes list while we dropped the
 +               * inode_sb_list_lock We cannot iput the inode now as we can be
 +               * holding the last reference and we cannot iput it under
 +               * inode_sb_list_lock. So we keep the reference and iput it
 +               * later.
 +               */
                old_inode = inode;
 -              spin_lock(&inode_lock);
 +              spin_lock(&inode_sb_list_lock);
        }
 -      spin_unlock(&inode_lock);
 +      spin_unlock(&inode_sb_list_lock);
        iput(old_inode);
  
  #ifdef CONFIG_QUOTA_DEBUG
@@@ -956,7 -946,7 +951,7 @@@ static inline int dqput_blocks(struct d
  
  /*
   * Remove references to dquots from inode and add dquot to list for freeing
 - * if we have the last referece to dquot
 + * if we have the last reference to dquot
   * We can't race with anybody because we hold dqptr_sem for writing...
   */
  static int remove_inode_dquot_ref(struct inode *inode, int type,
@@@ -1012,7 -1002,7 +1007,7 @@@ static void remove_dquot_ref(struct sup
        struct inode *inode;
        int reserved = 0;
  
 -      spin_lock(&inode_lock);
 +      spin_lock(&inode_sb_list_lock);
        list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
                /*
                 *  We have to scan also I_NEW inodes because they can already
                        remove_inode_dquot_ref(inode, type, tofree_head);
                }
        }
 -      spin_unlock(&inode_lock);
 +      spin_unlock(&inode_sb_list_lock);
  #ifdef CONFIG_QUOTA_DEBUG
        if (reserved) {
                printk(KERN_WARNING "VFS (%s): Writes happened after quota"