Merge pull request #1642 from robertbaldyga/xfs-ioclass-fix
Fix io classification for XFS
This commit is contained in:
commit
99af7ee9b5
45
configure.d/1_page_mapping.conf
Normal file
45
configure.d/1_page_mapping.conf
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright(c) 2025 Huawei Technologies
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
. $(dirname $3)/conf_framework.sh
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cur_name=$(basename $2)
|
||||||
|
config_file_path=$1
|
||||||
|
if compile_module $cur_name "page_folio((struct page *)NULL);" "linux/page-flags.h"
|
||||||
|
then
|
||||||
|
echo $cur_name "1" >> $config_file_path
|
||||||
|
else
|
||||||
|
echo $cur_name "2" >> $config_file_path
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
apply() {
|
||||||
|
case "$1" in
|
||||||
|
"1")
|
||||||
|
add_function "
|
||||||
|
static inline struct address_space *cas_page_mapping(struct page *page)
|
||||||
|
{
|
||||||
|
struct folio *folio = page_folio(page);
|
||||||
|
|
||||||
|
return folio->mapping;
|
||||||
|
}" ;;
|
||||||
|
|
||||||
|
"2")
|
||||||
|
add_function "
|
||||||
|
static inline struct address_space *cas_page_mapping(struct page *page)
|
||||||
|
{
|
||||||
|
if (PageCompound(page))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return page->mapping;
|
||||||
|
}" ;;
|
||||||
|
*)
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
conf_run $@
|
@ -53,7 +53,7 @@ static cas_cls_eval_t _cas_cls_metadata_test(struct cas_classifier *cls,
|
|||||||
if (PageAnon(io->page))
|
if (PageAnon(io->page))
|
||||||
return cas_cls_eval_no;
|
return cas_cls_eval_no;
|
||||||
|
|
||||||
if (PageSlab(io->page) || PageCompound(io->page)) {
|
if (PageSlab(io->page)) {
|
||||||
/* A filesystem issues IO on pages that does not belongs
|
/* A filesystem issues IO on pages that does not belongs
|
||||||
* to the file page cache. It means that it is a
|
* to the file page cache. It means that it is a
|
||||||
* part of metadata
|
* part of metadata
|
||||||
@ -61,7 +61,7 @@ static cas_cls_eval_t _cas_cls_metadata_test(struct cas_classifier *cls,
|
|||||||
return cas_cls_eval_yes;
|
return cas_cls_eval_yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!io->page->mapping) {
|
if (!cas_page_mapping(io->page)) {
|
||||||
/* XFS case, page are allocated internally and do not
|
/* XFS case, page are allocated internally and do not
|
||||||
* have references into inode
|
* have references into inode
|
||||||
*/
|
*/
|
||||||
@ -1229,6 +1229,7 @@ static void _cas_cls_get_bio_context(struct bio *bio,
|
|||||||
struct cas_cls_io *ctx)
|
struct cas_cls_io *ctx)
|
||||||
{
|
{
|
||||||
struct page *page = NULL;
|
struct page *page = NULL;
|
||||||
|
struct address_space *mapping;
|
||||||
|
|
||||||
if (!bio)
|
if (!bio)
|
||||||
return;
|
return;
|
||||||
@ -1246,13 +1247,14 @@ static void _cas_cls_get_bio_context(struct bio *bio,
|
|||||||
if (PageAnon(page))
|
if (PageAnon(page))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (PageSlab(page) || PageCompound(page))
|
if (PageSlab(page))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!page->mapping)
|
mapping = cas_page_mapping(page);
|
||||||
|
if (!mapping)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ctx->inode = page->mapping->host;
|
ctx->inode = mapping->host;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user