Re: [PATCH 5/9] ext4: Add support for writepages calls that cannot map blocks

Ritesh Harjani (IBM)
2022-12-01T13:28:47Z

On 22/12/01 12:50PM, Jan Kara wrote:
> > > + /*
> > > + * Writeout for transaction commit where we cannot
> > > + * modify metadata is simple. Just submit the page.
> > > + */
> > > + if (!mpd->can_map) {
> > > + if (ext4_page_nomap_can_writeout(page)) {
> > > + err = mpage_submit_page(mpd, page);
> > > + if (err < 0)
> > > + goto out;
> > > + } else {
> > > + unlock_page(page);
> > > + mpd->first_page++;
> >
> > We anyway should always have mpd->map.m_len = 0.
> > That means, we always set mpd->first_page = page->index above.
> > So this might not be useful. But I guess for consistency of the code,
> > or to avoid any future bugs, this isn't harmful to keep.
>
> Yes, it is mostly for consistency but it is also needed so that once we
> exit the loop, mpage_release_unused_pages() starts working from a correct
> page.

Oh yes! right.

-ritesh