Hi

I have noticed that in ext2 (I haven't read the other FS code) call
mark_buffer_dirty() with spin_locks held.  I think that it is better
to use the construction:

     __mark_buffer_dirty()
     <...>
     spinlock_unlock();
     balance_dirty();

I attached the patch for ext2 against test8-pre6.  Stephen or Tytso,
do you mean to comment on that??
I did the patch because I found lock contention in the superblock lock
when running dbench 48.

Later, Juan.

PD. If you think that the approach is right I can't audit the rest of
    the filesystems searching for that problem.

diff -urN --exclude-from=/home/lfcia/quintela/work/kernel/exclude 
base/fs/ext2/ialloc.c working/fs/ext2/ialloc.c
--- base/fs/ext2/ialloc.c       Wed Sep  6 00:37:31 2000
+++ working/fs/ext2/ialloc.c    Fri Sep  8 01:54:42 2000
@@ -230,12 +230,12 @@
                                gdp->bg_used_dirs_count =
                                        
cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) - 1);
                }
-               mark_buffer_dirty(bh2);
+               __mark_buffer_dirty(bh2);
                es->s_free_inodes_count =
                        cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) + 1);
-               mark_buffer_dirty(sb->u.ext2_sb.s_sbh);
+               __mark_buffer_dirty(sb->u.ext2_sb.s_sbh);
        }
-       mark_buffer_dirty(bh);
+       __mark_buffer_dirty(bh);
        if (sb->s_flags & MS_SYNCHRONOUS) {
                ll_rw_block (WRITE, 1, &bh);
                wait_on_buffer (bh);
@@ -243,6 +243,7 @@
        sb->s_dirt = 1;
 error_return:
        unlock_super (sb);
+       balance_dirty(bh->b_dev);
 }
 
 /*
@@ -388,7 +389,7 @@
                                      "bit already set for inode %d", j);
                        goto repeat;
                }
-               mark_buffer_dirty(bh);
+               __mark_buffer_dirty(bh);
                if (sb->s_flags & MS_SYNCHRONOUS) {
                        ll_rw_block (WRITE, 1, &bh);
                        wait_on_buffer (bh);
@@ -404,7 +405,7 @@
                                return NULL;
                        }
                        gdp->bg_free_inodes_count = 0;
-                       mark_buffer_dirty(bh2);
+                       __mark_buffer_dirty(bh2);
                }
                goto repeat;
        }
@@ -423,10 +424,10 @@
        if (S_ISDIR(mode))
                gdp->bg_used_dirs_count =
                        cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) + 1);
-       mark_buffer_dirty(bh2);
+       __mark_buffer_dirty(bh2);
        es->s_free_inodes_count =
                cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) - 1);
-       mark_buffer_dirty(sb->u.ext2_sb.s_sbh);
+       __mark_buffer_dirty(sb->u.ext2_sb.s_sbh);
        sb->s_dirt = 1;
        inode->i_mode = mode;
        inode->i_sb = sb;
@@ -464,6 +465,7 @@
        mark_inode_dirty(inode);
 
        unlock_super (sb);
+       balance_dirty(bh->b_dev);
        if(DQUOT_ALLOC_INODE(sb, inode)) {
                sb->dq_op->drop(inode);
                inode->i_nlink = 0;



-- 
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]

Reply via email to