diff options
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index a1525dc..98ad959 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1662,6 +1662,16 @@ softdep_setup_freeblocks(ip, length) if ((inodedep->id_state & IOSTARTED) != 0) panic("softdep_setup_freeblocks: inode busy"); /* + * Add the freeblks structure to the list of operations that + * must await the zero'ed inode being written to disk. If we + * still have a bitmap dependency (delay == 0), then the inode + * has never been written to disk, so we can process the + * freeblks below once we have deleted the dependencies. + */ + delay = (inodedep->id_state & DEPCOMPLETE); + if (delay) + WORKLIST_INSERT(&inodedep->id_bufwait, &freeblks->fb_list); + /* * Because the file length has been truncated to zero, any * pending block allocation dependency structures associated * with this inode are obsolete and can simply be de-allocated. @@ -1694,23 +1704,16 @@ softdep_setup_freeblocks(ip, length) brelse(bp); ACQUIRE_LOCK(&lk); } + if (inodedep_lookup(fs, ip->i_number, 0, &inodedep) != 0) + (void) free_inodedep(inodedep); + FREE_LOCK(&lk); /* - * Add the freeblks structure to the list of operations that - * must await the zero'ed inode being written to disk. If we - * still have a bitmap dependency, then the inode has never been - * written to disk, so we can process the freeblks immediately. - * If the inodedep does not exist, then the zero'ed inode has - * been written and we can also proceed. + * If the inode has never been written to disk (delay == 0), + * then we can process the freeblks now that we have deleted + * the dependencies. */ - if (inodedep_lookup(fs, ip->i_number, 0, &inodedep) == 0 || - free_inodedep(inodedep) || - (inodedep->id_state & DEPCOMPLETE) == 0) { - FREE_LOCK(&lk); + if (!delay) handle_workitem_freeblocks(freeblks); - } else { - WORKLIST_INSERT(&inodedep->id_bufwait, &freeblks->fb_list); - FREE_LOCK(&lk); - } } /* @@ -2017,7 +2020,7 @@ handle_workitem_freeblocks(freeblks) #ifdef DIAGNOSTIC if (freeblks->fb_chkcnt != blocksreleased) - panic("handle_workitem_freeblocks: block count"); + printf("handle_workitem_freeblocks: block count"); if (allerror) softdep_error("handle_workitem_freeblks", allerror); #endif /* DIAGNOSTIC */ |