Merge branch 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
[pandora-kernel.git] / fs / fs-writeback.c
index efcedb6..caf0491 100644 (file)
@@ -64,6 +64,28 @@ static void writeback_release(struct backing_dev_info *bdi)
        clear_bit(BDI_pdflush, &bdi->state);
 }
 
+static noinline void block_dump___mark_inode_dirty(struct inode *inode)
+{
+       if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) {
+               struct dentry *dentry;
+               const char *name = "?";
+
+               dentry = d_find_alias(inode);
+               if (dentry) {
+                       spin_lock(&dentry->d_lock);
+                       name = (const char *) dentry->d_name.name;
+               }
+               printk(KERN_DEBUG
+                      "%s(%d): dirtied inode %lu (%s) on %s\n",
+                      current->comm, task_pid_nr(current), inode->i_ino,
+                      name, inode->i_sb->s_id);
+               if (dentry) {
+                       spin_unlock(&dentry->d_lock);
+                       dput(dentry);
+               }
+       }
+}
+
 /**
  *     __mark_inode_dirty -    internal function
  *     @inode: inode to mark
@@ -114,23 +136,8 @@ void __mark_inode_dirty(struct inode *inode, int flags)
        if ((inode->i_state & flags) == flags)
                return;
 
-       if (unlikely(block_dump)) {
-               struct dentry *dentry = NULL;
-               const char *name = "?";
-
-               if (!list_empty(&inode->i_dentry)) {
-                       dentry = list_entry(inode->i_dentry.next,
-                                           struct dentry, d_alias);
-                       if (dentry && dentry->d_name.name)
-                               name = (const char *) dentry->d_name.name;
-               }
-
-               if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev"))
-                       printk(KERN_DEBUG
-                              "%s(%d): dirtied inode %lu (%s) on %s\n",
-                              current->comm, task_pid_nr(current), inode->i_ino,
-                              name, inode->i_sb->s_id);
-       }
+       if (unlikely(block_dump))
+               block_dump___mark_inode_dirty(inode);
 
        spin_lock(&inode_lock);
        if ((inode->i_state & flags) != flags) {
@@ -314,7 +321,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
 
        spin_lock(&inode_lock);
        inode->i_state &= ~I_SYNC;
-       if (!(inode->i_state & I_FREEING)) {
+       if (!(inode->i_state & (I_FREEING | I_CLEAR))) {
                if (!(inode->i_state & I_DIRTY) &&
                    mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
                        /*
@@ -485,7 +492,7 @@ void generic_sync_sb_inodes(struct super_block *sb,
                        break;
                }
 
-               if (inode->i_state & I_NEW) {
+               if (inode->i_state & (I_NEW | I_WILL_FREE)) {
                        requeue_io(inode);
                        continue;
                }
@@ -516,7 +523,7 @@ void generic_sync_sb_inodes(struct super_block *sb,
                if (current_is_pdflush() && !writeback_acquire(bdi))
                        break;
 
-               BUG_ON(inode->i_state & I_FREEING);
+               BUG_ON(inode->i_state & (I_FREEING | I_CLEAR));
                __iget(inode);
                pages_skipped = wbc->pages_skipped;
                __writeback_single_inode(inode, wbc);