2022-06-03 13:37:30 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2022 Fujitsu. All Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "xfs.h"
|
|
|
|
#include "xfs_shared.h"
|
|
|
|
#include "xfs_format.h"
|
|
|
|
#include "xfs_log_format.h"
|
|
|
|
#include "xfs_trans_resv.h"
|
|
|
|
#include "xfs_mount.h"
|
|
|
|
#include "xfs_alloc.h"
|
|
|
|
#include "xfs_bit.h"
|
|
|
|
#include "xfs_btree.h"
|
|
|
|
#include "xfs_inode.h"
|
|
|
|
#include "xfs_icache.h"
|
|
|
|
#include "xfs_rmap.h"
|
|
|
|
#include "xfs_rmap_btree.h"
|
|
|
|
#include "xfs_rtalloc.h"
|
|
|
|
#include "xfs_trans.h"
|
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve latency
and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCYuravgAKCRDdBJ7gKXxA
jpqSAQDrXSdII+ht9kSHlaCVYjqRFQz/rRvURQrWQV74f6aeiAD+NHHeDPwZn11/
SPktqEUrF1pxnGQxqLh1kUFUhsVZQgE=
=w/UH
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Most of the MM queue. A few things are still pending.
Liam's maple tree rework didn't make it. This has resulted in a few
other minor patch series being held over for next time.
Multi-gen LRU still isn't merged as we were waiting for mapletree to
stabilize. The current plan is to merge MGLRU into -mm soon and to
later reintroduce mapletree, with a view to hopefully getting both
into 6.1-rc1.
Summary:
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve
latency and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place"
[ XFS merge from hell as per Darrick Wong in
https://lore.kernel.org/all/YshKnxb4VwXycPO8@magnolia/ ]
* tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (282 commits)
tools/testing/selftests/vm/hmm-tests.c: fix build
mm: Kconfig: fix typo
mm: memory-failure: convert to pr_fmt()
mm: use is_zone_movable_page() helper
hugetlbfs: fix inaccurate comment in hugetlbfs_statfs()
hugetlbfs: cleanup some comments in inode.c
hugetlbfs: remove unneeded header file
hugetlbfs: remove unneeded hugetlbfs_ops forward declaration
hugetlbfs: use helper macro SZ_1{K,M}
mm: cleanup is_highmem()
mm/hmm: add a test for cross device private faults
selftests: add soft-dirty into run_vmtests.sh
selftests: soft-dirty: add test for mprotect
mm/mprotect: fix soft-dirty check in can_change_pte_writable()
mm: memcontrol: fix potential oom_lock recursion deadlock
mm/gup.c: fix formatting in check_and_migrate_movable_page()
xfs: fail dax mount if reflink is enabled on a partition
mm/memcontrol.c: remove the redundant updating of stats_flush_threshold
userfaultfd: don't fail on unrecognized features
hugetlb_cgroup: fix wrong hugetlb cgroup numa stat
...
2022-08-06 07:32:45 +08:00
|
|
|
#include "xfs_ag.h"
|
2022-06-03 13:37:30 +08:00
|
|
|
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/dax.h>
|
|
|
|
|
2022-10-04 13:40:01 +08:00
|
|
|
struct xfs_failure_info {
|
2022-06-03 13:37:30 +08:00
|
|
|
xfs_agblock_t startblock;
|
|
|
|
xfs_extlen_t blockcount;
|
|
|
|
int mf_flags;
|
2022-10-04 13:40:01 +08:00
|
|
|
bool want_shutdown;
|
2022-06-03 13:37:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static pgoff_t
|
|
|
|
xfs_failure_pgoff(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
const struct xfs_rmap_irec *rec,
|
2022-10-04 13:40:01 +08:00
|
|
|
const struct xfs_failure_info *notify)
|
2022-06-03 13:37:30 +08:00
|
|
|
{
|
|
|
|
loff_t pos = XFS_FSB_TO_B(mp, rec->rm_offset);
|
|
|
|
|
|
|
|
if (notify->startblock > rec->rm_startblock)
|
|
|
|
pos += XFS_FSB_TO_B(mp,
|
|
|
|
notify->startblock - rec->rm_startblock);
|
|
|
|
return pos >> PAGE_SHIFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned long
|
|
|
|
xfs_failure_pgcnt(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
const struct xfs_rmap_irec *rec,
|
2022-10-04 13:40:01 +08:00
|
|
|
const struct xfs_failure_info *notify)
|
2022-06-03 13:37:30 +08:00
|
|
|
{
|
|
|
|
xfs_agblock_t end_rec;
|
|
|
|
xfs_agblock_t end_notify;
|
|
|
|
xfs_agblock_t start_cross;
|
|
|
|
xfs_agblock_t end_cross;
|
|
|
|
|
|
|
|
start_cross = max(rec->rm_startblock, notify->startblock);
|
|
|
|
|
|
|
|
end_rec = rec->rm_startblock + rec->rm_blockcount;
|
|
|
|
end_notify = notify->startblock + notify->blockcount;
|
|
|
|
end_cross = min(end_rec, end_notify);
|
|
|
|
|
|
|
|
return XFS_FSB_TO_B(mp, end_cross - start_cross) >> PAGE_SHIFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xfs_dax_failure_fn(
|
|
|
|
struct xfs_btree_cur *cur,
|
|
|
|
const struct xfs_rmap_irec *rec,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
struct xfs_mount *mp = cur->bc_mp;
|
|
|
|
struct xfs_inode *ip;
|
2022-10-04 13:40:01 +08:00
|
|
|
struct xfs_failure_info *notify = data;
|
2022-06-03 13:37:30 +08:00
|
|
|
int error = 0;
|
|
|
|
|
|
|
|
if (XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) ||
|
|
|
|
(rec->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK))) {
|
2022-10-04 13:40:01 +08:00
|
|
|
notify->want_shutdown = true;
|
|
|
|
return 0;
|
2022-06-03 13:37:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get files that incore, filter out others that are not in use. */
|
|
|
|
error = xfs_iget(mp, cur->bc_tp, rec->rm_owner, XFS_IGET_INCORE,
|
|
|
|
0, &ip);
|
|
|
|
/* Continue the rmap query if the inode isn't incore */
|
|
|
|
if (error == -ENODATA)
|
|
|
|
return 0;
|
2022-10-04 13:40:01 +08:00
|
|
|
if (error) {
|
|
|
|
notify->want_shutdown = true;
|
|
|
|
return 0;
|
|
|
|
}
|
2022-06-03 13:37:30 +08:00
|
|
|
|
|
|
|
error = mf_dax_kill_procs(VFS_I(ip)->i_mapping,
|
|
|
|
xfs_failure_pgoff(mp, rec, notify),
|
|
|
|
xfs_failure_pgcnt(mp, rec, notify),
|
|
|
|
notify->mf_flags);
|
|
|
|
xfs_irele(ip);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xfs_dax_notify_ddev_failure(
|
|
|
|
struct xfs_mount *mp,
|
|
|
|
xfs_daddr_t daddr,
|
|
|
|
xfs_daddr_t bblen,
|
|
|
|
int mf_flags)
|
|
|
|
{
|
2022-10-04 13:40:01 +08:00
|
|
|
struct xfs_failure_info notify = { .mf_flags = mf_flags };
|
2022-06-03 13:37:30 +08:00
|
|
|
struct xfs_trans *tp = NULL;
|
|
|
|
struct xfs_btree_cur *cur = NULL;
|
|
|
|
struct xfs_buf *agf_bp = NULL;
|
|
|
|
int error = 0;
|
|
|
|
xfs_fsblock_t fsbno = XFS_DADDR_TO_FSB(mp, daddr);
|
|
|
|
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, fsbno);
|
2023-06-30 08:40:30 +08:00
|
|
|
xfs_fsblock_t end_fsbno = XFS_DADDR_TO_FSB(mp,
|
|
|
|
daddr + bblen - 1);
|
2022-06-03 13:37:30 +08:00
|
|
|
xfs_agnumber_t end_agno = XFS_FSB_TO_AGNO(mp, end_fsbno);
|
|
|
|
|
|
|
|
error = xfs_trans_alloc_empty(mp, &tp);
|
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
for (; agno <= end_agno; agno++) {
|
|
|
|
struct xfs_rmap_irec ri_low = { };
|
|
|
|
struct xfs_rmap_irec ri_high;
|
|
|
|
struct xfs_agf *agf;
|
|
|
|
xfs_agblock_t agend;
|
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve latency
and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCYuravgAKCRDdBJ7gKXxA
jpqSAQDrXSdII+ht9kSHlaCVYjqRFQz/rRvURQrWQV74f6aeiAD+NHHeDPwZn11/
SPktqEUrF1pxnGQxqLh1kUFUhsVZQgE=
=w/UH
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Most of the MM queue. A few things are still pending.
Liam's maple tree rework didn't make it. This has resulted in a few
other minor patch series being held over for next time.
Multi-gen LRU still isn't merged as we were waiting for mapletree to
stabilize. The current plan is to merge MGLRU into -mm soon and to
later reintroduce mapletree, with a view to hopefully getting both
into 6.1-rc1.
Summary:
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve
latency and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place"
[ XFS merge from hell as per Darrick Wong in
https://lore.kernel.org/all/YshKnxb4VwXycPO8@magnolia/ ]
* tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (282 commits)
tools/testing/selftests/vm/hmm-tests.c: fix build
mm: Kconfig: fix typo
mm: memory-failure: convert to pr_fmt()
mm: use is_zone_movable_page() helper
hugetlbfs: fix inaccurate comment in hugetlbfs_statfs()
hugetlbfs: cleanup some comments in inode.c
hugetlbfs: remove unneeded header file
hugetlbfs: remove unneeded hugetlbfs_ops forward declaration
hugetlbfs: use helper macro SZ_1{K,M}
mm: cleanup is_highmem()
mm/hmm: add a test for cross device private faults
selftests: add soft-dirty into run_vmtests.sh
selftests: soft-dirty: add test for mprotect
mm/mprotect: fix soft-dirty check in can_change_pte_writable()
mm: memcontrol: fix potential oom_lock recursion deadlock
mm/gup.c: fix formatting in check_and_migrate_movable_page()
xfs: fail dax mount if reflink is enabled on a partition
mm/memcontrol.c: remove the redundant updating of stats_flush_threshold
userfaultfd: don't fail on unrecognized features
hugetlb_cgroup: fix wrong hugetlb cgroup numa stat
...
2022-08-06 07:32:45 +08:00
|
|
|
struct xfs_perag *pag;
|
2022-06-03 13:37:30 +08:00
|
|
|
|
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve latency
and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCYuravgAKCRDdBJ7gKXxA
jpqSAQDrXSdII+ht9kSHlaCVYjqRFQz/rRvURQrWQV74f6aeiAD+NHHeDPwZn11/
SPktqEUrF1pxnGQxqLh1kUFUhsVZQgE=
=w/UH
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Most of the MM queue. A few things are still pending.
Liam's maple tree rework didn't make it. This has resulted in a few
other minor patch series being held over for next time.
Multi-gen LRU still isn't merged as we were waiting for mapletree to
stabilize. The current plan is to merge MGLRU into -mm soon and to
later reintroduce mapletree, with a view to hopefully getting both
into 6.1-rc1.
Summary:
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve
latency and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place"
[ XFS merge from hell as per Darrick Wong in
https://lore.kernel.org/all/YshKnxb4VwXycPO8@magnolia/ ]
* tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (282 commits)
tools/testing/selftests/vm/hmm-tests.c: fix build
mm: Kconfig: fix typo
mm: memory-failure: convert to pr_fmt()
mm: use is_zone_movable_page() helper
hugetlbfs: fix inaccurate comment in hugetlbfs_statfs()
hugetlbfs: cleanup some comments in inode.c
hugetlbfs: remove unneeded header file
hugetlbfs: remove unneeded hugetlbfs_ops forward declaration
hugetlbfs: use helper macro SZ_1{K,M}
mm: cleanup is_highmem()
mm/hmm: add a test for cross device private faults
selftests: add soft-dirty into run_vmtests.sh
selftests: soft-dirty: add test for mprotect
mm/mprotect: fix soft-dirty check in can_change_pte_writable()
mm: memcontrol: fix potential oom_lock recursion deadlock
mm/gup.c: fix formatting in check_and_migrate_movable_page()
xfs: fail dax mount if reflink is enabled on a partition
mm/memcontrol.c: remove the redundant updating of stats_flush_threshold
userfaultfd: don't fail on unrecognized features
hugetlb_cgroup: fix wrong hugetlb cgroup numa stat
...
2022-08-06 07:32:45 +08:00
|
|
|
pag = xfs_perag_get(mp, agno);
|
|
|
|
error = xfs_alloc_read_agf(pag, tp, 0, &agf_bp);
|
|
|
|
if (error) {
|
|
|
|
xfs_perag_put(pag);
|
2022-06-03 13:37:30 +08:00
|
|
|
break;
|
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve latency
and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCYuravgAKCRDdBJ7gKXxA
jpqSAQDrXSdII+ht9kSHlaCVYjqRFQz/rRvURQrWQV74f6aeiAD+NHHeDPwZn11/
SPktqEUrF1pxnGQxqLh1kUFUhsVZQgE=
=w/UH
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Most of the MM queue. A few things are still pending.
Liam's maple tree rework didn't make it. This has resulted in a few
other minor patch series being held over for next time.
Multi-gen LRU still isn't merged as we were waiting for mapletree to
stabilize. The current plan is to merge MGLRU into -mm soon and to
later reintroduce mapletree, with a view to hopefully getting both
into 6.1-rc1.
Summary:
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve
latency and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place"
[ XFS merge from hell as per Darrick Wong in
https://lore.kernel.org/all/YshKnxb4VwXycPO8@magnolia/ ]
* tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (282 commits)
tools/testing/selftests/vm/hmm-tests.c: fix build
mm: Kconfig: fix typo
mm: memory-failure: convert to pr_fmt()
mm: use is_zone_movable_page() helper
hugetlbfs: fix inaccurate comment in hugetlbfs_statfs()
hugetlbfs: cleanup some comments in inode.c
hugetlbfs: remove unneeded header file
hugetlbfs: remove unneeded hugetlbfs_ops forward declaration
hugetlbfs: use helper macro SZ_1{K,M}
mm: cleanup is_highmem()
mm/hmm: add a test for cross device private faults
selftests: add soft-dirty into run_vmtests.sh
selftests: soft-dirty: add test for mprotect
mm/mprotect: fix soft-dirty check in can_change_pte_writable()
mm: memcontrol: fix potential oom_lock recursion deadlock
mm/gup.c: fix formatting in check_and_migrate_movable_page()
xfs: fail dax mount if reflink is enabled on a partition
mm/memcontrol.c: remove the redundant updating of stats_flush_threshold
userfaultfd: don't fail on unrecognized features
hugetlb_cgroup: fix wrong hugetlb cgroup numa stat
...
2022-08-06 07:32:45 +08:00
|
|
|
}
|
2022-06-03 13:37:30 +08:00
|
|
|
|
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve latency
and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCYuravgAKCRDdBJ7gKXxA
jpqSAQDrXSdII+ht9kSHlaCVYjqRFQz/rRvURQrWQV74f6aeiAD+NHHeDPwZn11/
SPktqEUrF1pxnGQxqLh1kUFUhsVZQgE=
=w/UH
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Most of the MM queue. A few things are still pending.
Liam's maple tree rework didn't make it. This has resulted in a few
other minor patch series being held over for next time.
Multi-gen LRU still isn't merged as we were waiting for mapletree to
stabilize. The current plan is to merge MGLRU into -mm soon and to
later reintroduce mapletree, with a view to hopefully getting both
into 6.1-rc1.
Summary:
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve
latency and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place"
[ XFS merge from hell as per Darrick Wong in
https://lore.kernel.org/all/YshKnxb4VwXycPO8@magnolia/ ]
* tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (282 commits)
tools/testing/selftests/vm/hmm-tests.c: fix build
mm: Kconfig: fix typo
mm: memory-failure: convert to pr_fmt()
mm: use is_zone_movable_page() helper
hugetlbfs: fix inaccurate comment in hugetlbfs_statfs()
hugetlbfs: cleanup some comments in inode.c
hugetlbfs: remove unneeded header file
hugetlbfs: remove unneeded hugetlbfs_ops forward declaration
hugetlbfs: use helper macro SZ_1{K,M}
mm: cleanup is_highmem()
mm/hmm: add a test for cross device private faults
selftests: add soft-dirty into run_vmtests.sh
selftests: soft-dirty: add test for mprotect
mm/mprotect: fix soft-dirty check in can_change_pte_writable()
mm: memcontrol: fix potential oom_lock recursion deadlock
mm/gup.c: fix formatting in check_and_migrate_movable_page()
xfs: fail dax mount if reflink is enabled on a partition
mm/memcontrol.c: remove the redundant updating of stats_flush_threshold
userfaultfd: don't fail on unrecognized features
hugetlb_cgroup: fix wrong hugetlb cgroup numa stat
...
2022-08-06 07:32:45 +08:00
|
|
|
cur = xfs_rmapbt_init_cursor(mp, tp, agf_bp, pag);
|
2022-06-03 13:37:30 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the rmap range from ri_low to ri_high, which represents
|
|
|
|
* a [start, end] where we looking for the files or metadata.
|
|
|
|
*/
|
|
|
|
memset(&ri_high, 0xFF, sizeof(ri_high));
|
|
|
|
ri_low.rm_startblock = XFS_FSB_TO_AGBNO(mp, fsbno);
|
|
|
|
if (agno == end_agno)
|
|
|
|
ri_high.rm_startblock = XFS_FSB_TO_AGBNO(mp, end_fsbno);
|
|
|
|
|
|
|
|
agf = agf_bp->b_addr;
|
|
|
|
agend = min(be32_to_cpu(agf->agf_length),
|
|
|
|
ri_high.rm_startblock);
|
|
|
|
notify.startblock = ri_low.rm_startblock;
|
|
|
|
notify.blockcount = agend - ri_low.rm_startblock;
|
|
|
|
|
|
|
|
error = xfs_rmap_query_range(cur, &ri_low, &ri_high,
|
|
|
|
xfs_dax_failure_fn, ¬ify);
|
|
|
|
xfs_btree_del_cursor(cur, error);
|
|
|
|
xfs_trans_brelse(tp, agf_bp);
|
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve latency
and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCYuravgAKCRDdBJ7gKXxA
jpqSAQDrXSdII+ht9kSHlaCVYjqRFQz/rRvURQrWQV74f6aeiAD+NHHeDPwZn11/
SPktqEUrF1pxnGQxqLh1kUFUhsVZQgE=
=w/UH
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull MM updates from Andrew Morton:
"Most of the MM queue. A few things are still pending.
Liam's maple tree rework didn't make it. This has resulted in a few
other minor patch series being held over for next time.
Multi-gen LRU still isn't merged as we were waiting for mapletree to
stabilize. The current plan is to merge MGLRU into -mm soon and to
later reintroduce mapletree, with a view to hopefully getting both
into 6.1-rc1.
Summary:
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve
latency and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place"
[ XFS merge from hell as per Darrick Wong in
https://lore.kernel.org/all/YshKnxb4VwXycPO8@magnolia/ ]
* tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (282 commits)
tools/testing/selftests/vm/hmm-tests.c: fix build
mm: Kconfig: fix typo
mm: memory-failure: convert to pr_fmt()
mm: use is_zone_movable_page() helper
hugetlbfs: fix inaccurate comment in hugetlbfs_statfs()
hugetlbfs: cleanup some comments in inode.c
hugetlbfs: remove unneeded header file
hugetlbfs: remove unneeded hugetlbfs_ops forward declaration
hugetlbfs: use helper macro SZ_1{K,M}
mm: cleanup is_highmem()
mm/hmm: add a test for cross device private faults
selftests: add soft-dirty into run_vmtests.sh
selftests: soft-dirty: add test for mprotect
mm/mprotect: fix soft-dirty check in can_change_pte_writable()
mm: memcontrol: fix potential oom_lock recursion deadlock
mm/gup.c: fix formatting in check_and_migrate_movable_page()
xfs: fail dax mount if reflink is enabled on a partition
mm/memcontrol.c: remove the redundant updating of stats_flush_threshold
userfaultfd: don't fail on unrecognized features
hugetlb_cgroup: fix wrong hugetlb cgroup numa stat
...
2022-08-06 07:32:45 +08:00
|
|
|
xfs_perag_put(pag);
|
2022-06-03 13:37:30 +08:00
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
|
|
|
|
fsbno = XFS_AGB_TO_FSB(mp, agno + 1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
xfs_trans_cancel(tp);
|
2022-10-04 13:40:01 +08:00
|
|
|
if (error || notify.want_shutdown) {
|
|
|
|
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
|
|
|
|
if (!error)
|
|
|
|
error = -EFSCORRUPTED;
|
|
|
|
}
|
2022-06-03 13:37:30 +08:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xfs_dax_notify_failure(
|
|
|
|
struct dax_device *dax_dev,
|
|
|
|
u64 offset,
|
|
|
|
u64 len,
|
|
|
|
int mf_flags)
|
|
|
|
{
|
|
|
|
struct xfs_mount *mp = dax_holder(dax_dev);
|
|
|
|
u64 ddev_start;
|
|
|
|
u64 ddev_end;
|
|
|
|
|
2022-08-27 01:18:01 +08:00
|
|
|
if (!(mp->m_super->s_flags & SB_BORN)) {
|
2022-06-03 13:37:30 +08:00
|
|
|
xfs_warn(mp, "filesystem is not ready for notify_failure()!");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mp->m_rtdev_targp && mp->m_rtdev_targp->bt_daxdev == dax_dev) {
|
2022-08-27 01:17:54 +08:00
|
|
|
xfs_debug(mp,
|
2022-06-03 13:37:30 +08:00
|
|
|
"notify_failure() not supported on realtime device!");
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mp->m_logdev_targp && mp->m_logdev_targp->bt_daxdev == dax_dev &&
|
|
|
|
mp->m_logdev_targp != mp->m_ddev_targp) {
|
|
|
|
xfs_err(mp, "ondisk log corrupt, shutting down fs!");
|
|
|
|
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
|
|
|
|
return -EFSCORRUPTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!xfs_has_rmapbt(mp)) {
|
2022-08-27 01:17:54 +08:00
|
|
|
xfs_debug(mp, "notify_failure() needs rmapbt enabled!");
|
2022-06-03 13:37:30 +08:00
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
ddev_start = mp->m_ddev_targp->bt_dax_part_off;
|
|
|
|
ddev_end = ddev_start + bdev_nr_bytes(mp->m_ddev_targp->bt_bdev) - 1;
|
|
|
|
|
|
|
|
/* Ignore the range out of filesystem area */
|
2023-06-30 08:40:30 +08:00
|
|
|
if (offset + len - 1 < ddev_start)
|
2022-06-03 13:37:30 +08:00
|
|
|
return -ENXIO;
|
|
|
|
if (offset > ddev_end)
|
|
|
|
return -ENXIO;
|
|
|
|
|
|
|
|
/* Calculate the real range when it touches the boundary */
|
|
|
|
if (offset > ddev_start)
|
|
|
|
offset -= ddev_start;
|
|
|
|
else {
|
|
|
|
len -= ddev_start - offset;
|
|
|
|
offset = 0;
|
|
|
|
}
|
2023-06-30 08:40:30 +08:00
|
|
|
if (offset + len - 1 > ddev_end)
|
|
|
|
len = ddev_end - offset + 1;
|
2022-06-03 13:37:30 +08:00
|
|
|
|
|
|
|
return xfs_dax_notify_ddev_failure(mp, BTOBB(offset), BTOBB(len),
|
|
|
|
mf_flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct dax_holder_operations xfs_dax_holder_operations = {
|
|
|
|
.notify_failure = xfs_dax_notify_failure,
|
|
|
|
};
|