seg->st_table = seg->nxt_table;
seg->st_row = seg->nxt_row;
seg->table = seg->st_table;
- seg->row = seg->nxt_row;
+ seg->row = seg->st_row;
seg->col = 0;
}
seg->col = 0;
}
-static u64 seg_next(struct fs *fs, struct segpos *seg)
+static u64 seg_addr(struct fs *fs, struct segpos *seg)
{
- /* step forward one block, returning the address of
- * the block stepped over
+ /* Return the virtual address of the blocks pointed
+ * to by 'seg'.
*/
struct fs_dev *dv = &fs->devs[seg->dev];
+ u64 addr;
- u64 addr = seg->col * dv->stride;
+ if (seg->dev < 0)
+ /* Setting 'next' address for last cluster in
+ * a cleaner segment */
+ return 0;
+ addr = seg->col * dv->stride;
addr += seg->row;
- addr += seg->table * (dv->stride); /* FIXME */
+ addr += seg->table * dv->rows_per_table;
addr += seg->num * dv->segment_stride;
addr += dv->start;
+ return addr;
+}
+
+static u64 seg_next(struct fs *fs, struct segpos *seg)
+{
+ /* step forward one block, returning the address of
+ * the block stepped over
+ */
+ struct fs_dev *dv = &fs->devs[seg->dev];
+ u64 addr = seg_addr(fs, seg);
/* now step forward in column or table or seg */
seg->col++;
return addr;
}
-static u64 seg_addr(struct fs *fs, struct segpos *seg)
-{
- /* step forward one block, returning the address of
- * the block stepped over. FIXME this comment is wrong.
- */
- struct fs_dev *dv = &fs->devs[seg->dev];
- u64 addr;
-
- if (seg->dev < 0)
- /* Setting 'next' address for last cluster in
- * a cleaner segment */
- return 0;
- addr = seg->col * dv->stride;
- addr += seg->row;
- addr += seg->table * (dv->stride); /* FIXME */
- addr += seg->num * dv->segment_stride;
- addr += dv->start;
- return addr;
-}
-
static void cluster_reset(struct fs *fs, struct wc *wc)
{
- int blocksize = fs->blocksize;
if (wc->seg.dev < 0) {
wc->remaining = 0;
wc->chead_size = 0;
wc->remaining = seg_remainder(fs, &wc->seg);
wc->chead_blocks = 1;
wc->remaining--;
- wc->cluster_space = blocksize - sizeof(struct cluster_head);
+ wc->cluster_space = fs->blocksize - sizeof(struct cluster_head);
wc->chead = page_address(wc->page[wc->pending_next]);
wc->chead_size = sizeof(struct cluster_head);
}
* in the list. These routines help.
*/
-static inline void cluster_addhead(struct wc *wc, struct inode *ino,
- struct group_head **headstart)
+static void cluster_addhead(struct wc *wc, struct inode *ino,
+ struct group_head **headstart)
{
struct group_head *gh = (struct group_head *)((char *)wc->chead +
wc->chead_size);
wc->chead_size += sizeof(struct group_head);
}
-static inline void cluster_closehead(struct wc *wc,
- struct group_head *headstart)
+static void cluster_closehead(struct wc *wc,
+ struct group_head *headstart)
{
int size = wc->chead_size - (((char *)headstart) - (char *)wc->chead);
headstart->group_size_words = size / 4;
}
-static inline void cluster_addmini(struct wc *wc, u32 addr, int offset,
- int size, const char *data,
- int size2, const char *data2)
+static void cluster_addmini(struct wc *wc, u32 addr, int offset,
+ int size, const char *data,
+ int size2, const char *data2)
{
/* if size2 !=0, then only
* (size-size2) is at 'data' and the rest is at 'data2'
wc->chead_size += ROUND_UP(size);
}
-static inline void cluster_adddesc(struct wc *wc, struct block *blk,
- struct descriptor **desc_start)
+static void cluster_adddesc(struct wc *wc, struct block *blk,
+ struct descriptor **desc_start)
{
struct descriptor *dh = (struct descriptor *)((char *)wc->chead +
wc->chead_size);
wc->chead_size += sizeof(struct descriptor);
}
-static inline void cluster_incdesc(struct wc *wc, struct descriptor *desc_start,
- struct block *b, int blkbits)
+static void cluster_incdesc(struct wc *wc, struct descriptor *desc_start,
+ struct block *b, int blkbits)
{
desc_start->block_cnt =
cpu_to_le32(le32_to_cpu(desc_start->block_cnt)+1);
struct segpos segend;
int which;
int wake;
- int blocks = 0;
int vtype;
int cluster_size;
cluster_incdesc(wc, desc_start, b, fs->blocksize_bits);
addr = seg_next(fs, &wc->seg);
if (cnum && test_bit(B_Dirty, &b->flags))
- /* Were a cleaning but this block is now dirty.
+ /* We are cleaning but this block is now dirty.
* Don't waste the UnincCredit on recording the
* clean location as it will be written as
* dirty soon. Just pin it to the current phase
lafs_pin_block(b);
else
lafs_allocated_block(fs, b, addr);
- blocks++;
}
if (head_start)
wc->pending_next = 0;
wc->cluster_seq = seq;
wc->prev_addr = prev;
+ wc->cnum = cnum;
if (addr) {
seg_setpos(fs, &wc->seg, addr);
fs->free_blocks += wc->remaining+1;
spin_unlock(&fs->lock);
}
- wc->cnum = cnum;
return 0;
}