• David Howells's avatar
    [PATCH] do_generic_file_read / readahead adjustments · 9de05205
    David Howells authored
    This does the following three things:
    
     (1) Makes the functions in mm/readahead.c only use struct file* to pass to
         readpage(). address_mapping* and file_ra_state* are used instead to keep
         track of readahead stuff.
    
     (2) Adds a new function do_generic_mapping_read() that is similar to
         do_generic_file_read(), except that it uses a mapping pointer and a
         readahead state pointer to access a file. The file* is only used to pass
         to readpage().
    
     (3) Turns do_generic_file_read() into an inline function in linux/fs.h that
         simply wraps do_generic_mapping_read().
    
    This should mean that it is no longer necessary to have a struct file to
    access a file in this manner. Just an inode or address space should be
    sufficient.
    
    It also means alternate read-ahead structures can be maintained.
    
    The reason I want this is that I'm writing a general cache manager for
    filesystems such as AFS, NFSv4, and Lustre. Block devices are made available
    to the "cache manager" by means of a filesystem that can be mounted. I'm
    storing meta data in an inode in the cache, but to scan this at the moment I
    need to gain a "struct file" to use with do_generic_file_read().
    
    This involves either creating a dummy dentry and struct file (which will cause
    Al Viro to come looking for me with a shotgun), or to use an extra auxilliary
    filesystem mounted with do_kern_mount(), neither of which are particularly
    appealing.
    
    This patch is the alternative... it provides a function that I can pass an
    address_space to. This also allows me to make use of readahead semantics
    without having to reinvent them for myself.
    9de05205
madvise.c 6.42 KB