Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213739
b: refs/heads/master
c: 0e14a35
h: refs/heads/master
i:
  213737: 6c96646
  213735: 955e274
v: v3
  • Loading branch information
Ryusuke Konishi committed Oct 23, 2010
1 parent 13e78be commit 7e12463
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6c43f41000312fefa482c3bfdd97e7f81d6be0ec
refs/heads/master: 0e14a3595bddedfb27b51a6b0a29b5173aa2511a
37 changes: 34 additions & 3 deletions trunk/fs/nilfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
#include "cpfile.h"
#include "ifile.h"

struct nilfs_iget_args {
u64 ino;
__u64 cno;
int for_gc;
};

/**
* nilfs_get_block() - get a file block on the filesystem (callback function)
Expand Down Expand Up @@ -320,7 +325,6 @@ struct inode *nilfs_new_inode(struct inode *dir, int mode)
/* ii->i_file_acl = 0; */
/* ii->i_dir_acl = 0; */
ii->i_dir_start_lookup = 0;
ii->i_cno = 0;
nilfs_set_inode_flags(inode);
spin_lock(&sbi->s_next_gen_lock);
inode->i_generation = sbi->s_next_generation++;
Expand Down Expand Up @@ -410,7 +414,6 @@ int nilfs_read_inode_common(struct inode *inode,
0 : le32_to_cpu(raw_inode->i_dir_acl);
#endif
ii->i_dir_start_lookup = 0;
ii->i_cno = 0;
inode->i_generation = le32_to_cpu(raw_inode->i_generation);

if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
Expand Down Expand Up @@ -476,12 +479,40 @@ static int __nilfs_read_inode(struct super_block *sb, unsigned long ino,
return err;
}

static int nilfs_iget_test(struct inode *inode, void *opaque)
{
struct nilfs_iget_args *args = opaque;
struct nilfs_inode_info *ii;

if (args->ino != inode->i_ino)
return 0;

ii = NILFS_I(inode);
if (!test_bit(NILFS_I_GCINODE, &ii->i_state))
return !args->for_gc;

return args->for_gc && args->cno == ii->i_cno;
}

static int nilfs_iget_set(struct inode *inode, void *opaque)
{
struct nilfs_iget_args *args = opaque;

inode->i_ino = args->ino;
if (args->for_gc) {
NILFS_I(inode)->i_state = 1 << NILFS_I_GCINODE;
NILFS_I(inode)->i_cno = args->cno;
}
return 0;
}

struct inode *nilfs_iget(struct super_block *sb, unsigned long ino)
{
struct nilfs_iget_args args = { .ino = ino, .cno = 0, .for_gc = 0 };
struct inode *inode;
int err;

inode = iget_locked(sb, ino);
inode = iget5_locked(sb, ino, nilfs_iget_test, nilfs_iget_set, &args);
if (unlikely(!inode))
return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW))
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/nilfs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ struct inode *nilfs_alloc_inode_common(struct the_nilfs *nilfs)
return NULL;
ii->i_bh = NULL;
ii->i_state = 0;
ii->i_cno = 0;
ii->vfs_inode.i_version = 1;
nilfs_btnode_cache_init(&ii->i_btnode_cache, nilfs->ns_bdi);
return &ii->vfs_inode;
Expand Down

0 comments on commit 7e12463

Please sign in to comment.