2022-08-04 07:55:34

by Hao Lee

[permalink] [raw]
Subject: [PATCH] mm: add DEVICE_ZONE to FOR_ALL_ZONES

FOR_ALL_ZONES should be consistent with enum zone_type. Otherwise,
__count_zid_vm_events have the potential to add count to wrong
item when zid is ZONE_DEVICE.

Signed-off-by: Hao Lee <[email protected]>
---
include/linux/vm_event_item.h | 9 ++++++++-
mm/vmstat.c | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 7b2363388bfa..bcd57ab55413 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -20,7 +20,14 @@
#define HIGHMEM_ZONE(xx)
#endif

-#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, HIGHMEM_ZONE(xx) xx##_MOVABLE
+#ifdef CONFIG_ZONE_DEVICE
+#define DEVICE_ZONE(xx) xx##_DEVICE
+#else
+#define DEVICE_ZONE(xx)
+#endif
+
+#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
+ HIGHMEM_ZONE(xx) xx##_MOVABLE, DEVICE_ZONE(xx))

enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
FOR_ALL_ZONES(PGALLOC),
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 4057372745d0..5ccaeac44e61 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1167,8 +1167,15 @@ int fragmentation_index(struct zone *zone, unsigned int order)
#define TEXT_FOR_HIGHMEM(xx)
#endif

+#ifdef CONFIG_ZONE_DEVICE
+#define TEXT_FOR_DEVICE(xx) xx "_device",
+#else
+#define TEXT_FOR_DEVICE(xx)
+#endif
+
#define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx "_normal", \
- TEXT_FOR_HIGHMEM(xx) xx "_movable",
+ TEXT_FOR_HIGHMEM(xx) xx "_movable", \
+ TEXT_FOR_DEVICE(xx)

const char * const vmstat_text[] = {
/* enum zone_stat_item counters */
--
2.35.1



2022-08-07 08:50:57

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] mm: add DEVICE_ZONE to FOR_ALL_ZONES

Hi Hao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on akpm-mm/mm-everything]

