On 2020/11/19 上午4:27, David Sterba wrote: > On Fri, Nov 13, 2020 at 08:51:29PM +0800, Qu Wenruo wrote: >> Introduce a new helper, endio_readpage_release_extent(), to handle >> update status update in end_bio_extent_readpage(). >> >> The refactor itself is not really nothing interesting, the point here is >> to provide the basis for later subpage support, where the page status >> update can be more complex than current code. >> >> Signed-off-by: Qu Wenruo >> --- >> fs/btrfs/extent_io.c | 17 ++++++++++++----- >> 1 file changed, 12 insertions(+), 5 deletions(-) >> >> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c >> index b5b3700943e0..caafe44542e8 100644 >> --- a/fs/btrfs/extent_io.c >> +++ b/fs/btrfs/extent_io.c >> @@ -2849,6 +2849,17 @@ endio_readpage_release_extent(struct processed_extent *processed, >> processed->uptodate = uptodate; >> } >> >> +static void endio_readpage_update_page_status(struct page *page, bool uptodate) >> +{ >> + if (uptodate) { >> + SetPageUptodate(page); >> + } else { >> + ClearPageUptodate(page); >> + SetPageError(page); >> + } >> + unlock_page(page); > > That would be better left in the caller as it's quite important > information but the helper name does not say anything about it. > It may be the case for now, but for incoming subpage, check the patch "btrfs: integrate page status update for read path into begin/end_page_read()" to see why we want page unlocking to be done here. Thanks, Qu