On Thu, May 10, 2018 at 04:52:00PM +0800, Ming Lei wrote: > On Wed, May 9, 2018 at 3:47 PM, Christoph Hellwig <hch@xxxxxx> wrote: > > For the upcoming removal of buffer heads in XFS we need to keep track of > > the number of outstanding writeback requests per page. For this we need > > to know if bio_add_page merged a region with the previous bvec or not. > > Instead of adding additional arguments this refactors bio_add_page to > > be implemented using three lower level helpers which users like XFS can > > use directly if they care about the merge decisions. > > The merge policy may be transparent to fs, such as multipage bvec. The whole point of this series it to make it explicit. That will have to be carried over into a multipage bvec world. That means the current __bio_try_merge_page will have to remain as-is in that new world order, but we'd also add a new __bio_try_merge_segment which merges beyond th e page. For the iomap and xfs code we'd first call __bio_try_merge_page, if that fails increment the read/write count, and only after that call __bio_try_merge_segment.