int lafs_prealloc(struct block *b, int type);
int lafs_seg_ref_block(struct block *b, int ssnum);
void lafs_seg_deref(struct fs *fs, u64 addr, int ssnum);
+void lafs_add_active(struct fs *fs, u64 addr);
void lafs_seg_forget(struct fs *fs, int dev, u32 seg);
void lafs_seg_flush_all(struct fs *fs);
void lafs_seg_apply_all(struct fs *fs);
put_page(pg);
kfree(buf);
+ lafs_add_active(fs, next);
+
/* Now we release all the nlink==0 inode that we found */
while (!list_empty(&fs->pending_orphans)) {
struct datablock *db = list_entry(fs->pending_orphans.next,
return 0;
}
+void lafs_add_active(struct fs *fs, u64 addr)
+{
+ /* add this segment to the table as 'active'.
+ * This is only called once at mount time for the
+ * active segments. Other segments become active
+ * via free_get
+ */
+ struct segstat *ss;
+ int ssn;
+ u16 *where[SEG_NUM_HEIGHTS];
+ struct segsum *ssum = segsum_byaddr(fs, addr, 0);
+ (void)getdref(ssum->ssblk, MKREF(intable));
+ (void)getdref(ssum->youthblk, MKREF(intable));
+ spin_lock(&fs->lock);
+ ss = segfind(fs->segtrack, ssum->devnum, ssum->segnum, where);
+ BUG_ON(ss);
+ ssn = segunused(fs->segtrack);
+ ss = segfollow(fs->segtrack, ssn);
+ BUG_ON(!ss);
+
+ ss->dev = ssum->devnum;
+ ss->segment = ssum->segnum;
+ ss->score = SCORE_ACTIVE;
+ ss->usage = 0;
+ seginsert(fs->segtrack, ssn, where);
+ lafs_check_seg_cnt(fs->segtrack);
+
+ spin_unlock(&fs->lock);
+}
+
static void clean_free(struct fs *fs)
{
/* We are finishing off a checkpoint. Move all from 'clean'