From: NeilBrown Date: Tue, 29 Jun 2010 11:40:57 +0000 (+1000) Subject: Rearrange if structure in lafs_cluster_allocate X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=394c73ae6d097be051a454f63af33f4f3b4fe31a;p=LaFS.git Rearrange if structure in lafs_cluster_allocate try to get fewer indentation levels. Signed-off-by: NeilBrown --- diff --git a/cluster.c b/cluster.c index abfdb51..00d508b 100644 --- a/cluster.c +++ b/cluster.c @@ -766,26 +766,25 @@ int lafs_cluster_allocate(struct block *b, int cnum) avail = 0; used = cluster_insert(&wc->slhead, &wc->clhead, b, avail); - if (used < 0) { - /* won't fit */ - // printk("Wont fit - used = %d\n", used); - if (wc->slhead.b == NULL) { - err = new_segment(fs, cnum); - if (err) { - /* No cleaner segments - this will have to go - * out with a checkpoint. - * Block is still 'dirty' - just clear - * writeback flag. - */ - lafs_writeback_done(b); - putref(b, MKREF(cluster)); - mutex_unlock(&wc->lock); - return -ENOSPC; - } - } else - cluster_flush(fs, cnum); - } else + if (used >= 0) lafs_io_wake(b); + else if (wc->slhead.b) + cluster_flush(fs, cnum); + else { + err = new_segment(fs, cnum); + if (err) { + /* No cleaner segments - this will have to go + * out with a checkpoint. + * Block is still 'dirty' - just clear + * writeback flag. + */ + lafs_writeback_done(b); + putref(b, MKREF(cluster)); + mutex_unlock(&wc->lock); + return -ENOSPC; + } + } + } while (used < 0); if (used > 0)