Commit 1b690b48 authored by David Woodhouse's avatar David Woodhouse

[JFFS2] Invert last argument of jffs2_gc_fetch_inode(), make it boolean.

We don't actually care about nlink; we only care whether the inode in
question is unlinked or not.
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 590fe34c
...@@ -586,11 +586,12 @@ void jffs2_gc_release_inode(struct jffs2_sb_info *c, ...@@ -586,11 +586,12 @@ void jffs2_gc_release_inode(struct jffs2_sb_info *c,
} }
struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
int inum, int nlink) int inum, int unlinked)
{ {
struct inode *inode; struct inode *inode;
struct jffs2_inode_cache *ic; struct jffs2_inode_cache *ic;
if (!nlink) {
if (unlinked) {
/* The inode has zero nlink but its nodes weren't yet marked /* The inode has zero nlink but its nodes weren't yet marked
obsolete. This has to be because we're still waiting for obsolete. This has to be because we're still waiting for
the final (close() and) iput() to happen. the final (close() and) iput() to happen.
...@@ -638,8 +639,8 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, ...@@ -638,8 +639,8 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
return ERR_CAST(inode); return ERR_CAST(inode);
} }
if (is_bad_inode(inode)) { if (is_bad_inode(inode)) {
printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. nlink %d\n", printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. unlinked %d\n",
inum, nlink); inum, unlinked);
/* NB. This will happen again. We need to do something appropriate here. */ /* NB. This will happen again. We need to do something appropriate here. */
iput(inode); iput(inode);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
......
...@@ -401,7 +401,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) ...@@ -401,7 +401,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
nlink = ic->nlink; nlink = ic->nlink;
spin_unlock(&c->inocache_lock); spin_unlock(&c->inocache_lock);
f = jffs2_gc_fetch_inode(c, inum, nlink); f = jffs2_gc_fetch_inode(c, inum, !nlink);
if (IS_ERR(f)) { if (IS_ERR(f)) {
ret = PTR_ERR(f); ret = PTR_ERR(f);
goto release_sem; goto release_sem;
......
...@@ -187,7 +187,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent); ...@@ -187,7 +187,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent);
void jffs2_gc_release_inode(struct jffs2_sb_info *c, void jffs2_gc_release_inode(struct jffs2_sb_info *c,
struct jffs2_inode_info *f); struct jffs2_inode_info *f);
struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
int inum, int nlink); int inum, int unlinked);
unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
struct jffs2_inode_info *f, struct jffs2_inode_info *f,
......
...@@ -494,7 +494,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) ...@@ -494,7 +494,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
/* If it's an in-core inode, then we have to adjust any /* If it's an in-core inode, then we have to adjust any
full_dirent or full_dnode structure to point to the full_dirent or full_dnode structure to point to the
new version instead of the old */ new version instead of the old */
f = jffs2_gc_fetch_inode(c, ic->ino, ic->nlink); f = jffs2_gc_fetch_inode(c, ic->ino, !ic->nlink);
if (IS_ERR(f)) { if (IS_ERR(f)) {
/* Should never happen; it _must_ be present */ /* Should never happen; it _must_ be present */
JFFS2_ERROR("Failed to iget() ino #%u, err %ld\n", JFFS2_ERROR("Failed to iget() ino #%u, err %ld\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment