]> err.no Git - linux-2.6/blobdiff - fs/jfs/inode.c
[PATCH] pipe: remove redundant fifo_poll abstraction
[linux-2.6] / fs / jfs / inode.c
index 7bc906677b0d5e2addc76b84789b74ff48afc3b3..767c7ecb429ed6f044e1954873c73c1d719eaab8 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/pagemap.h>
 #include <linux/quotaops.h>
 #include "jfs_incore.h"
+#include "jfs_inode.h"
 #include "jfs_filsys.h"
 #include "jfs_imap.h"
 #include "jfs_extent.h"
 #include "jfs_debug.h"
 
 
-extern struct inode_operations jfs_dir_inode_operations;
-extern struct inode_operations jfs_file_inode_operations;
-extern struct inode_operations jfs_symlink_inode_operations;
-extern struct file_operations jfs_dir_operations;
-extern struct file_operations jfs_file_operations;
-struct address_space_operations jfs_aops;
-extern int freeZeroLink(struct inode *);
-
 void jfs_read_inode(struct inode *inode)
 {
        if (diRead(inode)) { 
@@ -135,8 +128,12 @@ void jfs_delete_inode(struct inode *inode)
 {
        jfs_info("In jfs_delete_inode, inode = 0x%p", inode);
 
+       if (is_bad_inode(inode) ||
+           (JFS_IP(inode)->fileset != cpu_to_le32(FILESYSTEM_I)))
+                       return;
+
        if (test_cflag(COMMIT_Freewmap, inode))
-               freeZeroLink(inode);
+               jfs_free_zero_link(inode);
 
        diFree(inode);
 
@@ -175,31 +172,22 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
 {
        s64 lblock64 = lblock;
        int rc = 0;
-       int take_locks;
        xad_t xad;
        s64 xaddr;
        int xflag;
-       s32 xlen;
-
-       /*
-        * If this is a special inode (imap, dmap)
-        * the lock should already be taken
-        */
-       take_locks = (JFS_IP(ip)->fileset != AGGREGATE_I);
+       s32 xlen = max_blocks;
 
        /*
         * Take appropriate lock on inode
         */
-       if (take_locks) {
-               if (create)
-                       IWRITE_LOCK(ip);
-               else
-                       IREAD_LOCK(ip);
-       }
+       if (create)
+               IWRITE_LOCK(ip);
+       else
+               IREAD_LOCK(ip);
 
        if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
-           (xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0)
-            == 0) && xlen) {
+           (!xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0)) &&
+           xaddr) {
                if (xflag & XAD_NOTRECORDED) {
                        if (!create)
                                /*
@@ -238,7 +226,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
 #ifdef _JFS_4K
        if ((rc = extHint(ip, lblock64 << ip->i_sb->s_blocksize_bits, &xad)))
                goto unlock;
-       rc = extAlloc(ip, max_blocks, lblock64, &xad, FALSE);
+       rc = extAlloc(ip, xlen, lblock64, &xad, FALSE);
        if (rc)
                goto unlock;
 
@@ -258,12 +246,10 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
        /*
         * Release lock on inode
         */
-       if (take_locks) {
-               if (create)
-                       IWRITE_UNLOCK(ip);
-               else
-                       IREAD_UNLOCK(ip);
-       }
+       if (create)
+               IWRITE_UNLOCK(ip);
+       else
+               IREAD_UNLOCK(ip);
        return rc;
 }