The patch below is just cleanup.

1) page_offset as calculated in __get_metapage is always 0.
   Please go through the variable substitution/calculation
   to verify.

2) mp = NULL isn't necessary because that statement is surrounded
   by "if (!mp) {".

3) if statement re-ordered so else path is usually not taken.

Tested successfully with dbench/tiobench/bonnie++ on 2.5.75 uniprocessor x86.  



--- jfs_metapage.c.orig 2003-02-26 21:46:13.000000000 -0500
+++ jfs_metapage.c      2003-07-14 20:54:15.000000000 -0400
@@ -213,12 +213,8 @@
                                unsigned long new)
 {
        struct metapage **hash_ptr;
-       int l2BlocksPerPage;
-       int l2bsize;
        struct address_space *mapping;
        struct metapage *mp;
-       unsigned long page_index;
-       unsigned long page_offset;
 
        jfs_info("__get_metapage: inode = 0x%p, lblock = 0x%lx", inode, lblock);
 
@@ -244,12 +240,7 @@
                lock_metapage(mp);
                spin_unlock(&meta_lock);
        } else {
-               l2bsize = inode->i_blkbits;
-               l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
-               page_index = lblock >> l2BlocksPerPage;
-               page_offset = (lblock - (page_index << l2BlocksPerPage)) <<
-                   l2bsize;
-               if ((page_offset + size) > PAGE_CACHE_SIZE) {
+               if (size > PAGE_CACHE_SIZE) {
                        spin_unlock(&meta_lock);
                        jfs_err("MetaData crosses page boundary!!");
                        return NULL;
@@ -263,7 +254,6 @@
                 * Attempt to get metapage without blocking, tapping into
                 * reserves if necessary.
                 */
-               mp = NULL;
                if (JFS_IP(inode)->fileset == AGGREGATE_I) {
                        mp =  mempool_alloc(metapage_mempool, GFP_ATOMIC);
                        if (!mp) {
@@ -311,13 +301,13 @@
 
                if (new) {
                        jfs_info("__get_metapage: Calling grab_cache_page");
-                       mp->page = grab_cache_page(mapping, page_index);
-                       if (!mp->page) {
-                               jfs_err("grab_cache_page failed!");
-                               goto freeit;
-                       } else {
+                       mp->page = grab_cache_page(mapping, lblock >> 
(PAGE_CACHE_SHIFT - (inode->i_blkbits)));
+                       if (mp->page) {
                                INCREMENT(mpStat.pagealloc);
                                unlock_page(mp->page);
+                       } else {
+                               jfs_err("grab_cache_page failed!");
+                               goto freeit;
                        }
                } else {
                        jfs_info("__get_metapage: Calling read_cache_page");
@@ -329,7 +319,7 @@
                        } else
                                INCREMENT(mpStat.pagealloc);
                }
-               mp->data = kmap(mp->page) + page_offset;
+               mp->data = kmap(mp->page);
        }
        jfs_info("__get_metapage: returning = 0x%p", mp);
        return mp;


-- 
Randy Hron
http://home.earthlink.net/~rwhron/kernel/bigbox.html

_______________________________________________
Jfs-discussion mailing list
[EMAIL PROTECTED]
http://www-124.ibm.com/developerworks/oss/mailman/listinfo/jfs-discussion

Reply via email to