Whamcloud - gitweb
__find_get_block_slow-scale.patch: attempt to reduce contention on bd_mapping->privat...
authornikita <nikita>
Mon, 20 Nov 2006 23:17:56 +0000 (23:17 +0000)
committernikita <nikita>
Mon, 20 Nov 2006 23:17:56 +0000 (23:17 +0000)
lustre/kernel_patches/patches/__find_get_block_slow-scale.patch [new file with mode: 0644]
lustre/kernel_patches/series/2.6-rhel4.series

diff --git a/lustre/kernel_patches/patches/__find_get_block_slow-scale.patch b/lustre/kernel_patches/patches/__find_get_block_slow-scale.patch
new file mode 100644 (file)
index 0000000..1da92d4
--- /dev/null
@@ -0,0 +1,43 @@
+Index: linux/fs/buffer.c
+===================================================================
+--- linux.orig/fs/buffer.c
++++ linux/fs/buffer.c
+@@ -509,13 +509,18 @@ __find_get_block_slow(struct block_devic
+       struct buffer_head *head;
+       struct page *page;
+       int all_mapped = 1;
++      int spinlock = 0;
+       index = block >> (PAGE_CACHE_SHIFT - bd_inode->i_blkbits);
+       page = find_get_page(bd_mapping, index);
+       if (!page)
+               goto out;
++      if (unlikely(TestSetPageLocked(page))) {
+       spin_lock(&bd_mapping->private_lock);
++              spinlock = 1;
++      }
++
+       if (!page_has_buffers(page))
+               goto out_unlock;
+       head = page_buffers(page);
+@@ -536,7 +541,7 @@ __find_get_block_slow(struct block_devic
+        * file io on the block device and getblk.  It gets dealt with
+        * elsewhere, don't buffer_error if we had some unmapped buffers
+        */
+-      if (all_mapped) {
++      if (unlikely(all_mapped)) {
+               printk("__find_get_block_slow() failed. "
+                       "block=%llu, b_blocknr=%llu\n",
+                       (unsigned long long)block, (unsigned long long)bh->b_blocknr);
+@@ -544,7 +549,10 @@ __find_get_block_slow(struct block_devic
+               printk("device blocksize: %d\n", 1 << bd_inode->i_blkbits);
+       }
+ out_unlock:
++      if (unlikely(spinlock))
+       spin_unlock(&bd_mapping->private_lock);
++      else
++              unlock_page(page);
+       page_cache_release(page);
+ out:
+       return ret;
index 2e2736e..cdd7279 100644 (file)
@@ -35,3 +35,4 @@ dynamic-locks-2.6.9.patch
 jbd-copy-out-everything.patch 
 jbd-checkpoint-on-commit.patch 
 export-nr_free_buffer_pages.patch 
+__find_get_block_slow-scale.patch