* "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;
#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);
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;
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 */
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;
* 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;
*/
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;