timeout);
clear_bit(CleanerNeeded, &fs->fsstate);
+ if (test_and_clear_bit(FlushNeeded, &fs->fsstate))
+ lafs_cluster_flush(fs, 0);
+
timeout = MAX_SCHEDULE_TIMEOUT;
to = lafs_do_checkpoint(fs);
if (to < timeout)
wake_up(&fs->async_complete);
}
+void lafs_trigger_flush(struct block *b)
+{
+ struct fs *fs = fs_from_inode(b->inode);
+
+ if (test_bit(B_Writeback, &b->flags) &&
+ !test_and_set_bit(FlushNeeded, &fs->fsstate))
+ lafs_wake_cleaner(fs);
+}
+
static int mark_cleaning(struct block *b)
{
int err;
{
if (test_bit(B_Writeback, &b->flags)) {
DEFINE_WAIT(wq);
+ lafs_trigger_flush(b);
for (;;) {
prepare_to_wait(&block_wait, &wq, TASK_UNINTERRUPTIBLE);
if (test_bit(B_Writeback, &b->flags))
/* Writeback was set by a racing thread.. */
lafs_iounlock_block(b);
}
+ lafs_trigger_flush(b);
if (test_and_set_bit(B_Async, &b->flags))
return 0;
void lafs_stop_cleaner(struct fs *fs);
void lafs_wake_cleaner(struct fs *fs);
void lafs_unclean(struct datablock *db);
+void lafs_trigger_flush(struct block *b);
/* cluster.c */
int lafs_cluster_allocate(struct block *b, int cnum);
* be full and new allocation requests get
* -ENOSPC
*/
+#define FlushNeeded 8 /* Need to flush the current cluster because
+ * someone is waiting on writeback
+ */
struct work_struct done_work; /* used for handling
* refile after write completes */