url: https://github.com/intel-lab-lkp/linux/commits/Hao-Lee/mm-add-DEVICE_ZONE-to-FOR_ALL_ZONES/20220804-154805
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: ia64-tiger_defconfig (https://download.01.org/0day-ci/archive/20220807/[email protected]/config)
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/dba18359aee97f43008e19ffa78421e652b1b102
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Hao-Lee/mm-add-DEVICE_ZONE-to-FOR_ALL_ZONES/20220804-154805
git checkout dba18359aee97f43008e19ffa78421e652b1b102
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

In file included from include/linux/vmstat.h:8,
from include/linux/mm.h:1668,
from include/linux/dax.h:6,
from mm/filemap.c:15:
include/linux/vm_event_item.h:29:27: error: expected identifier before '(' token
29 | #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
| ^
include/linux/vm_event_item.h:33:17: note: in expansion of macro 'FOR_ALL_ZONES'
33 | FOR_ALL_ZONES(PGALLOC),
| ^~~~~~~~~~~~~
include/linux/vmstat.h:55:29: error: 'NR_VM_EVENT_ITEMS' undeclared here (not in a function); did you mean 'NR_VM_NUMA_EVENT_ITEMS'?
55 | unsigned long event[NR_VM_EVENT_ITEMS];
| ^~~~~~~~~~~~~~~~~
| NR_VM_NUMA_EVENT_ITEMS
include/linux/vmstat.h: In function '__count_vm_event':
include/linux/vmstat.h:64:56: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
64 | static inline void __count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_event':
include/linux/vmstat.h:69:54: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
69 | static inline void count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function '__count_vm_events':
include/linux/vmstat.h:74:57: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
74 | static inline void __count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_events':
include/linux/vmstat.h:79:55: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
79 | static inline void count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
mm/filemap.c: In function 'filemap_fault':
>> mm/filemap.c:3139:32: error: 'PGMAJFAULT' undeclared (first use in this function)
3139 | count_vm_event(PGMAJFAULT);
| ^~~~~~~~~~
mm/filemap.c:3139:32: note: each undeclared identifier is reported only once for each function it appears in
--
In file included from include/linux/vmstat.h:8,
from include/linux/mm.h:1668,
from include/linux/oom.h:11,
from mm/oom_kill.c:21:
include/linux/vm_event_item.h:29:27: error: expected identifier before '(' token
29 | #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
| ^
include/linux/vm_event_item.h:33:17: note: in expansion of macro 'FOR_ALL_ZONES'
33 | FOR_ALL_ZONES(PGALLOC),
| ^~~~~~~~~~~~~
include/linux/vmstat.h:55:29: error: 'NR_VM_EVENT_ITEMS' undeclared here (not in a function); did you mean 'NR_VM_NUMA_EVENT_ITEMS'?
55 | unsigned long event[NR_VM_EVENT_ITEMS];
| ^~~~~~~~~~~~~~~~~
| NR_VM_NUMA_EVENT_ITEMS
include/linux/vmstat.h: In function '__count_vm_event':
include/linux/vmstat.h:64:56: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
64 | static inline void __count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_event':
include/linux/vmstat.h:69:54: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
69 | static inline void count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function '__count_vm_events':
include/linux/vmstat.h:74:57: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
74 | static inline void __count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_events':
include/linux/vmstat.h:79:55: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
79 | static inline void count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
mm/oom_kill.c: In function '__oom_kill_process':
>> mm/oom_kill.c:940:24: error: 'OOM_KILL' undeclared (first use in this function)
940 | count_vm_event(OOM_KILL);
| ^~~~~~~~
mm/oom_kill.c:940:24: note: each undeclared identifier is reported only once for each function it appears in
--
In file included from include/linux/vmstat.h:8,
from include/linux/mm.h:1668,
from mm/swap.c:17:
include/linux/vm_event_item.h:29:27: error: expected identifier before '(' token
29 | #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
| ^
include/linux/vm_event_item.h:33:17: note: in expansion of macro 'FOR_ALL_ZONES'
33 | FOR_ALL_ZONES(PGALLOC),
| ^~~~~~~~~~~~~
include/linux/vmstat.h:55:29: error: 'NR_VM_EVENT_ITEMS' undeclared here (not in a function); did you mean 'NR_VM_NUMA_EVENT_ITEMS'?
55 | unsigned long event[NR_VM_EVENT_ITEMS];
| ^~~~~~~~~~~~~~~~~
| NR_VM_NUMA_EVENT_ITEMS
include/linux/vmstat.h: In function '__count_vm_event':
include/linux/vmstat.h:64:56: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
64 | static inline void __count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_event':
include/linux/vmstat.h:69:54: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
69 | static inline void count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function '__count_vm_events':
include/linux/vmstat.h:74:57: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
74 | static inline void __count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_events':
include/linux/vmstat.h:79:55: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
79 | static inline void count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
mm/swap.c: In function '__page_cache_release':
>> mm/swap.c:97:33: error: 'UNEVICTABLE_PGCLEARED' undeclared (first use in this function)
97 | count_vm_events(UNEVICTABLE_PGCLEARED, nr_pages);
| ^~~~~~~~~~~~~~~~~~~~~
mm/swap.c:97:33: note: each undeclared identifier is reported only once for each function it appears in
mm/swap.c: In function 'lru_add_fn':
>> mm/swap.c:212:43: error: 'UNEVICTABLE_PGRESCUED' undeclared (first use in this function)
212 | __count_vm_events(UNEVICTABLE_PGRESCUED, nr_pages);
| ^~~~~~~~~~~~~~~~~~~~~
>> mm/swap.c:225:43: error: 'UNEVICTABLE_PGCULLED' undeclared (first use in this function)
225 | __count_vm_events(UNEVICTABLE_PGCULLED, nr_pages);
| ^~~~~~~~~~~~~~~~~~~~
mm/swap.c: In function 'lru_move_tail_fn':
>> mm/swap.c:272:35: error: 'PGROTATED' undeclared (first use in this function)
272 | __count_vm_events(PGROTATED, folio_nr_pages(folio));
| ^~~~~~~~~
mm/swap.c: In function 'folio_activate_fn':
>> mm/swap.c:354:35: error: 'PGACTIVATE' undeclared (first use in this function); did you mean 'SWP_ACTIVATED'?
354 | __count_vm_events(PGACTIVATE, nr_pages);
| ^~~~~~~~~~
| SWP_ACTIVATED
mm/swap.c: In function 'lru_deactivate_file_fn':
mm/swap.c:566:35: error: 'PGROTATED' undeclared (first use in this function)
566 | __count_vm_events(PGROTATED, nr_pages);
| ^~~~~~~~~
>> mm/swap.c:570:35: error: 'PGDEACTIVATE' undeclared (first use in this function)
570 | __count_vm_events(PGDEACTIVATE, nr_pages);
| ^~~~~~~~~~~~
mm/swap.c: In function 'lru_deactivate_fn':
mm/swap.c:586:35: error: 'PGDEACTIVATE' undeclared (first use in this function)
586 | __count_vm_events(PGDEACTIVATE, nr_pages);
| ^~~~~~~~~~~~
mm/swap.c: In function 'lru_lazyfree_fn':
>> mm/swap.c:609:35: error: 'PGLAZYFREE' undeclared (first use in this function)
609 | __count_vm_events(PGLAZYFREE, nr_pages);
| ^~~~~~~~~~
mm/swap.c: In function 'release_pages':
mm/swap.c:1003:40: error: 'UNEVICTABLE_PGCLEARED' undeclared (first use in this function)
1003 | count_vm_event(UNEVICTABLE_PGCLEARED);
| ^~~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/vmstat.h:8,
from include/linux/mm.h:1668,
from mm/vmscan.c:15:
include/linux/vm_event_item.h:29:27: error: expected identifier before '(' token
29 | #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
| ^
include/linux/vm_event_item.h:33:17: note: in expansion of macro 'FOR_ALL_ZONES'
33 | FOR_ALL_ZONES(PGALLOC),
| ^~~~~~~~~~~~~
include/linux/vmstat.h:55:29: error: 'NR_VM_EVENT_ITEMS' undeclared here (not in a function); did you mean 'NR_VM_NUMA_EVENT_ITEMS'?
55 | unsigned long event[NR_VM_EVENT_ITEMS];
| ^~~~~~~~~~~~~~~~~
| NR_VM_NUMA_EVENT_ITEMS
include/linux/vmstat.h: In function '__count_vm_event':
include/linux/vmstat.h:64:56: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
64 | static inline void __count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_event':
include/linux/vmstat.h:69:54: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
69 | static inline void count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function '__count_vm_events':
include/linux/vmstat.h:74:57: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
74 | static inline void __count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_events':
include/linux/vmstat.h:79:55: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
79 | static inline void count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
mm/vmscan.c: In function 'do_shrink_slab':
>> mm/vmscan.c:836:33: error: 'SLABS_SCANNED' undeclared (first use in this function)
836 | count_vm_events(SLABS_SCANNED, shrinkctl->nr_scanned);
| ^~~~~~~~~~~~~
mm/vmscan.c:836:33: note: each undeclared identifier is reported only once for each function it appears in
mm/vmscan.c: In function 'demote_page_list':
>> mm/vmscan.c:1563:35: error: 'PGDEMOTE_KSWAPD' undeclared (first use in this function)
1563 | __count_vm_events(PGDEMOTE_KSWAPD, nr_succeeded);
| ^~~~~~~~~~~~~~~
>> mm/vmscan.c:1565:35: error: 'PGDEMOTE_DIRECT' undeclared (first use in this function)
1565 | __count_vm_events(PGDEMOTE_DIRECT, nr_succeeded);
| ^~~~~~~~~~~~~~~
mm/vmscan.c: In function 'shrink_page_list':
>> mm/vmscan.c:1971:41: error: 'PGLAZYFREED' undeclared (first use in this function)
1971 | count_vm_events(PGLAZYFREED, nr_pages);
| ^~~~~~~~~~~
>> mm/vmscan.c:2015:57: error: 'PGACTIVATE' undeclared (first use in this function); did you mean 'PAGE_ACTIVATE'?
2015 | count_memcg_folio_events(folio, PGACTIVATE, nr_pages);
| ^~~~~~~~~~
| PAGE_ACTIVATE
mm/vmscan.c: In function 'isolate_lru_pages':
>> mm/vmscan.c:2219:47: error: 'PGSCAN_SKIP_NORMAL' undeclared (first use in this function)
2219 | __count_zid_vm_events(PGSCAN_SKIP, zid, nr_skipped[zid]);
| ^~~~~~~~~~~
include/linux/vmstat.h:135:27: note: in definition of macro '__count_zid_vm_events'
135 | __count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta)
| ^~~~
mm/vmscan.c: In function 'shrink_inactive_list':
>> mm/vmscan.c:2436:38: error: 'PGSCAN_KSWAPD' undeclared (first use in this function); did you mean 'PF_KSWAPD'?
2436 | item = current_is_kswapd() ? PGSCAN_KSWAPD : PGSCAN_DIRECT;
| ^~~~~~~~~~~~~
| PF_KSWAPD
>> mm/vmscan.c:2436:54: error: 'PGSCAN_DIRECT' undeclared (first use in this function); did you mean 'IOCB_DIRECT'?
2436 | item = current_is_kswapd() ? PGSCAN_KSWAPD : PGSCAN_DIRECT;
| ^~~~~~~~~~~~~
| IOCB_DIRECT
>> mm/vmscan.c:2440:27: error: 'PGSCAN_ANON' undeclared (first use in this function)
2440 | __count_vm_events(PGSCAN_ANON + file, nr_scanned);
| ^~~~~~~~~~~
>> mm/vmscan.c:2453:38: error: 'PGSTEAL_KSWAPD' undeclared (first use in this function)
2453 | item = current_is_kswapd() ? PGSTEAL_KSWAPD : PGSTEAL_DIRECT;
| ^~~~~~~~~~~~~~
>> mm/vmscan.c:2453:55: error: 'PGSTEAL_DIRECT' undeclared (first use in this function)
2453 | item = current_is_kswapd() ? PGSTEAL_KSWAPD : PGSTEAL_DIRECT;
| ^~~~~~~~~~~~~~
>> mm/vmscan.c:2457:27: error: 'PGSTEAL_ANON' undeclared (first use in this function)
2457 | __count_vm_events(PGSTEAL_ANON + file, nr_reclaimed);
| ^~~~~~~~~~~~
mm/vmscan.c: In function 'shrink_active_list':
>> mm/vmscan.c:2535:35: error: 'PGREFILL' undeclared (first use in this function)
2535 | __count_vm_events(PGREFILL, nr_scanned);
| ^~~~~~~~
>> mm/vmscan.c:2594:27: error: 'PGDEACTIVATE' undeclared (first use in this function); did you mean 'PAGE_ACTIVATE'?
2594 | __count_vm_events(PGDEACTIVATE, nr_deactivate);
| ^~~~~~~~~~~~
| PAGE_ACTIVATE
mm/vmscan.c: In function 'do_try_to_free_pages':
>> mm/vmscan.c:3592:39: error: 'ALLOCSTALL_NORMAL' undeclared (first use in this function)
3592 | __count_zid_vm_events(ALLOCSTALL, sc->reclaim_idx, 1);
| ^~~~~~~~~~
include/linux/vmstat.h:135:27: note: in definition of macro '__count_zid_vm_events'
135 | __count_vm_events(item##_NORMAL - ZONE_NORMAL + zid, delta)
| ^~~~
mm/vmscan.c: In function 'throttle_direct_reclaim':
>> mm/vmscan.c:3774:24: error: 'PGSCAN_DIRECT_THROTTLE' undeclared (first use in this function)
3774 | count_vm_event(PGSCAN_DIRECT_THROTTLE);
| ^~~~~~~~~~~~~~~~~~~~~~
mm/vmscan.c: In function 'balance_pgdat':
>> mm/vmscan.c:4164:24: error: 'PAGEOUTRUN' undeclared (first use in this function)
4164 | count_vm_event(PAGEOUTRUN);
| ^~~~~~~~~~
mm/vmscan.c: In function 'kswapd_try_to_sleep':
>> mm/vmscan.c:4447:40: error: 'KSWAPD_LOW_WMARK_HIT_QUICKLY' undeclared (first use in this function)
4447 | count_vm_event(KSWAPD_LOW_WMARK_HIT_QUICKLY);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> mm/vmscan.c:4449:40: error: 'KSWAPD_HIGH_WMARK_HIT_QUICKLY' undeclared (first use in this function)
4449 | count_vm_event(KSWAPD_HIGH_WMARK_HIT_QUICKLY);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/vmscan.c: In function 'node_reclaim':
>> mm/vmscan.c:4847:32: error: 'PGSCAN_ZONE_RECLAIM_FAILED' undeclared (first use in this function)
4847 | count_vm_event(PGSCAN_ZONE_RECLAIM_FAILED);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
mm/vmscan.c: In function 'check_move_unevictable_pages':
mm/vmscan.c:4895:35: error: 'UNEVICTABLE_PGRESCUED' undeclared (first use in this function)
4895 | __count_vm_events(UNEVICTABLE_PGRESCUED, pgrescued);
| ^~~~~~~~~~~~~~~~~~~~~
mm/vmscan.c:4896:35: error: 'UNEVICTABLE_PGSCANNED' undeclared (first use in this function)
4896 | __count_vm_events(UNEVICTABLE_PGSCANNED, pgscanned);
| ^~~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/vmstat.h:8,
from include/linux/mm.h:1668,
from include/linux/security.h:33,
from include/linux/fs_context.h:14,
from include/linux/fs_parser.h:11,
from include/linux/ramfs.h:5,
from mm/shmem.c:28:
include/linux/vm_event_item.h:29:27: error: expected identifier before '(' token
29 | #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
| ^
include/linux/vm_event_item.h:33:17: note: in expansion of macro 'FOR_ALL_ZONES'
33 | FOR_ALL_ZONES(PGALLOC),
| ^~~~~~~~~~~~~
include/linux/vmstat.h:55:29: error: 'NR_VM_EVENT_ITEMS' undeclared here (not in a function); did you mean 'NR_VM_NUMA_EVENT_ITEMS'?
55 | unsigned long event[NR_VM_EVENT_ITEMS];
| ^~~~~~~~~~~~~~~~~
| NR_VM_NUMA_EVENT_ITEMS
include/linux/vmstat.h: In function '__count_vm_event':
include/linux/vmstat.h:64:56: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
64 | static inline void __count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_event':
include/linux/vmstat.h:69:54: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
69 | static inline void count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function '__count_vm_events':
include/linux/vmstat.h:74:57: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
74 | static inline void __count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_events':
include/linux/vmstat.h:79:55: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
79 | static inline void count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
mm/shmem.c: In function 'shmem_swapin_folio':
>> mm/shmem.c:1750:40: error: 'PGMAJFAULT' undeclared (first use in this function)
1750 | count_vm_event(PGMAJFAULT);
| ^~~~~~~~~~
mm/shmem.c:1750:40: note: each undeclared identifier is reported only once for each function it appears in
--
In file included from include/linux/memcontrol.h:14,
from include/linux/swap.h:9,
from mm/compaction.c:12:
include/linux/vm_event_item.h:29:27: error: expected identifier before '(' token
29 | #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
| ^
include/linux/vm_event_item.h:33:17: note: in expansion of macro 'FOR_ALL_ZONES'
33 | FOR_ALL_ZONES(PGALLOC),
| ^~~~~~~~~~~~~
In file included from include/linux/mm.h:1668,
from include/linux/memcontrol.h:20:
include/linux/vmstat.h:55:29: error: 'NR_VM_EVENT_ITEMS' undeclared here (not in a function); did you mean 'NR_VM_NUMA_EVENT_ITEMS'?
55 | unsigned long event[NR_VM_EVENT_ITEMS];
| ^~~~~~~~~~~~~~~~~
| NR_VM_NUMA_EVENT_ITEMS
include/linux/vmstat.h: In function '__count_vm_event':
include/linux/vmstat.h:64:56: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
64 | static inline void __count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_event':
include/linux/vmstat.h:69:54: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
69 | static inline void count_vm_event(enum vm_event_item item)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function '__count_vm_events':
include/linux/vmstat.h:74:57: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
74 | static inline void __count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
include/linux/vmstat.h: In function 'count_vm_events':
include/linux/vmstat.h:79:55: warning: parameter 'item' set but not used [-Wunused-but-set-parameter]
79 | static inline void count_vm_events(enum vm_event_item item, long delta)
| ~~~~~~~~~~~~~~~~~~~^~~~
mm/compaction.c: In function 'isolate_freepages_block':
>> mm/compaction.c:667:38: error: 'COMPACTISOLATED' undeclared (first use in this function); did you mean 'COMPACT_SKIPPED'?
667 | count_compact_events(COMPACTISOLATED, total_isolated);
| ^~~~~~~~~~~~~~~
| COMPACT_SKIPPED
mm/compaction.c:667:38: note: each undeclared identifier is reported only once for each function it appears in
mm/compaction.c: In function 'isolate_migratepages_block':
mm/compaction.c:1198:38: error: 'COMPACTISOLATED' undeclared (first use in this function); did you mean 'COMPACT_SKIPPED'?
1198 | count_compact_events(COMPACTISOLATED, nr_isolated);
| ^~~~~~~~~~~~~~~
| COMPACT_SKIPPED
mm/compaction.c: In function 'fast_isolate_freepages':
mm/compaction.c:1512:54: error: 'COMPACTISOLATED' undeclared (first use in this function); did you mean 'COMPACT_SKIPPED'?
1512 | count_compact_events(COMPACTISOLATED, nr_isolated);
| ^~~~~~~~~~~~~~~
| COMPACT_SKIPPED
mm/compaction.c: In function 'compact_zone':
>> mm/compaction.c:2495:30: error: 'COMPACTMIGRATE_SCANNED' undeclared (first use in this function)
2495 | count_compact_events(COMPACTMIGRATE_SCANNED, cc->total_migrate_scanned);
| ^~~~~~~~~~~~~~~~~~~~~~
>> mm/compaction.c:2496:30: error: 'COMPACTFREE_SCANNED' undeclared (first use in this function)
2496 | count_compact_events(COMPACTFREE_SCANNED, cc->total_free_scanned);
| ^~~~~~~~~~~~~~~~~~~
mm/compaction.c: In function 'kcompactd_do_work':
>> mm/compaction.c:2836:29: error: 'KCOMPACTD_WAKE' undeclared (first use in this function)
2836 | count_compact_event(KCOMPACTD_WAKE);
| ^~~~~~~~~~~~~~
>> mm/compaction.c:2876:38: error: 'KCOMPACTD_MIGRATE_SCANNED' undeclared (first use in this function)
2876 | count_compact_events(KCOMPACTD_MIGRATE_SCANNED,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> mm/compaction.c:2878:38: error: 'KCOMPACTD_FREE_SCANNED' undeclared (first use in this function)
2878 | count_compact_events(KCOMPACTD_FREE_SCANNED,
| ^~~~~~~~~~~~~~~~~~~~~~
..


vim +/PGMAJFAULT +3139 mm/filemap.c

ef00e08e26dd5d Linus Torvalds 2009-06-16 3082
485bb99b49a173 Randy Dunlap 2006-06-23 3083 /**
54cb8821de07f2 Nicholas Piggin 2007-07-19 3084 * filemap_fault - read in file data for page fault handling
d0217ac04ca659 Nicholas Piggin 2007-07-19 3085 * @vmf: struct vm_fault containing details of the fault
485bb99b49a173 Randy Dunlap 2006-06-23 3086 *
54cb8821de07f2 Nicholas Piggin 2007-07-19 3087 * filemap_fault() is invoked via the vma operations vector for a
^1da177e4c3f41 Linus Torvalds 2005-04-16 3088 * mapped memory region to read in file data during a page fault.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3089 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 3090 * The goto's are kind of ugly, but this streamlines the normal case of having
^1da177e4c3f41 Linus Torvalds 2005-04-16 3091 * it in the page cache, and handles the special cases reasonably without
^1da177e4c3f41 Linus Torvalds 2005-04-16 3092 * having a lot of duplicated code.
9a95f3cf7b33d6 Paul Cassella 2014-08-06 3093 *
c1e8d7c6a7a682 Michel Lespinasse 2020-06-08 3094 * vma->vm_mm->mmap_lock must be held on entry.
9a95f3cf7b33d6 Paul Cassella 2014-08-06 3095 *
c1e8d7c6a7a682 Michel Lespinasse 2020-06-08 3096 * If our return value has VM_FAULT_RETRY set, it's because the mmap_lock
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3097) * may be dropped before doing I/O or by lock_folio_maybe_drop_mmap().
9a95f3cf7b33d6 Paul Cassella 2014-08-06 3098 *
c1e8d7c6a7a682 Michel Lespinasse 2020-06-08 3099 * If our return value does not have VM_FAULT_RETRY set, the mmap_lock
9a95f3cf7b33d6 Paul Cassella 2014-08-06 3100 * has not been released.
9a95f3cf7b33d6 Paul Cassella 2014-08-06 3101 *
9a95f3cf7b33d6 Paul Cassella 2014-08-06 3102 * We never return with VM_FAULT_RETRY and a bit from VM_FAULT_ERROR set.
a862f68a8b3600 Mike Rapoport 2019-03-05 3103 *
a862f68a8b3600 Mike Rapoport 2019-03-05 3104 * Return: bitwise-OR of %VM_FAULT_ codes.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3105 */
2bcd6454bae787 Souptick Joarder 2018-06-07 3106 vm_fault_t filemap_fault(struct vm_fault *vmf)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3107 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3108 int error;
11bac80004499e Dave Jiang 2017-02-24 3109 struct file *file = vmf->vma->vm_file;
6b4c9f4469819a Josef Bacik 2019-03-13 3110 struct file *fpin = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3111 struct address_space *mapping = file->f_mapping;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3112 struct inode *inode = mapping->host;
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3113) pgoff_t max_idx, index = vmf->pgoff;
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3114) struct folio *folio;
2bcd6454bae787 Souptick Joarder 2018-06-07 3115 vm_fault_t ret = 0;
730633f0b7f951 Jan Kara 2021-01-28 3116 bool mapping_locked = false;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3117
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3118) max_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3119) if (unlikely(index >= max_idx))
5307cc1aa53850 Linus Torvalds 2007-10-31 3120 return VM_FAULT_SIGBUS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3121
^1da177e4c3f41 Linus Torvalds 2005-04-16 3122 /*
4942642080ea82 Johannes Weiner 2013-10-16 3123 * Do we have something in the page cache already?
^1da177e4c3f41 Linus Torvalds 2005-04-16 3124 */
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3125) folio = filemap_get_folio(mapping, index);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3126) if (likely(folio)) {
3ea89ee86a82e9 Fengguang Wu 2007-07-19 3127 /*
730633f0b7f951 Jan Kara 2021-01-28 3128 * We found the page, so try async readahead before waiting for
730633f0b7f951 Jan Kara 2021-01-28 3129 * the lock.
3ea89ee86a82e9 Fengguang Wu 2007-07-19 3130 */
730633f0b7f951 Jan Kara 2021-01-28 3131 if (!(vmf->flags & FAULT_FLAG_TRIED))
79598cedad85d1 Matthew Wilcox (Oracle 2021-07-29 3132) fpin = do_async_mmap_readahead(vmf, folio);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3133) if (unlikely(!folio_test_uptodate(folio))) {
730633f0b7f951 Jan Kara 2021-01-28 3134 filemap_invalidate_lock_shared(mapping);
730633f0b7f951 Jan Kara 2021-01-28 3135 mapping_locked = true;
730633f0b7f951 Jan Kara 2021-01-28 3136 }
730633f0b7f951 Jan Kara 2021-01-28 3137 } else {
ef00e08e26dd5d Linus Torvalds 2009-06-16 3138 /* No page in the page cache at all */
ef00e08e26dd5d Linus Torvalds 2009-06-16 @3139 count_vm_event(PGMAJFAULT);
2262185c5b287f Roman Gushchin 2017-07-06 3140 count_memcg_event_mm(vmf->vma->vm_mm, PGMAJFAULT);
ef00e08e26dd5d Linus Torvalds 2009-06-16 3141 ret = VM_FAULT_MAJOR;
6b4c9f4469819a Josef Bacik 2019-03-13 3142 fpin = do_sync_mmap_readahead(vmf);
ef00e08e26dd5d Linus Torvalds 2009-06-16 3143 retry_find:
730633f0b7f951 Jan Kara 2021-01-28 3144 /*
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3145) * See comment in filemap_create_folio() why we need
730633f0b7f951 Jan Kara 2021-01-28 3146 * invalidate_lock
730633f0b7f951 Jan Kara 2021-01-28 3147 */
730633f0b7f951 Jan Kara 2021-01-28 3148 if (!mapping_locked) {
730633f0b7f951 Jan Kara 2021-01-28 3149 filemap_invalidate_lock_shared(mapping);
730633f0b7f951 Jan Kara 2021-01-28 3150 mapping_locked = true;
730633f0b7f951 Jan Kara 2021-01-28 3151 }
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3152) folio = __filemap_get_folio(mapping, index,
a75d4c33377277 Josef Bacik 2019-03-13 3153 FGP_CREAT|FGP_FOR_MMAP,
a75d4c33377277 Josef Bacik 2019-03-13 3154 vmf->gfp_mask);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3155) if (!folio) {
6b4c9f4469819a Josef Bacik 2019-03-13 3156 if (fpin)
6b4c9f4469819a Josef Bacik 2019-03-13 3157 goto out_retry;
730633f0b7f951 Jan Kara 2021-01-28 3158 filemap_invalidate_unlock_shared(mapping);
e520e932dcc607 Matthew Wilcox (Oracle 2020-04-01 3159) return VM_FAULT_OOM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3160 }
d88c0922fa0e2c Michel Lespinasse 2010-11-02 3161 }
b522c94da5d9cb Michel Lespinasse 2010-10-26 3162
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3163) if (!lock_folio_maybe_drop_mmap(vmf, folio, &fpin))
6b4c9f4469819a Josef Bacik 2019-03-13 3164 goto out_retry;
6b4c9f4469819a Josef Bacik 2019-03-13 3165
b522c94da5d9cb Michel Lespinasse 2010-10-26 3166 /* Did it get truncated? */
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3167) if (unlikely(folio->mapping != mapping)) {
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3168) folio_unlock(folio);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3169) folio_put(folio);
b522c94da5d9cb Michel Lespinasse 2010-10-26 3170 goto retry_find;
b522c94da5d9cb Michel Lespinasse 2010-10-26 3171 }
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3172) VM_BUG_ON_FOLIO(!folio_contains(folio, index), folio);
b522c94da5d9cb Michel Lespinasse 2010-10-26 3173
^1da177e4c3f41 Linus Torvalds 2005-04-16 3174 /*
d00806b183152a Nicholas Piggin 2007-07-19 3175 * We have a locked page in the page cache, now we need to check
d00806b183152a Nicholas Piggin 2007-07-19 3176 * that it's up-to-date. If not, it is going to be due to an error.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3177 */
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3178) if (unlikely(!folio_test_uptodate(folio))) {
730633f0b7f951 Jan Kara 2021-01-28 3179 /*
730633f0b7f951 Jan Kara 2021-01-28 3180 * The page was in cache and uptodate and now it is not.
730633f0b7f951 Jan Kara 2021-01-28 3181 * Strange but possible since we didn't hold the page lock all
730633f0b7f951 Jan Kara 2021-01-28 3182 * the time. Let's drop everything get the invalidate lock and
730633f0b7f951 Jan Kara 2021-01-28 3183 * try again.
730633f0b7f951 Jan Kara 2021-01-28 3184 */
730633f0b7f951 Jan Kara 2021-01-28 3185 if (!mapping_locked) {
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3186) folio_unlock(folio);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3187) folio_put(folio);
730633f0b7f951 Jan Kara 2021-01-28 3188 goto retry_find;
730633f0b7f951 Jan Kara 2021-01-28 3189 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3190 goto page_not_uptodate;
730633f0b7f951 Jan Kara 2021-01-28 3191 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3192
6b4c9f4469819a Josef Bacik 2019-03-13 3193 /*
c1e8d7c6a7a682 Michel Lespinasse 2020-06-08 3194 * We've made it this far and we had to drop our mmap_lock, now is the
6b4c9f4469819a Josef Bacik 2019-03-13 3195 * time to return to the upper layer and have it re-find the vma and
6b4c9f4469819a Josef Bacik 2019-03-13 3196 * redo the fault.
6b4c9f4469819a Josef Bacik 2019-03-13 3197 */
6b4c9f4469819a Josef Bacik 2019-03-13 3198 if (fpin) {
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3199) folio_unlock(folio);
6b4c9f4469819a Josef Bacik 2019-03-13 3200 goto out_retry;
6b4c9f4469819a Josef Bacik 2019-03-13 3201 }
730633f0b7f951 Jan Kara 2021-01-28 3202 if (mapping_locked)
730633f0b7f951 Jan Kara 2021-01-28 3203 filemap_invalidate_unlock_shared(mapping);
6b4c9f4469819a Josef Bacik 2019-03-13 3204
ef00e08e26dd5d Linus Torvalds 2009-06-16 3205 /*
ef00e08e26dd5d Linus Torvalds 2009-06-16 3206 * Found the page and have a reference on it.
ef00e08e26dd5d Linus Torvalds 2009-06-16 3207 * We must recheck i_size under page lock.
ef00e08e26dd5d Linus Torvalds 2009-06-16 3208 */
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3209) max_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3210) if (unlikely(index >= max_idx)) {
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3211) folio_unlock(folio);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3212) folio_put(folio);
5307cc1aa53850 Linus Torvalds 2007-10-31 3213 return VM_FAULT_SIGBUS;
d00806b183152a Nicholas Piggin 2007-07-19 3214 }
d00806b183152a Nicholas Piggin 2007-07-19 3215
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3216) vmf->page = folio_file_page(folio, index);
83c54070ee1a2d Nicholas Piggin 2007-07-19 3217 return ret | VM_FAULT_LOCKED;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3218
^1da177e4c3f41 Linus Torvalds 2005-04-16 3219 page_not_uptodate:
^1da177e4c3f41 Linus Torvalds 2005-04-16 3220 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 3221 * Umm, take care of errors if the page isn't up-to-date.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3222 * Try to re-read it _once_. We do this synchronously,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3223 * because there really aren't any performance issues here
^1da177e4c3f41 Linus Torvalds 2005-04-16 3224 * and we need to check for errors.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3225 */
6b4c9f4469819a Josef Bacik 2019-03-13 3226 fpin = maybe_unlock_mmap_for_io(vmf, fpin);
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3227) error = filemap_read_folio(file, mapping, folio);
6b4c9f4469819a Josef Bacik 2019-03-13 3228 if (fpin)
6b4c9f4469819a Josef Bacik 2019-03-13 3229 goto out_retry;
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3230) folio_put(folio);
d00806b183152a Nicholas Piggin 2007-07-19 3231
d00806b183152a Nicholas Piggin 2007-07-19 3232 if (!error || error == AOP_TRUNCATED_PAGE)
994fc28c7b1e69 Zach Brown 2005-12-15 3233 goto retry_find;
730633f0b7f951 Jan Kara 2021-01-28 3234 filemap_invalidate_unlock_shared(mapping);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3235
d0217ac04ca659 Nicholas Piggin 2007-07-19 3236 return VM_FAULT_SIGBUS;
6b4c9f4469819a Josef Bacik 2019-03-13 3237
6b4c9f4469819a Josef Bacik 2019-03-13 3238 out_retry:
6b4c9f4469819a Josef Bacik 2019-03-13 3239 /*
c1e8d7c6a7a682 Michel Lespinasse 2020-06-08 3240 * We dropped the mmap_lock, we need to return to the fault handler to
6b4c9f4469819a Josef Bacik 2019-03-13 3241 * re-find the vma and come back and find our hopefully still populated
6b4c9f4469819a Josef Bacik 2019-03-13 3242 * page.
6b4c9f4469819a Josef Bacik 2019-03-13 3243 */
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3244) if (folio)
e292e6d644ce7b Matthew Wilcox (Oracle 2021-03-10 3245) folio_put(folio);
730633f0b7f951 Jan Kara 2021-01-28 3246 if (mapping_locked)
730633f0b7f951 Jan Kara 2021-01-28 3247 filemap_invalidate_unlock_shared(mapping);
6b4c9f4469819a Josef Bacik 2019-03-13 3248 if (fpin)
6b4c9f4469819a Josef Bacik 2019-03-13 3249 fput(fpin);
6b4c9f4469819a Josef Bacik 2019-03-13 3250 return ret | VM_FAULT_RETRY;
54cb8821de07f2 Nicholas Piggin 2007-07-19 3251 }
54cb8821de07f2 Nicholas Piggin 2007-07-19 3252 EXPORT_SYMBOL(filemap_fault);
54cb8821de07f2 Nicholas Piggin 2007-07-19 3253

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-07 09:17:35

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] mm: add DEVICE_ZONE to FOR_ALL_ZONES

