diff -uNr cluster-2.02.00-2.6.23/gfs-kernel/src/gfs/main.c cluster-2.02.00-2.6.20/gfs-kernel/src/gfs/main.c --- cluster-2.02.00-2.6.23/gfs-kernel/src/gfs/main.c 2008-02-26 16:37:43.000000000 +0100 +++ cluster-2.02.00-2.6.20/gfs-kernel/src/gfs/main.c 2008-03-21 03:01:47.000000000 +0100 @@ -53,7 +53,7 @@ gfs_glock_cachep = kmem_cache_create("gfs_glock", sizeof(struct gfs_glock), 0, 0, - NULL); + NULL, NULL); gfs_inode_cachep = NULL; gfs_bufdata_cachep = NULL; gfs_mhc_cachep = NULL; @@ -63,19 +63,19 @@ gfs_inode_cachep = kmem_cache_create("gfs_inode", sizeof(struct gfs_inode), 0, 0, - NULL); + NULL, NULL); if (!gfs_inode_cachep) goto fail1; gfs_bufdata_cachep = kmem_cache_create("gfs_bufdata", sizeof(struct gfs_bufdata), 0, 0, - NULL); + NULL, NULL); if (!gfs_bufdata_cachep) goto fail1; gfs_mhc_cachep = kmem_cache_create("gfs_meta_header_cache", sizeof(struct gfs_meta_header_cache), 0, 0, - NULL); + NULL, NULL); if (!gfs_mhc_cachep) goto fail; diff -uNr cluster-2.02.00-2.6.23/gfs-kernel/src/gfs/main.c.orig cluster-2.02.00-2.6.20/gfs-kernel/src/gfs/main.c.orig --- cluster-2.02.00-2.6.23/gfs-kernel/src/gfs/main.c.orig 1970-01-01 01:00:00.000000000 +0100 +++ cluster-2.02.00-2.6.20/gfs-kernel/src/gfs/main.c.orig 2008-02-26 16:37:43.000000000 +0100 @@ -0,0 +1,137 @@ +/****************************************************************************** +******************************************************************************* +** +** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +** Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. +** +** This copyrighted material is made available to anyone wishing to use, +** modify, copy, or redistribute it subject to the terms and conditions +** of the GNU General Public License v.2. +** +******************************************************************************* +******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gfs.h" +#include "ops_fstype.h" +#include "sys.h" +#include "proc.h" + +/** + * init_gfs_fs - Register GFS as a filesystem + * + * Returns: 0 on success, error code on failure + */ + +int __init init_gfs_fs(void) +{ + int error; + struct timespec tv; + +/* gfs2_init_lmh(); gfs2 should do this for us*/ + + error = gfs_sys_init(); + if (error) + return error; + error = gfs_proc_init(); + if (error) + goto fail; + + getnstimeofday(&tv); + gfs_random_number = tv.tv_nsec; + + gfs_glock_cachep = kmem_cache_create("gfs_glock", sizeof(struct gfs_glock), + 0, 0, + NULL); + gfs_inode_cachep = NULL; + gfs_bufdata_cachep = NULL; + gfs_mhc_cachep = NULL; + error = -ENOMEM; + if (!gfs_glock_cachep) + goto fail1; + + gfs_inode_cachep = kmem_cache_create("gfs_inode", sizeof(struct gfs_inode), + 0, 0, + NULL); + if (!gfs_inode_cachep) + goto fail1; + + gfs_bufdata_cachep = kmem_cache_create("gfs_bufdata", sizeof(struct gfs_bufdata), + 0, 0, + NULL); + if (!gfs_bufdata_cachep) + goto fail1; + + gfs_mhc_cachep = kmem_cache_create("gfs_meta_header_cache", sizeof(struct gfs_meta_header_cache), + 0, 0, + NULL); + if (!gfs_mhc_cachep) + goto fail; + + error = register_filesystem(&gfs_fs_type); + if (error) + goto fail; + + printk("GFS %s (built %s %s) installed\n", + RELEASE_VERSION, __DATE__, __TIME__); + + return 0; + + fail1: + if (gfs_mhc_cachep) + kmem_cache_destroy(gfs_mhc_cachep); + + if (gfs_bufdata_cachep) + kmem_cache_destroy(gfs_bufdata_cachep); + + if (gfs_inode_cachep) + kmem_cache_destroy(gfs_inode_cachep); + + if (gfs_glock_cachep) + kmem_cache_destroy(gfs_glock_cachep); + + gfs_proc_uninit(); + + fail: + gfs_sys_uninit(); + + return error; +} + +/** + * exit_gfs_fs - Unregister the file system + * + */ + +void __exit +exit_gfs_fs(void) +{ + unregister_filesystem(&gfs_fs_type); + + kmem_cache_destroy(gfs_mhc_cachep); + kmem_cache_destroy(gfs_bufdata_cachep); + kmem_cache_destroy(gfs_inode_cachep); + kmem_cache_destroy(gfs_glock_cachep); + + gfs_proc_uninit(); + gfs_sys_uninit(); +} + +MODULE_DESCRIPTION("Global File System " RELEASE_VERSION); +MODULE_AUTHOR("Red Hat, Inc."); +MODULE_LICENSE("GPL"); + +module_init(init_gfs_fs); +module_exit(exit_gfs_fs); + diff -uNr cluster-2.02.00-2.6.23/gfs-kernel/src/gfs/ops_export.c cluster-2.02.00-2.6.20/gfs-kernel/src/gfs/ops_export.c --- cluster-2.02.00-2.6.23/gfs-kernel/src/gfs/ops_export.c 2008-03-21 03:01:29.000000000 +0100 +++ cluster-2.02.00-2.6.20/gfs-kernel/src/gfs/ops_export.c 2008-03-21 03:01:47.000000000 +0100 @@ -18,7 +18,6 @@ #include #include #include -#include #include "gfs.h" #include "dio.h" diff -uNr cluster-2.02.00-2.6.23/gfs-kernel/src/gfs/ops_vm.c cluster-2.02.00-2.6.20/gfs-kernel/src/gfs/ops_vm.c --- cluster-2.02.00-2.6.23/gfs-kernel/src/gfs/ops_vm.c 2008-03-21 03:01:29.000000000 +0100 +++ cluster-2.02.00-2.6.20/gfs-kernel/src/gfs/ops_vm.c 2008-03-21 03:01:47.000000000 +0100 @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -52,7 +53,7 @@ } /** - * gfs_private_fault - + * gfs_private_nopage - * @area: * @address: * @type: @@ -60,29 +61,31 @@ * Returns: the page */ -static int gfs_private_fault(struct vm_area_struct *vma, struct vm_fault *vmf) +static struct page * +gfs_private_nopage(struct vm_area_struct *area, + unsigned long address, int *type) { - struct gfs_inode *ip = get_v2ip(vma->vm_file->f_mapping->host); + struct gfs_inode *ip = get_v2ip(area->vm_file->f_mapping->host); struct gfs_holder i_gh; + struct page *result; int error; - int ret = 0; atomic_inc(&ip->i_sbd->sd_ops_vm); error = gfs_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh); if (error) - goto out; + return NULL; set_bit(GIF_PAGED, &ip->i_flags); - ret = filemap_fault(vma, vmf); + result = filemap_nopage(area, address, type); - if (ret && ret != VM_FAULT_OOM) + if (result && result != NOPAGE_OOM) pfault_be_greedy(ip); gfs_glock_dq_uninit(&i_gh); - out: - return ret; + + return result; } /** @@ -167,7 +170,7 @@ } /** - * gfs_sharewrite_fault - + * gfs_sharewrite_nopage - * @area: * @address: * @type: @@ -175,72 +178,61 @@ * Returns: the page */ -static int gfs_sharewrite_fault(struct vm_area_struct *vma, - struct vm_fault *vmf) +static struct page * +gfs_sharewrite_nopage(struct vm_area_struct *area, + unsigned long address, int *type) { - struct file *file = vma->vm_file; - struct gfs_file *gf = file->private_data; - struct gfs_inode *ip = get_v2ip(vma->vm_file->f_mapping->host); + struct gfs_inode *ip = get_v2ip(area->vm_file->f_mapping->host); struct gfs_holder i_gh; + struct page *result = NULL; + unsigned long index = ((address - area->vm_start) >> PAGE_CACHE_SHIFT) + area->vm_pgoff; int alloc_required; int error; - int ret = 0; atomic_inc(&ip->i_sbd->sd_ops_vm); error = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); if (error) - goto out; + return NULL; if (gfs_is_jdata(ip)) - goto out_unlock; + goto out; set_bit(GIF_PAGED, &ip->i_flags); set_bit(GIF_SW_PAGED, &ip->i_flags); - error = gfs_write_alloc_required(ip, - (u64)vmf->pgoff << PAGE_CACHE_SHIFT, + error = gfs_write_alloc_required(ip, (uint64_t)index << PAGE_CACHE_SHIFT, PAGE_CACHE_SIZE, &alloc_required); - if (error) { - ret = VM_FAULT_OOM; /* XXX: are these right? */ - goto out_unlock; - } + if (error) + goto out; - ret = filemap_fault(vma, vmf); - if (ret & VM_FAULT_ERROR) - goto out_unlock; + result = filemap_nopage(area, address, type); + if (!result || result == NOPAGE_OOM) + goto out; if (alloc_required) { - /* XXX: do we need to drop page lock around alloc_page_backing?*/ - error = alloc_page_backing(ip, vmf->page); + error = alloc_page_backing(ip, index); if (error) { - /* - * VM_FAULT_LOCKED should always be the case for - * filemap_fault, but it may not be in a future - * implementation. - */ - if (ret & VM_FAULT_LOCKED) - unlock_page(vmf->page); - page_cache_release(vmf->page); - ret = VM_FAULT_OOM; - goto out_unlock; + page_cache_release(result); + result = NULL; + goto out; } - set_page_dirty(vmf->page); + set_page_dirty(result); } pfault_be_greedy(ip); - out_unlock: - gfs_glock_dq_uninit(&i_gh); out: - return ret; + gfs_glock_dq_uninit(&i_gh); + + return result; } struct vm_operations_struct gfs_vm_ops_private = { - .fault = gfs_private_fault, + .nopage = gfs_private_nopage, }; struct vm_operations_struct gfs_vm_ops_sharewrite = { - .fault = gfs_sharewrite_fault, + .nopage = gfs_sharewrite_nopage, };