On Tue, Jul 22, 2014 at 03:47:58PM -0400, Matthew Wilcox wrote: > Instead of calling aops->get_xip_mem from the fault handler, the > filesystem passes a get_block_t that is used to find the appropriate > blocks. > > Signed-off-by: Matthew Wilcox <matthew.r.wilcox@xxxxxxxxx> > Reviewed-by: Jan Kara <jack@xxxxxxx> > --- > fs/dax.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > fs/ext2/file.c | 35 ++++++++- > include/linux/fs.h | 4 +- > mm/filemap_xip.c | 206 ------------------------------------------------- > 4 files changed, 257 insertions(+), 209 deletions(-) > ... > +/** > + * dax_fault - handle a page fault on a DAX file > + * @vma: The virtual memory area where the fault occurred > + * @vmf: The description of the fault > + * @get_block: The filesystem method used to translate file offsets to blocks > + * > + * When a page fault occurs, filesystems may call this helper in their > + * fault handler for DAX files. > + */ > +int dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf, > + get_block_t get_block) > +{ > + int result; > + struct super_block *sb = file_inode(vma->vm_file)->i_sb; > + > + if (vmf->flags & FAULT_FLAG_WRITE) { Nobody seems calls sb_start_pagefault() in fault handler. Do you mean FAULT_FLAG_MKWRITE? > + sb_start_pagefault(sb); > + file_update_time(vma->vm_file); > + } > + result = do_dax_fault(vma, vmf, get_block); > + if (vmf->flags & FAULT_FLAG_WRITE) > + sb_end_pagefault(sb); > + > + return result; > +} > +EXPORT_SYMBOL_GPL(dax_fault); > + > +/** > + * dax_mkwrite - convert a read-only page to read-write in a DAX file > + * @vma: The virtual memory area where the fault occurred > + * @vmf: The description of the fault > + * @get_block: The filesystem method used to translate file offsets to blocks > + * > + * DAX handles reads of holes by adding pages full of zeroes into the > + * mapping. If the page is subsequenty written to, we have to allocate > + * the page on media and free the page that was in the cache. > + */ > +int dax_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, > + get_block_t get_block) > +{ > + return dax_fault(vma, vmf, get_block); > +} > +EXPORT_SYMBOL_GPL(dax_mkwrite); I don't think we want to introduce new exported symbol just for dummy wrapper. Just use ".page_mkwrite = foo_fault,". perf and selinux do this. Or add #define into header file if you want better readability. -- Kirill A. Shutemov -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html