Hi Hao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on akpm-mm/mm-everything]

url: https://github.com/intel-lab-lkp/linux/commits/Hao-Lee/mm-add-DEVICE_ZONE-to-FOR_ALL_ZONES/20220804-154805
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220807/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/dba18359aee97f43008e19ffa78421e652b1b102
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Hao-Lee/mm-add-DEVICE_ZONE-to-FOR_ALL_ZONES/20220804-154805
git checkout dba18359aee97f43008e19ffa78421e652b1b102
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 prepare

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

In file included from include/linux/memcontrol.h:14,
from include/linux/swap.h:9,
from include/linux/suspend.h:5,
from arch/x86/kernel/asm-offsets.c:13:
include/linux/vm_event_item.h:29:27: error: expected identifier before '(' token
29 | #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
| ^
include/linux/vm_event_item.h:33:17: note: in expansion of macro 'FOR_ALL_ZONES'
33 | FOR_ALL_ZONES(PGALLOC),
| ^~~~~~~~~~~~~
In file included from include/linux/swap.h:9,
from include/linux/suspend.h:5,
from arch/x86/kernel/asm-offsets.c:13:
>> include/linux/memcontrol.h:86:40: error: 'NR_VM_EVENT_ITEMS' undeclared here (not in a function); did you mean 'NR_VM_NUMA_EVENT_ITEMS'?
86 | unsigned long events[NR_VM_EVENT_ITEMS];
| ^~~~~~~~~~~~~~~~~
| NR_VM_NUMA_EVENT_ITEMS
make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1200: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:219: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.


