Skip to content

Commit 1b690b4

Browse files
committed
[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: David Woodhouse <dwmw2@infradead.org>
1 parent 590fe34 commit 1b690b4

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎fs/jffs2/fs.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,12 @@ void jffs2_gc_release_inode(struct jffs2_sb_info *c,
586586
}
587587

588588
struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
589-
int inum, int nlink)
589+
int inum, int unlinked)
590590
{
591591
struct inode *inode;
592592
struct jffs2_inode_cache *ic;
593-
if (!nlink) {
593+
594+
if (unlinked) {
594595
/* The inode has zero nlink but its nodes weren't yet marked
595596
obsolete. This has to be because we're still waiting for
596597
the final (close() and) iput() to happen.
@@ -638,8 +639,8 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
638639
return ERR_CAST(inode);
639640
}
640641
if (is_bad_inode(inode)) {
641-
printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. nlink %d\n",
642-
inum, nlink);
642+
printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. unlinked %d\n",
643+
inum, unlinked);
643644
/* NB. This will happen again. We need to do something appropriate here. */
644645
iput(inode);
645646
return ERR_PTR(-EIO);

‎fs/jffs2/gc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
401401
nlink = ic->nlink;
402402
spin_unlock(&c->inocache_lock);
403403

404-
f = jffs2_gc_fetch_inode(c, inum, nlink);
404+
f = jffs2_gc_fetch_inode(c, inum, !nlink);
405405
if (IS_ERR(f)) {
406406
ret = PTR_ERR(f);
407407
goto release_sem;

‎fs/jffs2/os-linux.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent);
187187
void jffs2_gc_release_inode(struct jffs2_sb_info *c,
188188
struct jffs2_inode_info *f);
189189
struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
190-
int inum, int nlink);
190+
int inum, int unlinked);
191191

192192
unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
193193
struct jffs2_inode_info *f,

‎fs/jffs2/wbuf.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
494494
/* If it's an in-core inode, then we have to adjust any
495495
full_dirent or full_dnode structure to point to the
496496
new version instead of the old */
497-
f = jffs2_gc_fetch_inode(c, ic->ino, ic->nlink);
497+
f = jffs2_gc_fetch_inode(c, ic->ino, !ic->nlink);
498498
if (IS_ERR(f)) {
499499
/* Should never happen; it _must_ be present */
500500
JFFS2_ERROR("Failed to iget() ino #%u, err %ld\n",

0 commit comments

Comments
 (0)