提交 a8532cfb 编写于 作者: Z Zheng Liang 提交者: Zheng Zengkai

squashfs: provides backing_dev_info in order to disable read-ahead

hulk inclusion
category: bugfix
bugzilla: 185682 https://gitee.com/openeuler/kernel/issues/I4DDEL

-------------------------------------------------

the commit c1f6925e("mm: put readahead pages in cache earlier")
causes the read performance of squashfs to deteriorate.Through testing,
we find that the performance will be back by closing the readahead of
squashfs. So we want to learn the way of ubifs, provides backing_dev_info
and disable read-ahead.
Signed-off-by: NZheng Liang <zhengliang6@huawei.com>
Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7addd463
......@@ -26,6 +26,7 @@
#include <linux/module.h>
#include <linux/magic.h>
#include <linux/xattr.h>
#include <linux/backing-dev.h>
#include "squashfs_fs.h"
#include "squashfs_fs_sb.h"
......@@ -64,6 +65,24 @@ static const struct squashfs_decompressor *supported_squashfs_filesystem(
return decompressor;
}
static int squashfs_bdi_init(struct super_block *sb)
{
int err;
unsigned int major = MAJOR(sb->s_dev);
unsigned int minor = MINOR(sb->s_dev);
bdi_put(sb->s_bdi);
sb->s_bdi = &noop_backing_dev_info;
err = super_setup_bdi_name(sb, "squashfs_%u_%u", major, minor);
if (err)
return err;
sb->s_bdi->ra_pages = 0;
sb->s_bdi->io_pages = 0;
return 0;
}
static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)
{
......@@ -78,6 +97,19 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)
TRACE("Entered squashfs_fill_superblock\n");
/*
* squashfs provides 'backing_dev_info' in order to disable read-ahead. For
* squashfs, I/O is not deferred, it is done immediately in readpage,
* which means the user would have to wait not just for their own I/O
* but the read-ahead I/O as well i.e. completely pointless.squashfs_bdi_init
* will set sb->s_bdi->ra_pages and sb->s_bdi->io_pages to 0.
*/
err = squashfs_bdi_init(sb);
if (err) {
errorf(fc, "squashfs init bdi failed");
return err;
}
sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL);
if (sb->s_fs_info == NULL) {
ERROR("Failed to allocate squashfs_sb_info\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册