Hello, On Tue, Oct 25, 2016 at 02:41:43PM -0400, Josef Bacik wrote: > Now that we have metadata counters in the VM, we need to provide a way to kick > writeback on dirty metadata. Introduce super_operations->write_metadata. This > allows file systems to deal with writing back any dirty metadata we need based > on the writeback needs of the system. Since there is no inode to key off of we > need a list in the bdi for dirty super blocks to be added. From there we can > find any dirty sb's on the bdi we are currently doing writeback on and call into > their ->write_metadata callback. > > Signed-off-by: Josef Bacik <jbacik@xxxxxx> > Reviewed-by: Jan Kara <jack@xxxxxxx> Reviewed-by: Tejun Heo <tj@xxxxxxxxxx> > @@ -1491,6 +1516,7 @@ static long writeback_sb_inodes(struct super_block *sb, > unsigned long start_time = jiffies; > long write_chunk; > long wrote = 0; /* count both pages and inodes */ > + bool done = false; > > while (!list_empty(&wb->b_io)) { > struct inode *inode = wb_inode(wb->b_io.prev); > @@ -1607,12 +1633,18 @@ static long writeback_sb_inodes(struct super_block *sb, > * background threshold and other termination conditions. > */ > if (wrote) { > - if (time_is_before_jiffies(start_time + HZ / 10UL)) > - break; > - if (work->nr_pages <= 0) > + if (time_is_before_jiffies(start_time + HZ / 10UL) || > + work->nr_pages <= 0) { > + done = true; > break; > + } > } > } > + if (!done && sb->s_op->write_metadata) { > + spin_unlock(&wb->list_lock); > + wrote += writeback_sb_metadata(sb, wb, work); > + spin_lock(&wb->list_lock); So, here and below, we're writing out metadata only after finishing writing out data if the writeout budget is limited. It'd be great to document the behavior and why it's so in the callback definition. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html