[Pvfs2-developers] Patch for 2.4 kernels

Murali Vilayannur murali.vilayannur at gmail.com
Mon Mar 5 11:48:18 EST 2007


Hi Ti,
Hmm.. Why is this required?
I was under the assumption that we have a inline function called kzalloc() when
configure fails to detect if kzalloc() was not present..
Perhaps the configure checks failed for some reason?

In any case this patch is not sufficient. We need to call a memset(ptr, 0, size)
after the kmalloc() succeeds in place of the kzalloc.
thanks,
Murali

On 3/5/07, Ti Leggett <leggett at mcs.anl.gov> wrote:
> This patch removes references to kzalloc. It's necessary for 2.4
> kernels (or at least SLES8 2.4 kernels).
>
> --- src/kernel/linux-2.6/file.c.orig    2007-03-05 09:15:43.000000000
> -0600
> +++ src/kernel/linux-2.6/file.c 2007-03-05 09:25:38.000000000 -0600
> @@ -357,7 +357,7 @@
>                   (unsigned long)(nr_segs * sizeof(*orig_iovec)));
>           return -ENOMEM;
>       }
> -    new_iovec = kzalloc(max_new_nr_segs * sizeof(*new_iovec),
> +    new_iovec = (struct iovec *) kmalloc(max_new_nr_segs * sizeof
> (struct iovec)
>               PVFS2_BUFMAP_GFP_FLAGS);
>       if (new_iovec == NULL)
>       {
> @@ -366,7 +366,7 @@
>                   (unsigned long)(max_new_nr_segs * sizeof
> (*new_iovec)));
>           return -ENOMEM;
>       }
> -    sizes = kzalloc(max_new_nr_segs * sizeof(*sizes),
> PVFS2_BUFMAP_GFP_FLAGS);
> +    sizes = (long *) kmalloc(max_new_nr_segs * sizeof(long),
> PVFS2_BUFMAP_GFP_F
>       if (sizes == NULL)
>       {
>           kfree(new_iovec);
> @@ -914,7 +914,7 @@
>                   (unsigned long)(nr_segs * sizeof(*orig_xtvec)));
>           return -ENOMEM;
>       }
> -    new_xtvec = kzalloc(max_new_nr_segs * sizeof(*new_xtvec),
> +    new_xtvec = (struct xtvec *) kmalloc(max_new_nr_segs * sizeof
> (struct xtvec)
>               PVFS2_BUFMAP_GFP_FLAGS);
>       if (new_xtvec == NULL)
>       {
> @@ -923,7 +923,7 @@
>                   (unsigned long)(max_new_nr_segs * sizeof
> (*new_xtvec)));
>           return -ENOMEM;
>       }
> -    sizes = kzalloc(max_new_nr_segs * sizeof(*sizes),
> PVFS2_BUFMAP_GFP_FLAGS);
> +    sizes = (long *) kmalloc(max_new_nr_segs * sizeof(long),
> PVFS2_BUFMAP_GFP_F
>       if (sizes == NULL)
>       {
>           kfree(new_xtvec);
> --- src/kernel/linux-2.6/pvfs2-bufmap.c.orig    2007-03-05
> 09:19:40.000000000 -0
> +++ src/kernel/linux-2.6/pvfs2-bufmap.c 2007-03-05 09:32:27.000000000
> -0600
> @@ -50,7 +50,7 @@
>           goto out;
>       }
>       err = -ENOMEM;
> -    buffer_index_array = kzalloc(ndescs * sizeof(*buffer_index_array),
> +    buffer_index_array = kmalloc(ndescs * sizeof(*buffer_index_array),
>                                    PVFS2_BUFMAP_GFP_FLAGS);
>       if (buffer_index_array == NULL)
>       {
>
> _______________________________________________
> Pvfs2-developers mailing list
> Pvfs2-developers at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
>


More information about the Pvfs2-developers mailing list