Avoid inadvertent empty clusters by only writing a cluster if
there is clearly something to write.
Signed-off-by: NeilBrown <neilb@suse.de>
{
struct wc *wc = &fs->wc[cnum];
mutex_lock(&wc->lock);
- cluster_flush(fs, cnum);
+ if (!list_empty(&wc->clhead)
+ || (fs->checkpointing & CH_CheckpointEnd)
+ || wc->chead_size > sizeof(struct cluster_head))
+ cluster_flush(fs, cnum);
mutex_unlock(&wc->lock);
}
putdref(b);
}
#else
- if (!lafs_cluster_empty(fs, 0))
- lafs_cluster_flush(fs, 0);
+ lafs_cluster_flush(fs, 0);
#endif
}