On 19.09.19 г. 10:59 ч., Omar Sandoval wrote: > On Thu, Sep 19, 2019 at 09:46:31AM +0200, Nikolay Borisov wrote: >> >> >> On 19.09.19 г. 9:14 ч., Omar Sandoval wrote: >>> On Thu, Sep 05, 2019 at 01:33:56PM +0300, Nikolay Borisov wrote: >> >> <snip> >> >>>> >>>> Won't btrfs_lock_and_flush_ordered_range suffice here? Perhaps call that >>>> function + invalidate_inode_pages2_range ? >>> >>> No, btrfs_lock_and_flush_ordered_range() doesn't write out dirty pages, >>> so it's not sufficient here. >> >> But it does - it calls btrfs_start_ordered_extent which calls >> filemap_fdatawrite_range. > > It only calls that for ranges which already have an ordered extent, > which we don't create until we're writing the dirty pages out (take a > look at where we call btrfs_add_ordered_extent()). Right, btrfs_wait_ordered_range actually does btrfs_fdatawrite_range to instantiate any pending ranges and then does the lookup_first_ordered_ extent/start_ordered_extent loop. >