l2tp: don't use inet_shutdown on ppp session destroy
[pandora-kernel.git] / fs / nilfs2 / gcinode.c
index 1c2a3e2..57ceaf3 100644 (file)
@@ -48,9 +48,6 @@
 #include "dat.h"
 #include "ifile.h"
 
-static const struct address_space_operations def_gcinode_aops = {
-};
-
 /*
  * nilfs_gccache_submit_read_data() - add data buffer and submit read request
  * @inode - gc inode
@@ -87,9 +84,9 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
                goto out;
 
        if (pbn == 0) {
-               struct inode *dat_inode = NILFS_I_NILFS(inode)->ns_dat;
-                                         /* use original dat, not gc dat. */
-               err = nilfs_dat_translate(dat_inode, vbn, &pbn);
+               struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
+
+               err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
                if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
                        brelse(bh);
                        goto failed;
@@ -103,7 +100,7 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
        }
 
        if (!buffer_mapped(bh)) {
-               bh->b_bdev = NILFS_I_NILFS(inode)->ns_bdev;
+               bh->b_bdev = inode->i_sb->s_bdev;
                set_buffer_mapped(bh);
        }
        bh->b_blocknr = pbn;
@@ -160,15 +157,11 @@ int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *bh)
        if (buffer_dirty(bh))
                return -EEXIST;
 
-       if (buffer_nilfs_node(bh)) {
-               if (nilfs_btree_broken_node_block(bh)) {
-                       clear_buffer_uptodate(bh);
-                       return -EIO;
-               }
-               nilfs_btnode_mark_dirty(bh);
-       } else {
-               nilfs_mark_buffer_dirty(bh);
+       if (buffer_nilfs_node(bh) && nilfs_btree_broken_node_block(bh)) {
+               clear_buffer_uptodate(bh);
+               return -EIO;
        }
+       mark_buffer_dirty(bh);
        return 0;
 }
 
@@ -178,7 +171,7 @@ int nilfs_init_gcinode(struct inode *inode)
 
        inode->i_mode = S_IFREG;
        mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
-       inode->i_mapping->a_ops = &def_gcinode_aops;
+       inode->i_mapping->a_ops = &empty_aops;
        inode->i_mapping->backing_dev_info = inode->i_sb->s_bdi;
 
        ii->i_flags = 0;
@@ -198,6 +191,8 @@ void nilfs_remove_all_gcinodes(struct the_nilfs *nilfs)
        while (!list_empty(head)) {
                ii = list_first_entry(head, struct nilfs_inode_info, i_dirty);
                list_del_init(&ii->i_dirty);
+               truncate_inode_pages(&ii->vfs_inode.i_data, 0);
+               nilfs_btnode_cache_clear(&ii->i_btnode_cache);
                iput(&ii->vfs_inode);
        }
 }