vim +86 include/linux/memcontrol.h

33398cf2f360c5 Michal Hocko 2015-09-08 82
871789d4af807d Chris Down 2019-05-14 83 struct memcg_vmstats_percpu {
2d146aa3aa842d Johannes Weiner 2021-04-29 84 /* Local (CPU and cgroup) page state & events */
2d146aa3aa842d Johannes Weiner 2021-04-29 85 long state[MEMCG_NR_STAT];
e27be240df53f1 Johannes Weiner 2018-04-10 @86 unsigned long events[NR_VM_EVENT_ITEMS];
2d146aa3aa842d Johannes Weiner 2021-04-29 87
2d146aa3aa842d Johannes Weiner 2021-04-29 88 /* Delta calculation for lockless upward propagation */
2d146aa3aa842d Johannes Weiner 2021-04-29 89 long state_prev[MEMCG_NR_STAT];
2d146aa3aa842d Johannes Weiner 2021-04-29 90 unsigned long events_prev[NR_VM_EVENT_ITEMS];
2d146aa3aa842d Johannes Weiner 2021-04-29 91
2d146aa3aa842d Johannes Weiner 2021-04-29 92 /* Cgroup1: threshold notifications & softlimit tree updates */
33398cf2f360c5 Michal Hocko 2015-09-08 93 unsigned long nr_page_events;
33398cf2f360c5 Michal Hocko 2015-09-08 94 unsigned long targets[MEM_CGROUP_NTARGETS];
33398cf2f360c5 Michal Hocko 2015-09-08 95 };
33398cf2f360c5 Michal Hocko 2015-09-08 96

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-07 15:35:26

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] mm: add DEVICE_ZONE to FOR_ALL_ZONES

Hi Hao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on akpm-mm/mm-everything]

