bcachefs: Do not check folio_has_private()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 20 Aug 2024 04:10:11 +0000 (05:10 +0100)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 9 Sep 2024 13:41:49 +0000 (09:41 -0400)
folio_has_private() is an attractive nuisance; filesystem authors
generally don't realise that it actually checks two flags (one of which
is never set by bcachefs).  There's no need to check the private flag at
all; for folios owned by bcachefs, we know that folio->private is NULL
when the private flag is clear and non-NULL when the private flag is set.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-io-pagecache.h

index fd7d692c087e1d7e8425007a90bf115bed2e5dc6..fad911cf50680186c763e22e4bff1bd6646399c0 100644 (file)
@@ -99,9 +99,7 @@ static inline void bch2_folio_release(struct folio *folio)
 
 static inline struct bch_folio *__bch2_folio(struct folio *folio)
 {
-       return folio_has_private(folio)
-               ? (struct bch_folio *) folio_get_private(folio)
-               : NULL;
+       return folio_get_private(folio);
 }
 
 static inline struct bch_folio *bch2_folio(struct folio *folio)