From: NeilBrown Date: Fri, 9 Jul 2010 23:17:08 +0000 (+1000) Subject: Make sure orphans gets run promptly. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=347fc7b417753a3a29af007defb05607079dcc88;p=LaFS.git Make sure orphans gets run promptly. Whenever we add an orphan to the list, ask the cleaner thread to have a look at it. Signed-off-by: NeilBrown --- diff --git a/inode.c b/inode.c index f5d9893..42cf624 100644 --- a/inode.c +++ b/inode.c @@ -341,6 +341,7 @@ lafs_import_inode(struct inode *ino, struct datablock *b) if (list_empty(&b->orphans)) { list_add_tail(&b->orphans, &fs->pending_orphans); getdref(b, MKREF(orphan_list)); + lafs_wake_cleaner(fs); } spin_unlock(&fs->lock); } diff --git a/orphan.c b/orphan.c index 1abe643..aded002 100644 --- a/orphan.c +++ b/orphan.c @@ -163,13 +163,9 @@ static void orphan_commit(struct fs *fs, struct datablock *b, struct datablock * /* Committed to being an orphan now */ b->orphan_slot = om->nextfree++; - spin_lock(&fs->lock); set_bit(B_Orphan, &b->b.flags); - if (list_empty(&b->orphans)) { - getdref(b, MKREF(orphan_list)); - list_add_tail(&b->orphans, &fs->pending_orphans); - } - spin_unlock(&fs->lock); + lafs_add_orphan(fs, b); + dprintk("%p->orphan_slot=%d (%lu,%lu,%lu) %s\n", b, b->orphan_slot, LAFSI(b->b.inode)->filesys->i_ino, b->b.inode->i_ino, b->b.fileaddr, strblk(&b->b)); @@ -568,6 +564,7 @@ void lafs_add_orphan(struct fs *fs, struct datablock *db) getdref(db, MKREF(orphan_list)); } spin_unlock(&fs->lock); + lafs_wake_cleaner(fs); } void lafs_orphan_forget(struct fs *fs, struct datablock *db)