jfs: Use lowercase names of quota functions
[linux-block.git] / fs / jfs / inode.c
index 4672013802e126a9f0d0da9f14947ebfa6830cb9..b2ae190a77ba240b04f8175d7b2e2c65aaa20b3d 100644 (file)
 #include "jfs_debug.h"
 
 
-void jfs_read_inode(struct inode *inode)
+struct inode *jfs_iget(struct super_block *sb, unsigned long ino)
 {
-       if (diRead(inode)) {
-               make_bad_inode(inode);
-               return;
+       struct inode *inode;
+       int ret;
+
+       inode = iget_locked(sb, ino);
+       if (!inode)
+               return ERR_PTR(-ENOMEM);
+       if (!(inode->i_state & I_NEW))
+               return inode;
+
+       ret = diRead(inode);
+       if (ret < 0) {
+               iget_failed(inode);
+               return ERR_PTR(ret);
        }
 
        if (S_ISREG(inode->i_mode)) {
@@ -49,12 +59,20 @@ void jfs_read_inode(struct inode *inode)
                if (inode->i_size >= IDATASIZE) {
                        inode->i_op = &page_symlink_inode_operations;
                        inode->i_mapping->a_ops = &jfs_aops;
-               } else
+               } else {
                        inode->i_op = &jfs_symlink_inode_operations;
+                       /*
+                        * The inline data should be null-terminated, but
+                        * don't let on-disk corruption crash the kernel
+                        */
+                       JFS_IP(inode)->i_inline[inode->i_size] = '\0';
+               }
        } else {
                inode->i_op = &jfs_file_inode_operations;
                init_special_inode(inode, inode->i_mode, inode->i_rdev);
        }
+       unlock_new_inode(inode);
+       return inode;
 }
 
 /*
@@ -140,9 +158,9 @@ void jfs_delete_inode(struct inode *inode)
                /*
                 * Free the inode from the quota allocation.
                 */
-               DQUOT_INIT(inode);
-               DQUOT_FREE_INODE(inode);
-               DQUOT_DROP(inode);
+               vfs_dq_init(inode);
+               vfs_dq_free_inode(inode);
+               vfs_dq_drop(inode);
        }
 
        clear_inode(inode);