Skip to content

add folio_headpage() macro

SeongJae Park ceph-devel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3include/linux/page-flags: add folio_headpage()include/linux/page-flags.h+8 -00 replies
2/3mm: use folio_headpage() instead of folio_page()mm/shmem.c mm/slab.c mm/slab_common.c +1 more+9 -91 reply
3/3fs/ceph/addr: use folio_headpage() instead of folio_page()fs/ceph/addr.c+1 -11 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] add folio_headpage() macro

The standard idiom for getting head page of a given folio is '&folio->page'. It is efficient and safe even if the folio is NULL, because the offset of page field in folio is zero. However, it makes the code not that easy to understand at the first glance, especially the NULL safety. Also, sometimes people forget the idiom and use 'folio_page(folio, 0)' instead. To make it easier to read and remember, add a new macro function called 'folio_headpage()' with the NULL case explanation. Then, replace the 'folio_page(folio, 0)' calls with 'folio_headpage(folio)'.

SeongJae Park (3):
include/linux/page-flags: add folio_headpage()
mm: use folio_headpage() instead of folio_page() fs/ceph/addr: use folio_headpage() instead of folio_page()

 fs/ceph/addr.c             | 2 +-
 include/linux/page-flags.h | 8 ++++++++
 mm/shmem.c                 | 4 ++--
 mm/slab.c                  | 6 +++---
 mm/slab_common.c           | 4 ++--
 mm/slub.c                  | 4 ++--
 6 files changed, 18 insertions(+), 10 deletions(-)
Signature · 1 line
2.25.1