From: NeilBrown Date: Thu, 27 Aug 2009 01:45:59 +0000 (+1000) Subject: Get rid of orphan_info structure. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=9c9e70193c4313ebaca6ce7874dc0eea050f9228;p=LaFS.git Get rid of orphan_info structure. It no longer contains anything really useful... --- diff --git a/orphan.c b/orphan.c index 6d9b14d..624cd68 100644 --- a/orphan.c +++ b/orphan.c @@ -95,15 +95,12 @@ void lafs_dump_orphans(void) * "orphanx", "orphan_release", "orphan_release2", "orphan_move" * "orphan_fs", "orphan_ino", "orphan_blk" Temporary references */ -struct orphan_info { - struct fs *fs; - struct datablock *ob; -}; + /* Before locking the checkpoint, we need to reserve space to * store the orphan record, and make sure we hold a reference * to the block. */ -static int orphan_prepare(struct fs *fs, struct orphan_info *oi) +static int orphan_prepare(struct fs *fs) { struct orphan_md *om = &LAFSI(fs->orphans)->md.orphan; u32 bnum; @@ -113,8 +110,6 @@ static int orphan_prepare(struct fs *fs, struct orphan_info *oi) #ifdef DUMP dfs = fs; #endif - oi->ob = NULL; - oi->fs = fs; mutex_lock_nested(&fs->orphans->i_mutex, I_MUTEX_QUOTA); bnum = (om->nextfree + om->reserved) >> (fs->prime_sb->s_blocksize_bits-4); @@ -133,9 +128,8 @@ static int orphan_prepare(struct fs *fs, struct orphan_info *oi) return err; } -static int orphan_pin(struct orphan_info *oi, struct datablock *b) +static int orphan_pin(struct fs *fs, struct datablock *b) { - struct fs *fs = oi->fs; struct orphan_md *om = &LAFSI(fs->orphans)->md.orphan; u32 slot; struct orphan *or; @@ -153,12 +147,10 @@ static int orphan_pin(struct orphan_info *oi, struct datablock *b) LAFS_BUG(ob == NULL, &b->b); lafs_phase_wait(&ob->b); - oi->ob = ob; err = lafs_pin_dblock(ob); if (err) { mutex_unlock(&fs->orphans->i_mutex); putdref(ob, MKREF(orphan)); - oi->ob = NULL; return err; } /* Committed to being an orphan now */ @@ -183,7 +175,7 @@ static int orphan_pin(struct orphan_info *oi, struct datablock *b) or[ent].inum = cpu_to_le32(b->b.inode->i_ino); or[ent].addr = cpu_to_le32(b->b.fileaddr); unmap_dblock(ob, or); - lafs_dirty_dblock(oi->ob); + lafs_dirty_dblock(ob); clear_bit(B_PinPending, &ob->b.flags); mutex_unlock(&fs->orphans->i_mutex); return 0; @@ -195,9 +187,8 @@ static int orphan_pin(struct orphan_info *oi, struct datablock *b) * We let regular orphan processing find that out and release it. * This avoids races. */ -static void orphan_abort(struct orphan_info *oi) +static void orphan_abort(struct fs *fs) { - struct fs *fs = oi->fs; u32 bnum; struct datablock *b; struct orphan_md *om = &LAFSI(fs->orphans)->md.orphan; @@ -236,24 +227,23 @@ static void orphan_abort(struct orphan_info *oi) */ int lafs_make_orphan(struct fs *fs, struct datablock *db) { - struct orphan_info oi; int err; if (test_bit(B_Orphan, &db->b.flags)) return 0; - err = orphan_prepare(fs, &oi); + err = orphan_prepare(fs); if (err) return err; retry: lafs_checkpoint_lock(fs); - err = orphan_pin(&oi, db); + err = orphan_pin(fs, db); if (err == -EAGAIN) { lafs_checkpoint_unlock_wait(fs); goto retry; } if (err) - orphan_abort(&oi); + orphan_abort(fs); /* there is no 'commit' - 'pin' did all the work */ lafs_checkpoint_unlock(fs); return 0;