shmem: move the shmem_mapping assert into shmem_get_folio_gfp
authorChristoph Hellwig <hch@lst.de>
Mon, 19 Feb 2024 06:27:12 +0000 (07:27 +0100)
committerChandan Babu R <chandanbabu@kernel.org>
Wed, 21 Feb 2024 06:06:51 +0000 (11:36 +0530)
commit1cd81faaf61b42307e81f2dd173934005c220a64
tree0e9b0f6281d008f2b1dad04977f613778411f6cc
parente11381d83d72198565f4545d9988b4720288eb64
shmem: move the shmem_mapping assert into shmem_get_folio_gfp

Move the check that the inode really is a shmemfs one from
shmem_read_folio_gfp to shmem_get_folio_gfp given that shmem_get_folio
can also be called from outside of shmem.c.  Also turn it into a
WARN_ON_ONCE and error return instead of BUG_ON to be less severe.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
mm/shmem.c