nfsd: make V4ROOT exports read-only
[safe/jmp/linux-2.6] / fs / ocfs2 / inode.c
index 36bb588..0297fb8 100644 (file)
@@ -53,6 +53,7 @@
 #include "sysfile.h"
 #include "uptodate.h"
 #include "xattr.h"
+#include "refcounttree.h"
 
 #include "buffer_head_io.h"
 
@@ -562,7 +563,8 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
                        goto out;
                }
 
-               status = ocfs2_journal_access_di(handle, inode, fe_bh,
+               status = ocfs2_journal_access_di(handle, INODE_CACHE(inode),
+                                                fe_bh,
                                                 OCFS2_JOURNAL_ACCESS_WRITE);
                if (status < 0) {
                        mlog_errno(status);
@@ -646,7 +648,7 @@ static int ocfs2_remove_inode(struct inode *inode,
        }
 
        /* set the inodes dtime */
-       status = ocfs2_journal_access_di(handle, inode, di_bh,
+       status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
                                         OCFS2_JOURNAL_ACCESS_WRITE);
        if (status < 0) {
                mlog_errno(status);
@@ -662,7 +664,7 @@ static int ocfs2_remove_inode(struct inode *inode,
                goto bail_commit;
        }
 
-       ocfs2_remove_from_cache(inode, di_bh);
+       ocfs2_remove_from_cache(INODE_CACHE(inode), di_bh);
        vfs_dq_free_inode(inode);
 
        status = ocfs2_free_dinode(handle, inode_alloc_inode,
@@ -781,6 +783,12 @@ static int ocfs2_wipe_inode(struct inode *inode,
                goto bail_unlock_dir;
        }
 
+       status = ocfs2_remove_refcount_tree(inode, di_bh);
+       if (status < 0) {
+               mlog_errno(status);
+               goto bail_unlock_dir;
+       }
+
        status = ocfs2_remove_inode(inode, di_bh, orphan_dir_inode,
                                    orphan_dir_bh);
        if (status < 0)
@@ -1112,14 +1120,14 @@ void ocfs2_clear_inode(struct inode *inode)
        ocfs2_lock_res_free(&oi->ip_inode_lockres);
        ocfs2_lock_res_free(&oi->ip_open_lockres);
 
-       ocfs2_metadata_cache_purge(inode);
+       ocfs2_metadata_cache_exit(INODE_CACHE(inode));
 
-       mlog_bug_on_msg(oi->ip_metadata_cache.ci_num_cached,
+       mlog_bug_on_msg(INODE_CACHE(inode)->ci_num_cached,
                        "Clear inode of %llu, inode has %u cache items\n",
-                       (unsigned long long)oi->ip_blkno, oi->ip_metadata_cache.ci_num_cached);
+                       (unsigned long long)oi->ip_blkno,
+                       INODE_CACHE(inode)->ci_num_cached);
 
-       mlog_bug_on_msg(!(oi->ip_metadata_cache.ci_flags &
-                         OCFS2_CACHE_FL_INLINE),
+       mlog_bug_on_msg(!(INODE_CACHE(inode)->ci_flags & OCFS2_CACHE_FL_INLINE),
                        "Clear inode of %llu, inode has a bad flag\n",
                        (unsigned long long)oi->ip_blkno);
 
@@ -1147,8 +1155,6 @@ void ocfs2_clear_inode(struct inode *inode)
 
        /* Clear all other flags. */
        oi->ip_flags = 0;
-       oi->ip_created_trans = 0;
-       oi->ip_last_trans = 0;
        oi->ip_dir_start_lookup = 0;
        oi->ip_blkno = 0ULL;
 
@@ -1240,7 +1246,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
        mlog_entry("(inode %llu)\n",
                   (unsigned long long)OCFS2_I(inode)->ip_blkno);
 
-       status = ocfs2_journal_access_di(handle, inode, bh,
+       status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh,
                                         OCFS2_JOURNAL_ACCESS_WRITE);
        if (status < 0) {
                mlog_errno(status);
@@ -1381,8 +1387,8 @@ int ocfs2_read_inode_block_full(struct inode *inode, struct buffer_head **bh,
        int rc;
        struct buffer_head *tmp = *bh;
 
-       rc = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1, &tmp,
-                              flags, ocfs2_validate_inode_block);
+       rc = ocfs2_read_blocks(INODE_CACHE(inode), OCFS2_I(inode)->ip_blkno,
+                              1, &tmp, flags, ocfs2_validate_inode_block);
 
        /* If ocfs2_read_blocks() got us a new bh, pass it up. */
        if (!rc && !*bh)
@@ -1396,10 +1402,6 @@ int ocfs2_read_inode_block(struct inode *inode, struct buffer_head **bh)
        return ocfs2_read_inode_block_full(inode, bh, 0);
 }
 
-static struct ocfs2_inode_info *cache_info_to_inode(struct ocfs2_caching_info *ci)
-{
-       return container_of(ci, struct ocfs2_inode_info, ip_metadata_cache);
-}
 
 static u64 ocfs2_inode_cache_owner(struct ocfs2_caching_info *ci)
 {
@@ -1408,6 +1410,13 @@ static u64 ocfs2_inode_cache_owner(struct ocfs2_caching_info *ci)
        return oi->ip_blkno;
 }
 
+static struct super_block *ocfs2_inode_cache_get_super(struct ocfs2_caching_info *ci)
+{
+       struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
+
+       return oi->vfs_inode.i_sb;
+}
+
 static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
 {
        struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
@@ -1438,6 +1447,7 @@ static void ocfs2_inode_cache_io_unlock(struct ocfs2_caching_info *ci)
 
 const struct ocfs2_caching_operations ocfs2_inode_caching_ops = {
        .co_owner               = ocfs2_inode_cache_owner,
+       .co_get_super           = ocfs2_inode_cache_get_super,
        .co_cache_lock          = ocfs2_inode_cache_lock,
        .co_cache_unlock        = ocfs2_inode_cache_unlock,
        .co_io_lock             = ocfs2_inode_cache_io_lock,