url: https://github.com/intel-lab-lkp/linux/commits/Hao-Lee/mm-add-DEVICE_ZONE-to-FOR_ALL_ZONES/20220804-154805
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: hexagon-randconfig-r041-20220804 (https://download.01.org/0day-ci/archive/20220807/[email protected]/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 26dd42705c2af0b8f6e5d6cdb32c9bd5ed9524eb)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/dba18359aee97f43008e19ffa78421e652b1b102
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Hao-Lee/mm-add-DEVICE_ZONE-to-FOR_ALL_ZONES/20220804-154805
git checkout dba18359aee97f43008e19ffa78421e652b1b102
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/iio/adc/ fs/xfs/ ipc/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

In file included from fs/xfs/scrub/agheader.c:6:
In file included from fs/xfs/xfs.h:22:
In file included from fs/xfs/xfs_linux.h:24:
In file included from fs/xfs/kmem.h:11:
In file included from include/linux/mm.h:1668:
In file included from include/linux/vmstat.h:8:
include/linux/vm_event_item.h:33:3: error: expected identifier
FOR_ALL_ZONES(PGALLOC),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
include/linux/vm_event_item.h:34:3: error: expected identifier
FOR_ALL_ZONES(ALLOCSTALL),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
include/linux/vm_event_item.h:35:3: error: expected identifier
FOR_ALL_ZONES(PGSCAN_SKIP),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
>> fs/xfs/scrub/agheader.c:165:32: warning: implicit conversion from 'int' to '__u16' (aka 'unsigned short') changes value from -49265 to 16271 [-Wconstant-conversion]
XFS_SB_VERSION_EXTFLGBIT |
~~~~~~~~~~~~~~~~~~~~~~~~~^
include/linux/byteorder/generic.h:96:21: note: expanded from macro 'cpu_to_be16'
#define cpu_to_be16 __cpu_to_be16
^
include/uapi/linux/byteorder/little_endian.h:42:53: note: expanded from macro '__cpu_to_be16'
#define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
~~~~~~~~~~^~~
include/uapi/linux/swab.h:107:12: note: expanded from macro '__swab16'
__fswab16(x))
~~~~~~~~~ ^
1 warning and 3 errors generated.
--
In file included from ipc/msg.c:30:
In file included from include/linux/mm.h:1668:
In file included from include/linux/vmstat.h:8:
include/linux/vm_event_item.h:33:3: error: expected identifier
FOR_ALL_ZONES(PGALLOC),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
include/linux/vm_event_item.h:34:3: error: expected identifier
FOR_ALL_ZONES(ALLOCSTALL),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
include/linux/vm_event_item.h:35:3: error: expected identifier
FOR_ALL_ZONES(PGSCAN_SKIP),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
>> ipc/msg.c:496:20: warning: implicit conversion from 'int' to 'unsigned short' changes value from 32768000 to 0 [-Wconstant-conversion]
msginfo->msgseg = MSGSEG;
~ ^~~~~~
include/uapi/linux/msg.h:87:38: note: expanded from macro 'MSGSEG'
#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
^~~~~~~~
include/uapi/linux/msg.h:86:36: note: expanded from macro '__MSGSEG'
#define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */
~~~~~~~~~~~~~~~~~^~~~~~~~
1 warning and 3 errors generated.
--
In file included from drivers/iio/adc/fsl-imx25-gcq.c:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:14:
include/linux/vm_event_item.h:33:3: error: expected identifier
FOR_ALL_ZONES(PGALLOC),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
include/linux/vm_event_item.h:34:3: error: expected identifier
FOR_ALL_ZONES(ALLOCSTALL),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
include/linux/vm_event_item.h:35:3: error: expected identifier
FOR_ALL_ZONES(PGSCAN_SKIP),
^
include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
#define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
^
>> drivers/iio/adc/fsl-imx25-gcq.c:115:8: warning: shift count is negative [-Wshift-count-negative]
MX25_ADCQ_ITEM(0, chan->channel));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/mfd/imx25-tsadc.h:54:3: note: expanded from macro 'MX25_ADCQ_ITEM'
_MX25_ADCQ_ITEM((item) - 8, (x)) : _MX25_ADCQ_ITEM((item), (x)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/mfd/imx25-tsadc.h:52:39: note: expanded from macro '_MX25_ADCQ_ITEM'
#define _MX25_ADCQ_ITEM(item, x) ((x) << ((item) * 4))
^ ~~~~~~~~~~~~
1 warning and 3 errors generated.


vim +165 fs/xfs/scrub/agheader.c

166d76410d7ac0 Darrick J. Wong 2018-01-16 50
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 51 /*
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 52 * Scrub the filesystem superblock.
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 53 *
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 54 * Note: We do /not/ attempt to check AG 0's superblock. Mount is
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 55 * responsible for validating all the geometry information in sb 0, so
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 56 * if the filesystem is capable of initiating online scrub, then clearly
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 57 * sb 0 is ok and we can use its information to check everything else.
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 58 */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 59 int
c517b3aa02cff1 Darrick J. Wong 2018-07-19 60 xchk_superblock(
1d8a748a8aa94a Darrick J. Wong 2018-07-19 61 struct xfs_scrub *sc)
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 62 {
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 63 struct xfs_mount *mp = sc->mp;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 64 struct xfs_buf *bp;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 65 struct xfs_dsb *sb;
48c6615cc55759 Darrick J. Wong 2021-08-06 66 struct xfs_perag *pag;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 67 xfs_agnumber_t agno;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 68 uint32_t v2_ok;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 69 __be32 features_mask;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 70 int error;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 71 __be16 vernum_mask;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 72
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 73 agno = sc->sm->sm_agno;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 74 if (agno == 0)
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 75 return 0;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 76
48c6615cc55759 Darrick J. Wong 2021-08-06 77 /*
48c6615cc55759 Darrick J. Wong 2021-08-06 78 * Grab an active reference to the perag structure. If we can't get
48c6615cc55759 Darrick J. Wong 2021-08-06 79 * it, we're racing with something that's tearing down the AG, so
48c6615cc55759 Darrick J. Wong 2021-08-06 80 * signal that the AG no longer exists.
48c6615cc55759 Darrick J. Wong 2021-08-06 81 */
48c6615cc55759 Darrick J. Wong 2021-08-06 82 pag = xfs_perag_get(mp, agno);
48c6615cc55759 Darrick J. Wong 2021-08-06 83 if (!pag)
48c6615cc55759 Darrick J. Wong 2021-08-06 84 return -ENOENT;
48c6615cc55759 Darrick J. Wong 2021-08-06 85
689e11c84b1586 Darrick J. Wong 2018-05-14 86 error = xfs_sb_read_secondary(mp, sc->tp, agno, &bp);
e5b37faa932d79 Darrick J. Wong 2018-01-08 87 /*
e5b37faa932d79 Darrick J. Wong 2018-01-08 88 * The superblock verifier can return several different error codes
e5b37faa932d79 Darrick J. Wong 2018-01-08 89 * if it thinks the superblock doesn't look right. For a mount these
e5b37faa932d79 Darrick J. Wong 2018-01-08 90 * would all get bounced back to userspace, but if we're here then the
e5b37faa932d79 Darrick J. Wong 2018-01-08 91 * fs mounted successfully, which means that this secondary superblock
e5b37faa932d79 Darrick J. Wong 2018-01-08 92 * is simply incorrect. Treat all these codes the same way we treat
e5b37faa932d79 Darrick J. Wong 2018-01-08 93 * any corruption.
e5b37faa932d79 Darrick J. Wong 2018-01-08 94 */
e5b37faa932d79 Darrick J. Wong 2018-01-08 95 switch (error) {
e5b37faa932d79 Darrick J. Wong 2018-01-08 96 case -EINVAL: /* also -EWRONGFS */
e5b37faa932d79 Darrick J. Wong 2018-01-08 97 case -ENOSYS:
e5b37faa932d79 Darrick J. Wong 2018-01-08 98 case -EFBIG:
e5b37faa932d79 Darrick J. Wong 2018-01-08 99 error = -EFSCORRUPTED;
53004ee78d6273 Gustavo A. R. Silva 2021-04-20 100 fallthrough;
e5b37faa932d79 Darrick J. Wong 2018-01-08 101 default:
e5b37faa932d79 Darrick J. Wong 2018-01-08 102 break;
e5b37faa932d79 Darrick J. Wong 2018-01-08 103 }
c517b3aa02cff1 Darrick J. Wong 2018-07-19 104 if (!xchk_process_error(sc, agno, XFS_SB_BLOCK(mp), &error))
48c6615cc55759 Darrick J. Wong 2021-08-06 105 goto out_pag;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 106
3e6e8afd3abb74 Christoph Hellwig 2020-03-10 107 sb = bp->b_addr;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 108
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 109 /*
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 110 * Verify the geometries match. Fields that are permanently
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 111 * set by mkfs are checked; fields that can be updated later
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 112 * (and are not propagated to backup superblocks) are preen
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 113 * checked.
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 114 */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 115 if (sb->sb_blocksize != cpu_to_be32(mp->m_sb.sb_blocksize))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 116 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 117
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 118 if (sb->sb_dblocks != cpu_to_be64(mp->m_sb.sb_dblocks))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 119 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 120
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 121 if (sb->sb_rblocks != cpu_to_be64(mp->m_sb.sb_rblocks))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 122 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 123
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 124 if (sb->sb_rextents != cpu_to_be64(mp->m_sb.sb_rextents))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 125 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 126
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 127 if (!uuid_equal(&sb->sb_uuid, &mp->m_sb.sb_uuid))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 128 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 129
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 130 if (sb->sb_logstart != cpu_to_be64(mp->m_sb.sb_logstart))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 131 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 132
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 133 if (sb->sb_rootino != cpu_to_be64(mp->m_sb.sb_rootino))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 134 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 135
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 136 if (sb->sb_rbmino != cpu_to_be64(mp->m_sb.sb_rbmino))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 137 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 138
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 139 if (sb->sb_rsumino != cpu_to_be64(mp->m_sb.sb_rsumino))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 140 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 141
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 142 if (sb->sb_rextsize != cpu_to_be32(mp->m_sb.sb_rextsize))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 143 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 144
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 145 if (sb->sb_agblocks != cpu_to_be32(mp->m_sb.sb_agblocks))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 146 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 147
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 148 if (sb->sb_agcount != cpu_to_be32(mp->m_sb.sb_agcount))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 149 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 150
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 151 if (sb->sb_rbmblocks != cpu_to_be32(mp->m_sb.sb_rbmblocks))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 152 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 153
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 154 if (sb->sb_logblocks != cpu_to_be32(mp->m_sb.sb_logblocks))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 155 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 156
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 157 /* Check sb_versionnum bits that are set at mkfs time. */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 158 vernum_mask = cpu_to_be16(~XFS_SB_VERSION_OKBITS |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 159 XFS_SB_VERSION_NUMBITS |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 160 XFS_SB_VERSION_ALIGNBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 161 XFS_SB_VERSION_DALIGNBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 162 XFS_SB_VERSION_SHAREDBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 163 XFS_SB_VERSION_LOGV2BIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 164 XFS_SB_VERSION_SECTORBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 @165 XFS_SB_VERSION_EXTFLGBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 166 XFS_SB_VERSION_DIRV2BIT);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 167 if ((sb->sb_versionnum & vernum_mask) !=
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 168 (cpu_to_be16(mp->m_sb.sb_versionnum) & vernum_mask))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 169 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 170
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 171 /* Check sb_versionnum bits that can be set after mkfs time. */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 172 vernum_mask = cpu_to_be16(XFS_SB_VERSION_ATTRBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 173 XFS_SB_VERSION_NLINKBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 174 XFS_SB_VERSION_QUOTABIT);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 175 if ((sb->sb_versionnum & vernum_mask) !=
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 176 (cpu_to_be16(mp->m_sb.sb_versionnum) & vernum_mask))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 177 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 178
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 179 if (sb->sb_sectsize != cpu_to_be16(mp->m_sb.sb_sectsize))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 180 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 181
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 182 if (sb->sb_inodesize != cpu_to_be16(mp->m_sb.sb_inodesize))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 183 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 184
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 185 if (sb->sb_inopblock != cpu_to_be16(mp->m_sb.sb_inopblock))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 186 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 187
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 188 if (memcmp(sb->sb_fname, mp->m_sb.sb_fname, sizeof(sb->sb_fname)))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 189 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 190
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 191 if (sb->sb_blocklog != mp->m_sb.sb_blocklog)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 192 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 193
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 194 if (sb->sb_sectlog != mp->m_sb.sb_sectlog)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 195 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 196
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 197 if (sb->sb_inodelog != mp->m_sb.sb_inodelog)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 198 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 199
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 200 if (sb->sb_inopblog != mp->m_sb.sb_inopblog)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 201 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 202
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 203 if (sb->sb_agblklog != mp->m_sb.sb_agblklog)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 204 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 205
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 206 if (sb->sb_rextslog != mp->m_sb.sb_rextslog)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 207 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 208
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 209 if (sb->sb_imax_pct != mp->m_sb.sb_imax_pct)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 210 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 211
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 212 /*
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 213 * Skip the summary counters since we track them in memory anyway.
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 214 * sb_icount, sb_ifree, sb_fdblocks, sb_frexents
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 215 */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 216
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 217 if (sb->sb_uquotino != cpu_to_be64(mp->m_sb.sb_uquotino))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 218 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 219
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 220 if (sb->sb_gquotino != cpu_to_be64(mp->m_sb.sb_gquotino))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 221 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 222
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 223 /*
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 224 * Skip the quota flags since repair will force quotacheck.
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 225 * sb_qflags
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 226 */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 227
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 228 if (sb->sb_flags != mp->m_sb.sb_flags)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 229 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 230
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 231 if (sb->sb_shared_vn != mp->m_sb.sb_shared_vn)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 232 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 233
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 234 if (sb->sb_inoalignmt != cpu_to_be32(mp->m_sb.sb_inoalignmt))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 235 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 236
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 237 if (sb->sb_unit != cpu_to_be32(mp->m_sb.sb_unit))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 238 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 239
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 240 if (sb->sb_width != cpu_to_be32(mp->m_sb.sb_width))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 241 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 242
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 243 if (sb->sb_dirblklog != mp->m_sb.sb_dirblklog)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 244 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 245
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 246 if (sb->sb_logsectlog != mp->m_sb.sb_logsectlog)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 247 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 248
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 249 if (sb->sb_logsectsize != cpu_to_be16(mp->m_sb.sb_logsectsize))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 250 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 251
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 252 if (sb->sb_logsunit != cpu_to_be32(mp->m_sb.sb_logsunit))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 253 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 254
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 255 /* Do we see any invalid bits in sb_features2? */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 256 if (!xfs_sb_version_hasmorebits(&mp->m_sb)) {
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 257 if (sb->sb_features2 != 0)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 258 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 259 } else {
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 260 v2_ok = XFS_SB_VERSION2_OKBITS;
d6837c1aab42e7 Dave Chinner 2021-08-18 261 if (xfs_sb_is_v5(&mp->m_sb))
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 262 v2_ok |= XFS_SB_VERSION2_CRCBIT;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 263
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 264 if (!!(sb->sb_features2 & cpu_to_be32(~v2_ok)))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 265 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 266
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 267 if (sb->sb_features2 != sb->sb_bad_features2)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 268 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 269 }
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 270
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 271 /* Check sb_features2 flags that are set at mkfs time. */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 272 features_mask = cpu_to_be32(XFS_SB_VERSION2_LAZYSBCOUNTBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 273 XFS_SB_VERSION2_PROJID32BIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 274 XFS_SB_VERSION2_CRCBIT |
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 275 XFS_SB_VERSION2_FTYPE);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 276 if ((sb->sb_features2 & features_mask) !=
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 277 (cpu_to_be32(mp->m_sb.sb_features2) & features_mask))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 278 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 279
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 280 /* Check sb_features2 flags that can be set after mkfs time. */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 281 features_mask = cpu_to_be32(XFS_SB_VERSION2_ATTR2BIT);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 282 if ((sb->sb_features2 & features_mask) !=
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 283 (cpu_to_be32(mp->m_sb.sb_features2) & features_mask))
4a9bca86806fa6 Darrick J. Wong 2022-01-07 284 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 285
38c26bfd90e199 Dave Chinner 2021-08-18 286 if (!xfs_has_crc(mp)) {
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 287 /* all v5 fields must be zero */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 288 if (memchr_inv(&sb->sb_features_compat, 0,
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 289 sizeof(struct xfs_dsb) -
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 290 offsetof(struct xfs_dsb, sb_features_compat)))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 291 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 292 } else {
4a9bca86806fa6 Darrick J. Wong 2022-01-07 293 /* compat features must match */
4a9bca86806fa6 Darrick J. Wong 2022-01-07 294 if (sb->sb_features_compat !=
4a9bca86806fa6 Darrick J. Wong 2022-01-07 295 cpu_to_be32(mp->m_sb.sb_features_compat))
4a9bca86806fa6 Darrick J. Wong 2022-01-07 296 xchk_block_set_corrupt(sc, bp);
4a9bca86806fa6 Darrick J. Wong 2022-01-07 297
4a9bca86806fa6 Darrick J. Wong 2022-01-07 298 /* ro compat features must match */
4a9bca86806fa6 Darrick J. Wong 2022-01-07 299 if (sb->sb_features_ro_compat !=
4a9bca86806fa6 Darrick J. Wong 2022-01-07 300 cpu_to_be32(mp->m_sb.sb_features_ro_compat))
4a9bca86806fa6 Darrick J. Wong 2022-01-07 301 xchk_block_set_corrupt(sc, bp);
4a9bca86806fa6 Darrick J. Wong 2022-01-07 302
4a9bca86806fa6 Darrick J. Wong 2022-01-07 303 /*
4a9bca86806fa6 Darrick J. Wong 2022-01-07 304 * NEEDSREPAIR is ignored on a secondary super, so we should
4a9bca86806fa6 Darrick J. Wong 2022-01-07 305 * clear it when we find it, though it's not a corruption.
4a9bca86806fa6 Darrick J. Wong 2022-01-07 306 */
4a9bca86806fa6 Darrick J. Wong 2022-01-07 307 features_mask = cpu_to_be32(XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR);
4a9bca86806fa6 Darrick J. Wong 2022-01-07 308 if ((cpu_to_be32(mp->m_sb.sb_features_incompat) ^
4a9bca86806fa6 Darrick J. Wong 2022-01-07 309 sb->sb_features_incompat) & features_mask)
4a9bca86806fa6 Darrick J. Wong 2022-01-07 310 xchk_block_set_preen(sc, bp);
4a9bca86806fa6 Darrick J. Wong 2022-01-07 311
4a9bca86806fa6 Darrick J. Wong 2022-01-07 312 /* all other incompat features must match */
4a9bca86806fa6 Darrick J. Wong 2022-01-07 313 if ((cpu_to_be32(mp->m_sb.sb_features_incompat) ^
4a9bca86806fa6 Darrick J. Wong 2022-01-07 314 sb->sb_features_incompat) & ~features_mask)
c517b3aa02cff1 Darrick J. Wong 2018-07-19 315 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 316
4a9bca86806fa6 Darrick J. Wong 2022-01-07 317 /*
4a9bca86806fa6 Darrick J. Wong 2022-01-07 318 * log incompat features protect newer log record types from
4a9bca86806fa6 Darrick J. Wong 2022-01-07 319 * older log recovery code. Log recovery doesn't check the
4a9bca86806fa6 Darrick J. Wong 2022-01-07 320 * secondary supers, so we can clear these if needed.
4a9bca86806fa6 Darrick J. Wong 2022-01-07 321 */
4a9bca86806fa6 Darrick J. Wong 2022-01-07 322 if (sb->sb_features_log_incompat)
4a9bca86806fa6 Darrick J. Wong 2022-01-07 323 xchk_block_set_preen(sc, bp);
4a9bca86806fa6 Darrick J. Wong 2022-01-07 324
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 325 /* Don't care about sb_crc */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 326
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 327 if (sb->sb_spino_align != cpu_to_be32(mp->m_sb.sb_spino_align))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 328 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 329
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 330 if (sb->sb_pquotino != cpu_to_be64(mp->m_sb.sb_pquotino))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 331 xchk_block_set_preen(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 332
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 333 /* Don't care about sb_lsn */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 334 }
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 335
38c26bfd90e199 Dave Chinner 2021-08-18 336 if (xfs_has_metauuid(mp)) {
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 337 /* The metadata UUID must be the same for all supers */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 338 if (!uuid_equal(&sb->sb_meta_uuid, &mp->m_sb.sb_meta_uuid))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 339 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 340 }
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 341
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 342 /* Everything else must be zero. */
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 343 if (memchr_inv(sb + 1, 0,
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 344 BBTOB(bp->b_length) - sizeof(struct xfs_dsb)))
c517b3aa02cff1 Darrick J. Wong 2018-07-19 345 xchk_block_set_corrupt(sc, bp);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 346
c517b3aa02cff1 Darrick J. Wong 2018-07-19 347 xchk_superblock_xref(sc, bp);
48c6615cc55759 Darrick J. Wong 2021-08-06 348 out_pag:
48c6615cc55759 Darrick J. Wong 2021-08-06 349 xfs_perag_put(pag);
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 350 return error;
21fb4cb1981ef7 Darrick J. Wong 2017-10-17 351 }
ab9d5dc59fe615 Darrick J. Wong 2017-10-17 352

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-07 15:54:34

by Hao Lee

[permalink] [raw]
Subject: Re: [PATCH] mm: add DEVICE_ZONE to FOR_ALL_ZONES

I missed the situation when CONFIG_ZONE_DEVICE is not defined. Fixed in next v2.

On Sun, Aug 7, 2022 at 11:09 PM kernel test robot <[email protected]> wrote:
>
> Hi Hao,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on akpm-mm/mm-everything]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Hao-Lee/mm-add-DEVICE_ZONE-to-FOR_ALL_ZONES/20220804-154805
> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> config: hexagon-randconfig-r041-20220804 (https://download.01.org/0day-ci/archive/20220807/[email protected]/config)
> compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 26dd42705c2af0b8f6e5d6cdb32c9bd5ed9524eb)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/dba18359aee97f43008e19ffa78421e652b1b102
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Hao-Lee/mm-add-DEVICE_ZONE-to-FOR_ALL_ZONES/20220804-154805
> git checkout dba18359aee97f43008e19ffa78421e652b1b102
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/iio/adc/ fs/xfs/ ipc/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <[email protected]>
>
> All warnings (new ones prefixed by >>):
>
> In file included from fs/xfs/scrub/agheader.c:6:
> In file included from fs/xfs/xfs.h:22:
> In file included from fs/xfs/xfs_linux.h:24:
> In file included from fs/xfs/kmem.h:11:
> In file included from include/linux/mm.h:1668:
> In file included from include/linux/vmstat.h:8:
> include/linux/vm_event_item.h:33:3: error: expected identifier
> FOR_ALL_ZONES(PGALLOC),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> include/linux/vm_event_item.h:34:3: error: expected identifier
> FOR_ALL_ZONES(ALLOCSTALL),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> include/linux/vm_event_item.h:35:3: error: expected identifier
> FOR_ALL_ZONES(PGSCAN_SKIP),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> >> fs/xfs/scrub/agheader.c:165:32: warning: implicit conversion from 'int' to '__u16' (aka 'unsigned short') changes value from -49265 to 16271 [-Wconstant-conversion]
> XFS_SB_VERSION_EXTFLGBIT |
> ~~~~~~~~~~~~~~~~~~~~~~~~~^
> include/linux/byteorder/generic.h:96:21: note: expanded from macro 'cpu_to_be16'
> #define cpu_to_be16 __cpu_to_be16
> ^
> include/uapi/linux/byteorder/little_endian.h:42:53: note: expanded from macro '__cpu_to_be16'
> #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
> ~~~~~~~~~~^~~
> include/uapi/linux/swab.h:107:12: note: expanded from macro '__swab16'
> __fswab16(x))
> ~~~~~~~~~ ^
> 1 warning and 3 errors generated.
> --
> In file included from ipc/msg.c:30:
> In file included from include/linux/mm.h:1668:
> In file included from include/linux/vmstat.h:8:
> include/linux/vm_event_item.h:33:3: error: expected identifier
> FOR_ALL_ZONES(PGALLOC),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> include/linux/vm_event_item.h:34:3: error: expected identifier
> FOR_ALL_ZONES(ALLOCSTALL),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> include/linux/vm_event_item.h:35:3: error: expected identifier
> FOR_ALL_ZONES(PGSCAN_SKIP),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> >> ipc/msg.c:496:20: warning: implicit conversion from 'int' to 'unsigned short' changes value from 32768000 to 0 [-Wconstant-conversion]
> msginfo->msgseg = MSGSEG;
> ~ ^~~~~~
> include/uapi/linux/msg.h:87:38: note: expanded from macro 'MSGSEG'
> #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
> ^~~~~~~~
> include/uapi/linux/msg.h:86:36: note: expanded from macro '__MSGSEG'
> #define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */
> ~~~~~~~~~~~~~~~~~^~~~~~~~
> 1 warning and 3 errors generated.
> --
> In file included from drivers/iio/adc/fsl-imx25-gcq.c:18:
> In file included from include/linux/regulator/consumer.h:35:
> In file included from include/linux/suspend.h:5:
> In file included from include/linux/swap.h:9:
> In file included from include/linux/memcontrol.h:14:
> include/linux/vm_event_item.h:33:3: error: expected identifier
> FOR_ALL_ZONES(PGALLOC),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> include/linux/vm_event_item.h:34:3: error: expected identifier
> FOR_ALL_ZONES(ALLOCSTALL),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> include/linux/vm_event_item.h:35:3: error: expected identifier
> FOR_ALL_ZONES(PGSCAN_SKIP),
> ^
> include/linux/vm_event_item.h:29:27: note: expanded from macro 'FOR_ALL_ZONES'
> #define FOR_ALL_ZONES(xx) (DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL, \
> ^
> >> drivers/iio/adc/fsl-imx25-gcq.c:115:8: warning: shift count is negative [-Wshift-count-negative]
> MX25_ADCQ_ITEM(0, chan->channel));
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/mfd/imx25-tsadc.h:54:3: note: expanded from macro 'MX25_ADCQ_ITEM'
> _MX25_ADCQ_ITEM((item) - 8, (x)) : _MX25_ADCQ_ITEM((item), (x)))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/mfd/imx25-tsadc.h:52:39: note: expanded from macro '_MX25_ADCQ_ITEM'
> #define _MX25_ADCQ_ITEM(item, x) ((x) << ((item) * 4))
> ^ ~~~~~~~~~~~~
> 1 warning and 3 errors generated.
>
>
> vim +165 fs/xfs/scrub/agheader.c
>
> 166d76410d7ac0 Darrick J. Wong 2018-01-16 50
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 51 /*
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 52 * Scrub the filesystem superblock.
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 53 *
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 54 * Note: We do /not/ attempt to check AG 0's superblock. Mount is
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 55 * responsible for validating all the geometry information in sb 0, so
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 56 * if the filesystem is capable of initiating online scrub, then clearly
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 57 * sb 0 is ok and we can use its information to check everything else.
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 58 */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 59 int
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 60 xchk_superblock(
> 1d8a748a8aa94a Darrick J. Wong 2018-07-19 61 struct xfs_scrub *sc)
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 62 {
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 63 struct xfs_mount *mp = sc->mp;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 64 struct xfs_buf *bp;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 65 struct xfs_dsb *sb;
> 48c6615cc55759 Darrick J. Wong 2021-08-06 66 struct xfs_perag *pag;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 67 xfs_agnumber_t agno;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 68 uint32_t v2_ok;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 69 __be32 features_mask;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 70 int error;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 71 __be16 vernum_mask;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 72
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 73 agno = sc->sm->sm_agno;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 74 if (agno == 0)
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 75 return 0;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 76
> 48c6615cc55759 Darrick J. Wong 2021-08-06 77 /*
> 48c6615cc55759 Darrick J. Wong 2021-08-06 78 * Grab an active reference to the perag structure. If we can't get
> 48c6615cc55759 Darrick J. Wong 2021-08-06 79 * it, we're racing with something that's tearing down the AG, so
> 48c6615cc55759 Darrick J. Wong 2021-08-06 80 * signal that the AG no longer exists.
> 48c6615cc55759 Darrick J. Wong 2021-08-06 81 */
> 48c6615cc55759 Darrick J. Wong 2021-08-06 82 pag = xfs_perag_get(mp, agno);
> 48c6615cc55759 Darrick J. Wong 2021-08-06 83 if (!pag)
> 48c6615cc55759 Darrick J. Wong 2021-08-06 84 return -ENOENT;
> 48c6615cc55759 Darrick J. Wong 2021-08-06 85
> 689e11c84b1586 Darrick J. Wong 2018-05-14 86 error = xfs_sb_read_secondary(mp, sc->tp, agno, &bp);
> e5b37faa932d79 Darrick J. Wong 2018-01-08 87 /*
> e5b37faa932d79 Darrick J. Wong 2018-01-08 88 * The superblock verifier can return several different error codes
> e5b37faa932d79 Darrick J. Wong 2018-01-08 89 * if it thinks the superblock doesn't look right. For a mount these
> e5b37faa932d79 Darrick J. Wong 2018-01-08 90 * would all get bounced back to userspace, but if we're here then the
> e5b37faa932d79 Darrick J. Wong 2018-01-08 91 * fs mounted successfully, which means that this secondary superblock
> e5b37faa932d79 Darrick J. Wong 2018-01-08 92 * is simply incorrect. Treat all these codes the same way we treat
> e5b37faa932d79 Darrick J. Wong 2018-01-08 93 * any corruption.
> e5b37faa932d79 Darrick J. Wong 2018-01-08 94 */
> e5b37faa932d79 Darrick J. Wong 2018-01-08 95 switch (error) {
> e5b37faa932d79 Darrick J. Wong 2018-01-08 96 case -EINVAL: /* also -EWRONGFS */
> e5b37faa932d79 Darrick J. Wong 2018-01-08 97 case -ENOSYS:
> e5b37faa932d79 Darrick J. Wong 2018-01-08 98 case -EFBIG:
> e5b37faa932d79 Darrick J. Wong 2018-01-08 99 error = -EFSCORRUPTED;
> 53004ee78d6273 Gustavo A. R. Silva 2021-04-20 100 fallthrough;
> e5b37faa932d79 Darrick J. Wong 2018-01-08 101 default:
> e5b37faa932d79 Darrick J. Wong 2018-01-08 102 break;
> e5b37faa932d79 Darrick J. Wong 2018-01-08 103 }
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 104 if (!xchk_process_error(sc, agno, XFS_SB_BLOCK(mp), &error))
> 48c6615cc55759 Darrick J. Wong 2021-08-06 105 goto out_pag;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 106
> 3e6e8afd3abb74 Christoph Hellwig 2020-03-10 107 sb = bp->b_addr;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 108
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 109 /*
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 110 * Verify the geometries match. Fields that are permanently
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 111 * set by mkfs are checked; fields that can be updated later
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 112 * (and are not propagated to backup superblocks) are preen
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 113 * checked.
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 114 */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 115 if (sb->sb_blocksize != cpu_to_be32(mp->m_sb.sb_blocksize))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 116 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 117
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 118 if (sb->sb_dblocks != cpu_to_be64(mp->m_sb.sb_dblocks))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 119 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 120
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 121 if (sb->sb_rblocks != cpu_to_be64(mp->m_sb.sb_rblocks))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 122 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 123
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 124 if (sb->sb_rextents != cpu_to_be64(mp->m_sb.sb_rextents))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 125 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 126
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 127 if (!uuid_equal(&sb->sb_uuid, &mp->m_sb.sb_uuid))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 128 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 129
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 130 if (sb->sb_logstart != cpu_to_be64(mp->m_sb.sb_logstart))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 131 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 132
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 133 if (sb->sb_rootino != cpu_to_be64(mp->m_sb.sb_rootino))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 134 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 135
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 136 if (sb->sb_rbmino != cpu_to_be64(mp->m_sb.sb_rbmino))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 137 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 138
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 139 if (sb->sb_rsumino != cpu_to_be64(mp->m_sb.sb_rsumino))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 140 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 141
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 142 if (sb->sb_rextsize != cpu_to_be32(mp->m_sb.sb_rextsize))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 143 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 144
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 145 if (sb->sb_agblocks != cpu_to_be32(mp->m_sb.sb_agblocks))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 146 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 147
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 148 if (sb->sb_agcount != cpu_to_be32(mp->m_sb.sb_agcount))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 149 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 150
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 151 if (sb->sb_rbmblocks != cpu_to_be32(mp->m_sb.sb_rbmblocks))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 152 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 153
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 154 if (sb->sb_logblocks != cpu_to_be32(mp->m_sb.sb_logblocks))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 155 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 156
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 157 /* Check sb_versionnum bits that are set at mkfs time. */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 158 vernum_mask = cpu_to_be16(~XFS_SB_VERSION_OKBITS |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 159 XFS_SB_VERSION_NUMBITS |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 160 XFS_SB_VERSION_ALIGNBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 161 XFS_SB_VERSION_DALIGNBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 162 XFS_SB_VERSION_SHAREDBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 163 XFS_SB_VERSION_LOGV2BIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 164 XFS_SB_VERSION_SECTORBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 @165 XFS_SB_VERSION_EXTFLGBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 166 XFS_SB_VERSION_DIRV2BIT);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 167 if ((sb->sb_versionnum & vernum_mask) !=
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 168 (cpu_to_be16(mp->m_sb.sb_versionnum) & vernum_mask))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 169 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 170
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 171 /* Check sb_versionnum bits that can be set after mkfs time. */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 172 vernum_mask = cpu_to_be16(XFS_SB_VERSION_ATTRBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 173 XFS_SB_VERSION_NLINKBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 174 XFS_SB_VERSION_QUOTABIT);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 175 if ((sb->sb_versionnum & vernum_mask) !=
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 176 (cpu_to_be16(mp->m_sb.sb_versionnum) & vernum_mask))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 177 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 178
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 179 if (sb->sb_sectsize != cpu_to_be16(mp->m_sb.sb_sectsize))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 180 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 181
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 182 if (sb->sb_inodesize != cpu_to_be16(mp->m_sb.sb_inodesize))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 183 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 184
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 185 if (sb->sb_inopblock != cpu_to_be16(mp->m_sb.sb_inopblock))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 186 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 187
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 188 if (memcmp(sb->sb_fname, mp->m_sb.sb_fname, sizeof(sb->sb_fname)))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 189 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 190
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 191 if (sb->sb_blocklog != mp->m_sb.sb_blocklog)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 192 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 193
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 194 if (sb->sb_sectlog != mp->m_sb.sb_sectlog)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 195 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 196
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 197 if (sb->sb_inodelog != mp->m_sb.sb_inodelog)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 198 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 199
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 200 if (sb->sb_inopblog != mp->m_sb.sb_inopblog)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 201 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 202
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 203 if (sb->sb_agblklog != mp->m_sb.sb_agblklog)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 204 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 205
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 206 if (sb->sb_rextslog != mp->m_sb.sb_rextslog)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 207 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 208
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 209 if (sb->sb_imax_pct != mp->m_sb.sb_imax_pct)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 210 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 211
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 212 /*
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 213 * Skip the summary counters since we track them in memory anyway.
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 214 * sb_icount, sb_ifree, sb_fdblocks, sb_frexents
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 215 */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 216
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 217 if (sb->sb_uquotino != cpu_to_be64(mp->m_sb.sb_uquotino))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 218 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 219
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 220 if (sb->sb_gquotino != cpu_to_be64(mp->m_sb.sb_gquotino))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 221 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 222
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 223 /*
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 224 * Skip the quota flags since repair will force quotacheck.
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 225 * sb_qflags
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 226 */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 227
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 228 if (sb->sb_flags != mp->m_sb.sb_flags)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 229 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 230
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 231 if (sb->sb_shared_vn != mp->m_sb.sb_shared_vn)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 232 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 233
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 234 if (sb->sb_inoalignmt != cpu_to_be32(mp->m_sb.sb_inoalignmt))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 235 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 236
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 237 if (sb->sb_unit != cpu_to_be32(mp->m_sb.sb_unit))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 238 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 239
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 240 if (sb->sb_width != cpu_to_be32(mp->m_sb.sb_width))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 241 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 242
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 243 if (sb->sb_dirblklog != mp->m_sb.sb_dirblklog)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 244 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 245
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 246 if (sb->sb_logsectlog != mp->m_sb.sb_logsectlog)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 247 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 248
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 249 if (sb->sb_logsectsize != cpu_to_be16(mp->m_sb.sb_logsectsize))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 250 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 251
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 252 if (sb->sb_logsunit != cpu_to_be32(mp->m_sb.sb_logsunit))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 253 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 254
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 255 /* Do we see any invalid bits in sb_features2? */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 256 if (!xfs_sb_version_hasmorebits(&mp->m_sb)) {
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 257 if (sb->sb_features2 != 0)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 258 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 259 } else {
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 260 v2_ok = XFS_SB_VERSION2_OKBITS;
> d6837c1aab42e7 Dave Chinner 2021-08-18 261 if (xfs_sb_is_v5(&mp->m_sb))
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 262 v2_ok |= XFS_SB_VERSION2_CRCBIT;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 263
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 264 if (!!(sb->sb_features2 & cpu_to_be32(~v2_ok)))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 265 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 266
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 267 if (sb->sb_features2 != sb->sb_bad_features2)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 268 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 269 }
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 270
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 271 /* Check sb_features2 flags that are set at mkfs time. */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 272 features_mask = cpu_to_be32(XFS_SB_VERSION2_LAZYSBCOUNTBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 273 XFS_SB_VERSION2_PROJID32BIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 274 XFS_SB_VERSION2_CRCBIT |
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 275 XFS_SB_VERSION2_FTYPE);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 276 if ((sb->sb_features2 & features_mask) !=
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 277 (cpu_to_be32(mp->m_sb.sb_features2) & features_mask))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 278 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 279
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 280 /* Check sb_features2 flags that can be set after mkfs time. */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 281 features_mask = cpu_to_be32(XFS_SB_VERSION2_ATTR2BIT);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 282 if ((sb->sb_features2 & features_mask) !=
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 283 (cpu_to_be32(mp->m_sb.sb_features2) & features_mask))
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 284 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 285
> 38c26bfd90e199 Dave Chinner 2021-08-18 286 if (!xfs_has_crc(mp)) {
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 287 /* all v5 fields must be zero */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 288 if (memchr_inv(&sb->sb_features_compat, 0,
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 289 sizeof(struct xfs_dsb) -
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 290 offsetof(struct xfs_dsb, sb_features_compat)))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 291 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 292 } else {
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 293 /* compat features must match */
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 294 if (sb->sb_features_compat !=
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 295 cpu_to_be32(mp->m_sb.sb_features_compat))
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 296 xchk_block_set_corrupt(sc, bp);
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 297
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 298 /* ro compat features must match */
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 299 if (sb->sb_features_ro_compat !=
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 300 cpu_to_be32(mp->m_sb.sb_features_ro_compat))
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 301 xchk_block_set_corrupt(sc, bp);
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 302
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 303 /*
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 304 * NEEDSREPAIR is ignored on a secondary super, so we should
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 305 * clear it when we find it, though it's not a corruption.
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 306 */
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 307 features_mask = cpu_to_be32(XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR);
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 308 if ((cpu_to_be32(mp->m_sb.sb_features_incompat) ^
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 309 sb->sb_features_incompat) & features_mask)
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 310 xchk_block_set_preen(sc, bp);
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 311
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 312 /* all other incompat features must match */
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 313 if ((cpu_to_be32(mp->m_sb.sb_features_incompat) ^
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 314 sb->sb_features_incompat) & ~features_mask)
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 315 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 316
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 317 /*
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 318 * log incompat features protect newer log record types from
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 319 * older log recovery code. Log recovery doesn't check the
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 320 * secondary supers, so we can clear these if needed.
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 321 */
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 322 if (sb->sb_features_log_incompat)
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 323 xchk_block_set_preen(sc, bp);
> 4a9bca86806fa6 Darrick J. Wong 2022-01-07 324
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 325 /* Don't care about sb_crc */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 326
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 327 if (sb->sb_spino_align != cpu_to_be32(mp->m_sb.sb_spino_align))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 328 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 329
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 330 if (sb->sb_pquotino != cpu_to_be64(mp->m_sb.sb_pquotino))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 331 xchk_block_set_preen(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 332
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 333 /* Don't care about sb_lsn */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 334 }
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 335
> 38c26bfd90e199 Dave Chinner 2021-08-18 336 if (xfs_has_metauuid(mp)) {
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 337 /* The metadata UUID must be the same for all supers */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 338 if (!uuid_equal(&sb->sb_meta_uuid, &mp->m_sb.sb_meta_uuid))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 339 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 340 }
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 341
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 342 /* Everything else must be zero. */
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 343 if (memchr_inv(sb + 1, 0,
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 344 BBTOB(bp->b_length) - sizeof(struct xfs_dsb)))
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 345 xchk_block_set_corrupt(sc, bp);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 346
> c517b3aa02cff1 Darrick J. Wong 2018-07-19 347 xchk_superblock_xref(sc, bp);
> 48c6615cc55759 Darrick J. Wong 2021-08-06 348 out_pag:
> 48c6615cc55759 Darrick J. Wong 2021-08-06 349 xfs_perag_put(pag);
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 350 return error;
> 21fb4cb1981ef7 Darrick J. Wong 2017-10-17 351 }
> ab9d5dc59fe615 Darrick J. Wong 2017-10-17 352
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp