Revision c4f675cd40d955d539180506c09515c90169b15b authored by Sergei Trofimovich on 20 May 2011, 20:20:30 UTC, committed by Chris Mason on 23 May 2011, 17:24:14 UTC
Observed as a large delay when --mixed filesystem is filled up. Test example: 1. create tiny --mixed FS: $ dd if=/dev/zero of=2G.img seek=$((2048 * 1024 * 1024 - 1)) count=1 bs=1 $ mkfs.btrfs --mixed 2G.img $ mount -oloop 2G.img /mnt/ut/ 2. Try to fill it up: $ dd if=/dev/urandom of=10M.file bs=10240 count=1024 $ seq 1 256 | while read file_no; do echo $file_no; time cp 10M.file ${file_no}.copy; done Up to '200.copy' it goes fast, but when disk fills-up each -ENOSPC message takes 3 seconds to pop-up _every_ ENOSPC (and in usermode linux it's even more: 30-60 seconds!). (Maybe, time depends on kernel's timer resolution). No IO, no CPU load, just rescheduling. Some debugging revealed busy spinning in shrink_delalloc. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Reviewed-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
1 parent 0f3b708
cpu-notifier-error-inject.c
#include <linux/kernel.h>
#include <linux/cpu.h>
#include <linux/module.h>
#include <linux/notifier.h>
static int priority;
static int cpu_up_prepare_error;
static int cpu_down_prepare_error;
module_param(priority, int, 0);
MODULE_PARM_DESC(priority, "specify cpu notifier priority");
module_param(cpu_up_prepare_error, int, 0644);
MODULE_PARM_DESC(cpu_up_prepare_error,
"specify error code to inject CPU_UP_PREPARE action");
module_param(cpu_down_prepare_error, int, 0644);
MODULE_PARM_DESC(cpu_down_prepare_error,
"specify error code to inject CPU_DOWN_PREPARE action");
static int err_inject_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
int err = 0;
switch (action) {
case CPU_UP_PREPARE:
case CPU_UP_PREPARE_FROZEN:
err = cpu_up_prepare_error;
break;
case CPU_DOWN_PREPARE:
case CPU_DOWN_PREPARE_FROZEN:
err = cpu_down_prepare_error;
break;
}
if (err)
printk(KERN_INFO "Injecting error (%d) at cpu notifier\n", err);
return notifier_from_errno(err);
}
static struct notifier_block err_inject_cpu_notifier = {
.notifier_call = err_inject_cpu_callback,
};
static int err_inject_init(void)
{
err_inject_cpu_notifier.priority = priority;
return register_hotcpu_notifier(&err_inject_cpu_notifier);
}
static void err_inject_exit(void)
{
unregister_hotcpu_notifier(&err_inject_cpu_notifier);
}
module_init(err_inject_init);
module_exit(err_inject_exit);
MODULE_DESCRIPTION("CPU notifier error injection module");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Akinobu Mita <akinobu.mita@gmail.com>");
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...