You are not logged in.

#1 2005-01-31 14:23:48

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

generating readahead.list

just thought of sharing this info -

seems the task of creating a dynamic readahead.list is not as trivial as one may think. there are several ways suggested (LD_PRELOAD, strace, kernel CONFIG_AUDIT, auditd daemon) todo this, but i only got the first two to work, and both impact performance and results are not perfect. Erich Schubert from the debian project got to work with the auditd but seems it works only partially.

so, the only (good) solution i could come up with, is patching the kernel...
its fairly ugly hack and shouldnt be used for a working machine, but its a nice solution for creating a dynamic readahead.list - i use it for my Archie project.

the patches :
in fs/open.c add in file_open() :

        struct file * f;
        mm_segment_t fs;

        fs = get_fs();
        set_fs(KERNEL_DS);
        error = open_namei("/readahead.filp",O_WRONLY|O_CREAT|O_APPEND, 00777, &nd);
        if (!error)
        {
                f=dentry_open(nd.dentry, nd.mnt, O_WRONLY|O_CREAT|O_APPEND);
                f->f_pos=f->f_dentry->d_inode->i_size;
                error=strlen(filename);
                f->f_op->write(f, filename, error, &f->f_pos);
                f->f_op->write(f, "n", 1, &f->f_pos);
                filp_close(f, NULL);
        }
        set_fs(fs);

and in fs/exec.c add in open_exec() :

        mm_segment_t fs;
        struct file *f;

        fs = get_fs();
        set_fs(KERNEL_DS);
        err = open_namei("/readahead.exec",O_WRONLY|O_CREAT|O_APPEND, 00777, &nd);
        if (!err)
        {
                f=dentry_open(nd.dentry, nd.mnt, O_WRONLY|O_CREAT|O_APPEND);
                f->f_pos=f->f_dentry->d_inode->i_size;
                err=strlen(name);
                f->f_op->write(f, name, err, &f->f_pos);
                f->f_op->write(f, "n", 1, &f->f_pos);
                filp_close(f, NULL);
        }
        set_fs(fs);

hope this helps someone else too.

Offline

#2 2005-01-31 15:40:54

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: generating readahead.list

If you preload all files that are opened then you load too much, you only want to load the blocks that are used.

Offline

#3 2005-01-31 15:57:48

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

Re: generating readahead.list

very true, but i dont think the readahead wrapper works with blocks - it input filenames and process them accordingly, though maybe changing it for blocks behavior will prove itself better. i will look into it when i finish making a working Archie...
regarding having a "bloated" lists - this is only for testings and learning. the lists shouldnt be used as-is.

Offline

#4 2005-02-01 15:33:46

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: generating readahead.list

what is Archie doing?


arch + gentoo + initng + python = enlisy

Offline

#5 2005-02-01 16:11:07

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

Offline

Board footer

Powered by FluxBB