return 0;
}
+ if (test_bit(B_EmptyIndex, &b->flags)) {
+ int credits = 0;
+ if (test_and_set_bit(B_Writeback, &b->flags))
+ LAFS_BUG(1, b);
+ lafs_iounlock_block(b);
+ lafs_allocated_block(fs, b, 0);
+ /* FIXME this is common code - make a function?? */
+ if (cnum) {
+ if (test_and_clear_bit(B_Realloc, &b->flags))
+ credits++;
+ LAFS_BUG(test_bit(B_Dirty, &b->flags), b);
+ } else {
+ if (test_and_clear_bit(B_Dirty, &b->flags))
+ credits++;
+ if (test_and_clear_bit(B_Realloc, &b->flags))
+ credits++;
+ }
+ lafs_writeback_done(b);
+ lafs_space_return(fs, credits);
+ return 0;
+ }
+
if (!test_bit(B_Index, &b->flags) &&
LAFSI(b->inode)->type == TypeInodeFile) {
struct inode *myi = dblk(b)->my_inode;
putref(b, MKREF(leaf));
}
+ if (test_and_set_bit(B_Writeback, &b->flags))
+ LAFS_BUG(1, b);
+ lafs_iounlock_block(b);
+ /* insert into list ensuring there is enough space
+ * in cluster head
+ */
+ getref(b, MKREF(cluster)); /* we soon own a reference in the list */
+
while (!err && wc->remaining < 2) {
// printk("Call flush - remaining = %d\n", wc->remaining);
if (wc->slhead.b == NULL)
}
if (err) {
/* No cleaner segments - this will have to go
- * out with a checkpoint
+ * out with a checkpoint.
+ * Block is still 'dirty' - just clear writeback flag.
*/
- lafs_iounlock_block(b);
- mutex_unlock(&wc->lock);
- return -ENOSPC;
- }
-
- if (test_and_set_bit(B_Writeback, &b->flags))
- LAFS_BUG(1, b);
- lafs_iounlock_block(b);
-
- if (test_bit(B_EmptyIndex, &b->flags)) {
- int credits = 0;
- lafs_allocated_block(fs, b, 0);
- /* FIXME this is common code - make a function?? */
- if (cnum) {
- if (test_and_clear_bit(B_Realloc, &b->flags))
- credits++;
- LAFS_BUG(test_bit(B_Dirty, &b->flags), b);
- } else {
- if (test_and_clear_bit(B_Dirty, &b->flags))
- credits++;
- if (test_and_clear_bit(B_Realloc, &b->flags))
- credits++;
- }
- lafs_space_return(fs, credits);
lafs_writeback_done(b);
+ putref(b, MKREF(cluster));
mutex_unlock(&wc->lock);
- return 0;
+ return -ENOSPC;
}
- /* insert into list ensuring there is enough space
- * in cluster head
- */
- getref(b, MKREF(cluster)); /* we soon own a reference in the list */
do {
int avail;
/* see how much room is in cluster.