Re: [PATCH 1/4] ceph: add ceph_folio_snap_context()

From: Matthew Wilcox

Date: Sun Aug 02 2026 - 17:53:01 EST


On Sun, Aug 02, 2026 at 12:50:02PM -0400, Tal Zussman wrote:
> +static inline struct ceph_snap_context *ceph_folio_snap_context(struct folio *folio)
> +{
> + if (folio_test_private(folio))
> + return (void *)folio->private;
> + return NULL;
> +}

Filesystem folios _ought_to have folio->private as NULL when PG_private
is unset and PG_private set when folio->private is non-NULL. Now, ceph
could be doing something Bad (I believe hugetlbfs does not honour this
for various reasons), but it looks like it's using
folio_attach_private() / folio_detach_private() appropriately.

So I think we should just do:

static inline
struct ceph_snap_context *ceph_folio_snap_context(const struct folio *folio)
{
return folio->private;
}

(folio->private is already void *, so it doesn't need to be cast).
Splitting the definition where I did puts the unimmportant information
(static inline) on the previous line, so somebody grepping for
ceph_folio_snap_context gets the return type, while not breaking 80
columns.