From cec72a356891eaa729314a7bc89c4b2aaef0a31b Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Thu, 17 Feb 2011 19:46:53 -0800 Subject: [PATCH] b=22980 improve obdfilter-survey performance on multi-core system 1) Add unlock_ioctl support. 2) Land OBD_ALLOC_LARGE() patch from b4424 to avoid vmalloc in ioctl path. 3) Minor fix in class_handle_ioctl() to avoid double free. Issue: LU-66 Change-Id: Id965cd13fdaeb63197c30e557708afbfa9ee9f39 Signed-off-by: Niu Yawei Reviewed-on: http://review.whamcloud.com/247 Tested-by: Hudson Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- lustre/include/lu_object.h | 1 - lustre/include/lustre_lib.h | 10 +++----- lustre/include/lustre_net.h | 4 --- lustre/include/obd.h | 8 +++--- lustre/include/obd_support.h | 31 +++++++++++++++++++++++ lustre/llite/dir.c | 4 +-- lustre/llite/file.c | 36 ++++++++++++++++++++------- lustre/llite/rw26.c | 6 ++--- lustre/lmv/lmv_obd.c | 8 +++--- lustre/lmv/lmv_object.c | 6 ++--- lustre/lov/lov_ea.c | 8 +++--- lustre/lov/lov_io.c | 12 ++++----- lustre/lov/lov_lock.c | 5 ++-- lustre/lov/lov_obd.c | 4 +-- lustre/lov/lov_object.c | 4 +-- lustre/lov/lov_pack.c | 8 +++--- lustre/lov/lov_qos.c | 10 ++++---- lustre/lov/lov_request.c | 19 +++++++------- lustre/mdd/mdd_dir.c | 4 +-- lustre/mdd/mdd_object.c | 45 +++++++++------------------------- lustre/mdt/mdt_handler.c | 8 +++--- lustre/mdt/mdt_open.c | 4 +-- lustre/mdt/mdt_reint.c | 4 +-- lustre/mdt/mdt_xattr.c | 4 +-- lustre/obdclass/class_obd.c | 2 +- lustre/obdclass/darwin/darwin-module.c | 5 ++-- lustre/obdclass/linux/linux-module.c | 21 ++++++++++++---- lustre/obdclass/llog_ioctl.c | 4 +-- lustre/obdclass/lustre_handles.c | 4 +-- lustre/obdecho/echo_client.c | 4 +++ lustre/ptlrpc/client.c | 4 +-- lustre/ptlrpc/gss/gss_generic_token.c | 2 +- lustre/ptlrpc/gss/gss_krb5_mech.c | 12 ++++----- lustre/ptlrpc/gss/gss_rawobj.c | 10 ++++---- lustre/ptlrpc/gss/sec_gss.c | 36 +++++++++++++-------------- lustre/ptlrpc/llog_server.c | 4 +-- lustre/ptlrpc/sec.c | 10 ++++---- lustre/ptlrpc/sec_null.c | 16 ++++++------ lustre/ptlrpc/sec_plain.c | 16 ++++++------ lustre/ptlrpc/service.c | 34 +++++-------------------- lustre/tests/obdfilter-survey.sh | 1 + 41 files changed, 226 insertions(+), 212 deletions(-) diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 15ebba6..10df803 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1259,7 +1259,6 @@ struct lu_name { struct lu_buf { void *lb_buf; ssize_t lb_len; - int lb_vmalloc:1; }; /** null buffer */ diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index df7105b..cf9d4a7 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -364,9 +364,7 @@ static inline int obd_ioctl_getdata(char **buf, int *len, void *arg) RETURN(-EINVAL); } - /* XXX allocate this more intelligently, using kmalloc when - * appropriate */ - OBD_VMALLOC(*buf, hdr.ioc_len); + OBD_ALLOC_LARGE(*buf, hdr.ioc_len); if (*buf == NULL) { CERROR("Cannot allocate control buffer of len %d\n", hdr.ioc_len); @@ -377,13 +375,13 @@ static inline int obd_ioctl_getdata(char **buf, int *len, void *arg) err = cfs_copy_from_user(*buf, (void *)arg, hdr.ioc_len); if (err) { - OBD_VFREE(*buf, hdr.ioc_len); + OBD_FREE_LARGE(*buf, hdr.ioc_len); RETURN(err); } if (obd_ioctl_is_invalid(data)) { CERROR("ioctl not correctly formatted\n"); - OBD_VFREE(*buf, hdr.ioc_len); + OBD_FREE_LARGE(*buf, hdr.ioc_len); RETURN(-EINVAL); } @@ -422,7 +420,7 @@ static inline void obd_ioctl_freedata(char *buf, int len) { ENTRY; - OBD_VFREE(buf, len); + OBD_FREE_LARGE(buf, len); EXIT; return; } diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index f74547c..a38059e 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -106,10 +106,6 @@ # endif #endif /* __KERNEL__ */ -/* Size over which to OBD_VMALLOC() rather than OBD_ALLOC() service request - * buffers */ -#define SVC_BUF_VMALLOC_THRESHOLD (2 * CFS_PAGE_SIZE) - /** * The following constants determine how memory is used to buffer incoming * service requests. diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 5491b3c..3b73a4b 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -862,8 +862,8 @@ static inline void oti_alloc_cookies(struct obd_trans_info *oti,int num_cookies) if (num_cookies == 1) oti->oti_logcookies = &oti->oti_onecookie; else - OBD_ALLOC(oti->oti_logcookies, - num_cookies * sizeof(oti->oti_onecookie)); + OBD_ALLOC_LARGE(oti->oti_logcookies, + num_cookies * sizeof(oti->oti_onecookie)); oti->oti_numcookies = num_cookies; } @@ -876,8 +876,8 @@ static inline void oti_free_cookies(struct obd_trans_info *oti) if (oti->oti_logcookies == &oti->oti_onecookie) LASSERT(oti->oti_numcookies == 1); else - OBD_FREE(oti->oti_logcookies, - oti->oti_numcookies * sizeof(oti->oti_onecookie)); + OBD_FREE_LARGE(oti->oti_logcookies, + oti->oti_numcookies*sizeof(oti->oti_onecookie)); oti->oti_logcookies = NULL; oti->oti_numcookies = 0; } diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 78c7a97..4a8cd08 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -695,6 +695,37 @@ do { \ } while(0) #endif +#ifdef __KERNEL__ + +/* Allocations above this size are considered too big and could not be done + * atomically. + * + * Be very careful when changing this value, especially when decreasing it, + * since vmalloc in Linux doesn't perform well on multi-cores system, calling + * vmalloc in critical path would hurt peformance badly. See LU-66. + */ +#define OBD_ALLOC_BIG (4 * CFS_PAGE_SIZE) + +#define OBD_ALLOC_LARGE(ptr, size) \ +do { \ + if (size > OBD_ALLOC_BIG) \ + OBD_VMALLOC(ptr, size); \ + else \ + OBD_ALLOC(ptr, size); \ +} while (0) + +#define OBD_FREE_LARGE(ptr, size) \ +do { \ + if (size > OBD_ALLOC_BIG) \ + OBD_VFREE(ptr, size); \ + else \ + OBD_FREE(ptr, size); \ +} while (0) +#else +#define OBD_ALLOC_LARGE(ptr, size) OBD_ALLOC(ptr, size) +#define OBD_FREE_LARGE(ptr, size) OBD_FREE(ptr,size) +#endif + #ifdef CONFIG_DEBUG_SLAB #define POISON(ptr, c, s) do {} while (0) #define POISON_PTR(ptr) ((void)0) diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 3ea338a..bb93357 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -969,7 +969,7 @@ out_free: if (rc) RETURN(rc); - OBD_ALLOC(lmm, lmmsize); + OBD_ALLOC_LARGE(lmm, lmmsize); if (cfs_copy_from_user(lmm, lum, lmmsize)) GOTO(free_lmm, rc = -EFAULT); @@ -1014,7 +1014,7 @@ out_free: free_lsm: obd_free_memmd(sbi->ll_dt_exp, &lsm); free_lmm: - OBD_FREE(lmm, lmmsize); + OBD_FREE_LARGE(lmm, lmmsize); return rc; } case OBD_IOC_LLOG_CATINFO: { diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 957694b..acb2272 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1229,7 +1229,7 @@ static int ll_lov_recreate(struct inode *inode, obd_id id, obd_seq seq, lsm_size = sizeof(*lsm) + (sizeof(struct lov_oinfo) * (lsm->lsm_stripe_count)); - OBD_ALLOC(lsm2, lsm_size); + OBD_ALLOC_LARGE(lsm2, lsm_size); if (lsm2 == NULL) GOTO(out, rc = -ENOMEM); @@ -1243,7 +1243,7 @@ static int ll_lov_recreate(struct inode *inode, obd_id id, obd_seq seq, memcpy(lsm2, lsm, lsm_size); rc = obd_create(exp, oa, &lsm2, &oti); - OBD_FREE(lsm2, lsm_size); + OBD_FREE_LARGE(lsm2, lsm_size); GOTO(out, rc); out: ll_inode_size_unlock(inode, 0); @@ -1414,18 +1414,18 @@ static int ll_lov_setea(struct inode *inode, struct file *file, if (!cfs_capable(CFS_CAP_SYS_ADMIN)) RETURN(-EPERM); - OBD_ALLOC(lump, lum_size); + OBD_ALLOC_LARGE(lump, lum_size); if (lump == NULL) { RETURN(-ENOMEM); } if (cfs_copy_from_user(lump, (struct lov_user_md *)arg, lum_size)) { - OBD_FREE(lump, lum_size); + OBD_FREE_LARGE(lump, lum_size); RETURN(-EFAULT); } rc = ll_lov_setstripe_ea_info(inode, file, flags, lump, lum_size); - OBD_FREE(lump, lum_size); + OBD_FREE_LARGE(lump, lum_size); RETURN(rc); } @@ -1698,7 +1698,7 @@ static int ll_ioctl_fiemap(struct inode *inode, unsigned long arg) num_bytes = sizeof(*fiemap_s) + (extent_count * sizeof(struct ll_fiemap_extent)); - OBD_VMALLOC(fiemap_s, num_bytes); + OBD_ALLOC_LARGE(fiemap_s, num_bytes); if (fiemap_s == NULL) RETURN(-ENOMEM); @@ -1731,13 +1731,19 @@ static int ll_ioctl_fiemap(struct inode *inode, unsigned long arg) rc = -EFAULT; error: - OBD_VFREE(fiemap_s, num_bytes); + OBD_FREE_LARGE(fiemap_s, num_bytes); RETURN(rc); } +#ifdef HAVE_UNLOCKED_IOCTL +long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + struct inode *inode = file->f_dentry->d_inode; +#else int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { +#endif struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int flags; ENTRY; @@ -2340,7 +2346,7 @@ int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, num_bytes = sizeof(*fiemap) + (extent_count * sizeof(struct ll_fiemap_extent)); - OBD_VMALLOC(fiemap, num_bytes); + OBD_ALLOC_LARGE(fiemap, num_bytes); if (fiemap == NULL) RETURN(-ENOMEM); @@ -2359,7 +2365,7 @@ int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, memcpy(fieinfo->fi_extents_start, &fiemap->fm_extents[0], fiemap->fm_mapped_extents * sizeof(struct ll_fiemap_extent)); - OBD_VFREE(fiemap, num_bytes); + OBD_FREE_LARGE(fiemap, num_bytes); return rc; } #endif @@ -2493,7 +2499,11 @@ struct file_operations ll_file_operations = { .READ_METHOD = READ_FUNCTION, .write = ll_file_write, .WRITE_METHOD = WRITE_FUNCTION, +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = ll_file_ioctl, +#else .ioctl = ll_file_ioctl, +#endif .open = ll_file_open, .release = ll_file_release, .mmap = ll_file_mmap, @@ -2513,7 +2523,11 @@ struct file_operations ll_file_operations_flock = { .READ_METHOD = READ_FUNCTION, .write = ll_file_write, .WRITE_METHOD = WRITE_FUNCTION, +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = ll_file_ioctl, +#else .ioctl = ll_file_ioctl, +#endif .open = ll_file_open, .release = ll_file_release, .mmap = ll_file_mmap, @@ -2538,7 +2552,11 @@ struct file_operations ll_file_operations_noflock = { .READ_METHOD = READ_FUNCTION, .write = ll_file_write, .WRITE_METHOD = WRITE_FUNCTION, +#ifdef HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = ll_file_ioctl, +#else .ioctl = ll_file_ioctl, +#endif .open = ll_file_open, .release = ll_file_release, .mmap = ll_file_mmap, diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 2e4e32c..3475469 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -187,7 +187,7 @@ static inline int ll_get_user_pages(int rw, unsigned long user_addr, *max_pages = (user_addr + size + CFS_PAGE_SIZE - 1) >> CFS_PAGE_SHIFT; *max_pages -= user_addr >> CFS_PAGE_SHIFT; - OBD_ALLOC_WAIT(*pages, *max_pages * sizeof(**pages)); + OBD_ALLOC_LARGE(*pages, *max_pages * sizeof(**pages)); if (*pages) { down_read(¤t->mm->mmap_sem); result = get_user_pages(current, current->mm, user_addr, @@ -195,7 +195,7 @@ static inline int ll_get_user_pages(int rw, unsigned long user_addr, NULL); up_read(¤t->mm->mmap_sem); if (unlikely(result <= 0)) - OBD_FREE(*pages, *max_pages * sizeof(**pages)); + OBD_FREE_LARGE(*pages, *max_pages * sizeof(**pages)); } return result; @@ -215,7 +215,7 @@ static void ll_free_user_pages(struct page **pages, int npages, int do_dirty) page_cache_release(pages[i]); } - OBD_FREE(pages, npages * sizeof(*pages)); + OBD_FREE_LARGE(pages, npages * sizeof(*pages)); } ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index e5ec165..95ee481 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -2694,13 +2694,13 @@ int lmv_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, RETURN(mea_size); if (*lmmp && !lsm) { - OBD_FREE(*lmmp, mea_size); + OBD_FREE_LARGE(*lmmp, mea_size); *lmmp = NULL; RETURN(0); } if (*lmmp == NULL) { - OBD_ALLOC(*lmmp, mea_size); + OBD_ALLOC_LARGE(*lmmp, mea_size); if (*lmmp == NULL) RETURN(-ENOMEM); } @@ -2744,14 +2744,14 @@ int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, return mea_size; if (*lsmp != NULL && lmm == NULL) { - OBD_FREE(*tmea, mea_size); + OBD_FREE_LARGE(*tmea, mea_size); *lsmp = NULL; RETURN(0); } LASSERT(mea_size == lmm_size); - OBD_ALLOC(*tmea, mea_size); + OBD_ALLOC_LARGE(*tmea, mea_size); if (*tmea == NULL) RETURN(-ENOMEM); diff --git a/lustre/lmv/lmv_object.c b/lustre/lmv/lmv_object.c index 81b44e2..e5d459b 100644 --- a/lustre/lmv/lmv_object.c +++ b/lustre/lmv/lmv_object.c @@ -96,12 +96,10 @@ struct lmv_object *lmv_object_alloc(struct obd_device *obd, obj_size = sizeof(struct lmv_stripe) * lmv->desc.ld_tgt_count; - OBD_ALLOC(obj->lo_stripes, obj_size); + OBD_ALLOC_LARGE(obj->lo_stripes, obj_size); if (!obj->lo_stripes) goto err_obj; - memset(obj->lo_stripes, 0, obj_size); - CDEBUG(D_INODE, "Allocate object for "DFID"\n", PFID(fid)); for (i = 0; i < mea->mea_count; i++) { @@ -138,7 +136,7 @@ void lmv_object_free(struct lmv_object *obj) obj_size = sizeof(struct lmv_stripe) * lmv->desc.ld_tgt_count; - OBD_FREE(obj->lo_stripes, obj_size); + OBD_FREE_LARGE(obj->lo_stripes, obj_size); OBD_SLAB_FREE(obj, lmv_object_cache, sizeof(*obj)); cfs_atomic_dec(&lmv_object_count); } diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index d658407..cb09efa 100755 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -105,7 +105,7 @@ struct lov_stripe_md *lsm_alloc_plain(int stripe_count, int *size) oinfo_ptrs_size = sizeof(struct lov_oinfo *) * stripe_count; *size = sizeof(struct lov_stripe_md) + oinfo_ptrs_size; - OBD_ALLOC(lsm, *size); + OBD_ALLOC_LARGE(lsm, *size); if (!lsm) return NULL;; @@ -122,7 +122,7 @@ struct lov_stripe_md *lsm_alloc_plain(int stripe_count, int *size) err: while (--i >= 0) OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, sizeof(*loi)); - OBD_FREE(lsm, *size); + OBD_FREE_LARGE(lsm, *size); return NULL; } @@ -134,8 +134,8 @@ void lsm_free_plain(struct lov_stripe_md *lsm) for (i = 0; i < stripe_count; i++) OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, sizeof(struct lov_oinfo)); - OBD_FREE(lsm, sizeof(struct lov_stripe_md) + - stripe_count * sizeof(struct lov_oinfo *)); + OBD_FREE_LARGE(lsm, sizeof(struct lov_stripe_md) + + stripe_count * sizeof(struct lov_oinfo *)); } static void lsm_unpackmd_common(struct lov_stripe_md *lsm, diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 1f72ad6..2d61ee1 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -279,8 +279,8 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio, * Need to be optimized, we can't afford to allocate a piece of memory * when writing a page. -jay */ - OBD_ALLOC(lio->lis_subs, - lsm->lsm_stripe_count * sizeof lio->lis_subs[0]); + OBD_ALLOC_LARGE(lio->lis_subs, + lsm->lsm_stripe_count * sizeof lio->lis_subs[0]); if (lio->lis_subs != NULL) { lio->lis_nr_subios = lio->lis_stripe_count; lio->lis_single_subio_index = -1; @@ -352,7 +352,7 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) if (lio->lis_subs != NULL) { for (i = 0; i < lio->lis_nr_subios; i++) lov_io_sub_fini(env, lio, &lio->lis_subs[i]); - OBD_FREE(lio->lis_subs, + OBD_FREE_LARGE(lio->lis_subs, lio->lis_nr_subios * sizeof lio->lis_subs[0]); lio->lis_nr_subios = 0; } @@ -595,8 +595,8 @@ static int lov_io_submit(const struct lu_env *env, LASSERT(lio->lis_subs != NULL); if (alloc) { - OBD_ALLOC(stripes_qin, - sizeof(*stripes_qin) * lio->lis_nr_subios); + OBD_ALLOC_LARGE(stripes_qin, + sizeof(*stripes_qin) * lio->lis_nr_subios); if (stripes_qin == NULL) RETURN(-ENOMEM); @@ -649,7 +649,7 @@ static int lov_io_submit(const struct lu_env *env, } if (alloc) { - OBD_FREE(stripes_qin, + OBD_FREE_LARGE(stripes_qin, sizeof(*stripes_qin) * lio->lis_nr_subios); } else { int i; diff --git a/lustre/lov/lov_lock.c b/lustre/lov/lov_lock.c index 1c118f0..d633309 100644 --- a/lustre/lov/lov_lock.c +++ b/lustre/lov/lov_lock.c @@ -321,7 +321,7 @@ static int lov_lock_sub_init(const struct lu_env *env, nr++; } LASSERT(nr > 0); - OBD_ALLOC(lck->lls_sub, nr * sizeof lck->lls_sub[0]); + OBD_ALLOC_LARGE(lck->lls_sub, nr * sizeof lck->lls_sub[0]); if (lck->lls_sub == NULL) RETURN(-ENOMEM); @@ -485,7 +485,8 @@ static void lov_lock_fini(const struct lu_env *env, * a reference on its parent. */ LASSERT(lck->lls_sub[i].sub_lock == NULL); - OBD_FREE(lck->lls_sub, lck->lls_nr * sizeof lck->lls_sub[0]); + OBD_FREE_LARGE(lck->lls_sub, + lck->lls_nr * sizeof lck->lls_sub[0]); } OBD_SLAB_FREE_PTR(lck, lov_lock_kmem); EXIT; diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index c13ccaf..5d3aca4 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -2332,7 +2332,7 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key, if (fiemap_count_to_size(fm_key->fiemap.fm_extent_count) < buffer_size) buffer_size = fiemap_count_to_size(fm_key->fiemap.fm_extent_count); - OBD_ALLOC(fm_local, buffer_size); + OBD_ALLOC_LARGE(fm_local, buffer_size); if (fm_local == NULL) GOTO(out, rc = -ENOMEM); lcl_fm_ext = &fm_local->fm_extents[0]; @@ -2523,7 +2523,7 @@ skip_last_device_calc: fiemap->fm_mapped_extents = current_extent; out: - OBD_FREE(fm_local, buffer_size); + OBD_FREE_LARGE(fm_local, buffer_size); return rc; } diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index 2a6d7c9..1c8c259 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -183,7 +183,7 @@ static int lov_init_raid0(const struct lu_env *env, r0->lo_lsm = conf->u.coc_md->lsm; LASSERT(r0->lo_nr <= lov_targets_nr(dev)); - OBD_ALLOC(r0->lo_sub, r0->lo_nr * sizeof r0->lo_sub[0]); + OBD_ALLOC_LARGE(r0->lo_sub, r0->lo_nr * sizeof r0->lo_sub[0]); if (r0->lo_sub != NULL) { result = 0; subconf->coc_inode = conf->coc_inode; @@ -300,7 +300,7 @@ static void lov_fini_raid0(const struct lu_env *env, struct lov_object *lov, ENTRY; if (r0->lo_sub != NULL) { - OBD_FREE(r0->lo_sub, r0->lo_nr * sizeof r0->lo_sub[0]); + OBD_FREE_LARGE(r0->lo_sub, r0->lo_nr * sizeof r0->lo_sub[0]); r0->lo_sub = NULL; } EXIT; diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 33b1a79..9e09afd 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -187,13 +187,13 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, if (*lmmp && !lsm) { stripe_count = le32_to_cpu((*lmmp)->lmm_stripe_count); lmm_size = lov_mds_md_size(stripe_count, lmm_magic); - OBD_FREE(*lmmp, lmm_size); + OBD_FREE_LARGE(*lmmp, lmm_size); *lmmp = NULL; RETURN(0); } if (!*lmmp) { - OBD_ALLOC(*lmmp, lmm_size); + OBD_ALLOC_LARGE(*lmmp, lmm_size); if (!*lmmp) RETURN(-ENOMEM); } @@ -271,7 +271,7 @@ static int lov_verify_lmm(void *lmm, int lmm_bytes, int *stripe_count) CERROR("bad disk LOV MAGIC: 0x%08X; dumping LMM (size=%d):\n", le32_to_cpu(*(__u32 *)lmm), lmm_bytes); sz = lmm_bytes * 2 + 1; - OBD_ALLOC(buffer, sz); + OBD_ALLOC_LARGE(buffer, sz); if (buffer != NULL) { int i; @@ -279,7 +279,7 @@ static int lov_verify_lmm(void *lmm, int lmm_bytes, int *stripe_count) sprintf(buffer+2*i, "%.2X", ((char *)lmm)[i]); buffer[sz] = '\0'; CERROR("%s\n", buffer); - OBD_FREE(buffer, sz); + OBD_FREE_LARGE(buffer, sz); } return -EINVAL; } diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index 8c40022..7d8ae11 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -461,7 +461,7 @@ void qos_shrink_lsm(struct lov_request_set *set) oti_alloc_cookies(set->set_oti, set->set_count); if (set->set_oti->oti_logcookies) { memcpy(set->set_oti->oti_logcookies, cookies, newsize); - OBD_FREE(cookies, oldsize); + OBD_FREE_LARGE(cookies, oldsize); set->set_cookies = set->set_oti->oti_logcookies; } else { CWARN("'leaking' %d bytes\n", oldsize - newsize); @@ -473,7 +473,7 @@ void qos_shrink_lsm(struct lov_request_set *set) LASSERT(lsm->lsm_stripe_count >= set->set_count); newsize = lov_stripe_md_size(set->set_count); - OBD_ALLOC(lsm_new, newsize); + OBD_ALLOC_LARGE(lsm_new, newsize); if (lsm_new != NULL) { int i; memcpy(lsm_new, lsm, sizeof(*lsm)); @@ -486,8 +486,8 @@ void qos_shrink_lsm(struct lov_request_set *set) sizeof(struct lov_oinfo)); } lsm_new->lsm_stripe_count = set->set_count; - OBD_FREE(lsm, sizeof(struct lov_stripe_md) + - lsm->lsm_stripe_count * sizeof(struct lov_oinfo *)); + OBD_FREE_LARGE(lsm, sizeof(struct lov_stripe_md) + + lsm->lsm_stripe_count*sizeof(struct lov_oinfo*)); set->set_oi->oi_md = lsm_new; } else { CWARN("'leaking' few bytes\n"); @@ -1074,7 +1074,7 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set) lov_set_add_req(req, set); req->rq_buflen = sizeof(*req->rq_oi.oi_md); - OBD_ALLOC(req->rq_oi.oi_md, req->rq_buflen); + OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen); if (req->rq_oi.oi_md == NULL) GOTO(out_err, rc = -ENOMEM); diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 79d2943..d61101d 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -78,7 +78,7 @@ void lov_finish_set(struct lov_request_set *set) if (req->rq_oi.oi_oa) OBDO_FREE(req->rq_oi.oi_oa); if (req->rq_oi.oi_md) - OBD_FREE(req->rq_oi.oi_md, req->rq_buflen); + OBD_FREE_LARGE(req->rq_oi.oi_md, req->rq_buflen); if (req->rq_oi.oi_osfs) OBD_FREE(req->rq_oi.oi_osfs, sizeof(*req->rq_oi.oi_osfs)); @@ -87,7 +87,7 @@ void lov_finish_set(struct lov_request_set *set) if (set->set_pga) { int len = set->set_oabufs * sizeof(*set->set_pga); - OBD_FREE(set->set_pga, len); + OBD_FREE_LARGE(set->set_pga, len); } if (set->set_lockh) lov_llh_put(set->set_lockh); @@ -316,7 +316,7 @@ int lov_prep_enqueue_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_buflen = sizeof(*req->rq_oi.oi_md) + sizeof(struct lov_oinfo *) + sizeof(struct lov_oinfo); - OBD_ALLOC(req->rq_oi.oi_md, req->rq_buflen); + OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen); if (req->rq_oi.oi_md == NULL) { OBD_FREE(req, sizeof(*req)); GOTO(out_set, rc = -ENOMEM); @@ -437,7 +437,7 @@ int lov_prep_match_set(struct obd_export *exp, struct obd_info *oinfo, GOTO(out_set, rc = -ENOMEM); req->rq_buflen = sizeof(*req->rq_oi.oi_md); - OBD_ALLOC(req->rq_oi.oi_md, req->rq_buflen); + OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen); if (req->rq_oi.oi_md == NULL) { OBD_FREE(req, sizeof(*req)); GOTO(out_set, rc = -ENOMEM); @@ -524,7 +524,7 @@ int lov_prep_cancel_set(struct obd_export *exp, struct obd_info *oinfo, GOTO(out_set, rc = -ENOMEM); req->rq_buflen = sizeof(*req->rq_oi.oi_md); - OBD_ALLOC(req->rq_oi.oi_md, req->rq_buflen); + OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen); if (req->rq_oi.oi_md == NULL) { OBD_FREE(req, sizeof(*req)); GOTO(out_set, rc = -ENOMEM); @@ -875,11 +875,11 @@ int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo, set->set_oti = oti; set->set_oi = oinfo; set->set_oabufs = oa_bufs; - OBD_ALLOC(set->set_pga, oa_bufs * sizeof(*set->set_pga)); + OBD_ALLOC_LARGE(set->set_pga, oa_bufs * sizeof(*set->set_pga)); if (!set->set_pga) GOTO(out, rc = -ENOMEM); - OBD_ALLOC(info, sizeof(*info) * oinfo->oi_md->lsm_stripe_count); + OBD_ALLOC_LARGE(info, sizeof(*info) * oinfo->oi_md->lsm_stripe_count); if (!info) GOTO(out, rc = -ENOMEM); @@ -924,7 +924,7 @@ int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_oi.oi_oa->o_stripe_idx = i; req->rq_buflen = sizeof(*req->rq_oi.oi_md); - OBD_ALLOC(req->rq_oi.oi_md, req->rq_buflen); + OBD_ALLOC_LARGE(req->rq_oi.oi_md, req->rq_buflen); if (req->rq_oi.oi_md == NULL) { OBDO_FREE(req->rq_oi.oi_oa); OBD_FREE(req, sizeof(*req)); @@ -964,7 +964,8 @@ int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo, } out: if (info) - OBD_FREE(info, sizeof(*info) * oinfo->oi_md->lsm_stripe_count); + OBD_FREE_LARGE(info, + sizeof(*info) * oinfo->oi_md->lsm_stripe_count); if (rc == 0) *reqset = set; diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 61a4b4b..f0efe38 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -2442,7 +2442,7 @@ static int mdd_links_add(const struct lu_env *env, PFID(mdd_object_fid(mdd_obj))); } - if (buf->lb_vmalloc) + if (buf->lb_len > OBD_ALLOC_BIG) /* if we vmalloced a large buffer drop it */ mdd_buf_put(buf); @@ -2529,7 +2529,7 @@ out: oldlname->ln_namelen, oldlname->ln_name, rc, PFID(mdd_object_fid(mdd_obj))); - if (buf->lb_vmalloc) + if (buf->lb_len > OBD_ALLOC_BIG) /* if we vmalloced a large buffer drop it */ mdd_buf_put(buf); diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 6209af9..0b12f77 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -126,10 +126,7 @@ void mdd_buf_put(struct lu_buf *buf) { if (buf == NULL || buf->lb_buf == NULL) return; - if (buf->lb_vmalloc) - OBD_VFREE(buf->lb_buf, buf->lb_len); - else - OBD_FREE(buf->lb_buf, buf->lb_len); + OBD_FREE_LARGE(buf->lb_buf, buf->lb_len); buf->lb_buf = NULL; buf->lb_len = 0; } @@ -145,28 +142,17 @@ const struct lu_buf *mdd_buf_get_const(const struct lu_env *env, return buf; } -#define BUF_VMALLOC_SIZE (CFS_PAGE_SIZE<<2) /* 16k */ struct lu_buf *mdd_buf_alloc(const struct lu_env *env, ssize_t len) { struct lu_buf *buf = &mdd_env_info(env)->mti_big_buf; if ((len > buf->lb_len) && (buf->lb_buf != NULL)) { - if (buf->lb_vmalloc) - OBD_VFREE(buf->lb_buf, buf->lb_len); - else - OBD_FREE(buf->lb_buf, buf->lb_len); + OBD_FREE_LARGE(buf->lb_buf, buf->lb_len); buf->lb_buf = NULL; } if (buf->lb_buf == NULL) { buf->lb_len = len; - if (buf->lb_len <= BUF_VMALLOC_SIZE) { - OBD_ALLOC(buf->lb_buf, buf->lb_len); - buf->lb_vmalloc = 0; - } - if (buf->lb_buf == NULL) { - OBD_VMALLOC(buf->lb_buf, buf->lb_len); - buf->lb_vmalloc = 1; - } + OBD_ALLOC_LARGE(buf->lb_buf, buf->lb_len); if (buf->lb_buf == NULL) buf->lb_len = 0; } @@ -184,23 +170,15 @@ int mdd_buf_grow(const struct lu_env *env, ssize_t len) struct lu_buf buf; LASSERT(len >= oldbuf->lb_len); - if (len > BUF_VMALLOC_SIZE) { - OBD_VMALLOC(buf.lb_buf, len); - buf.lb_vmalloc = 1; - } else { - OBD_ALLOC(buf.lb_buf, len); - buf.lb_vmalloc = 0; - } + OBD_ALLOC_LARGE(buf.lb_buf, len); + if (buf.lb_buf == NULL) return -ENOMEM; buf.lb_len = len; memcpy(buf.lb_buf, oldbuf->lb_buf, oldbuf->lb_len); - if (oldbuf->lb_vmalloc) - OBD_VFREE(oldbuf->lb_buf, oldbuf->lb_len); - else - OBD_FREE(oldbuf->lb_buf, oldbuf->lb_len); + OBD_FREE_LARGE(oldbuf->lb_buf, oldbuf->lb_len); memcpy(oldbuf, &buf, sizeof(buf)); @@ -216,12 +194,13 @@ struct llog_cookie *mdd_max_cookie_get(const struct lu_env *env, max_cookie_size = mdd_lov_cookiesize(env, mdd); if (unlikely(mti->mti_max_cookie_size < max_cookie_size)) { if (mti->mti_max_cookie) - OBD_FREE(mti->mti_max_cookie, mti->mti_max_cookie_size); + OBD_FREE_LARGE(mti->mti_max_cookie, + mti->mti_max_cookie_size); mti->mti_max_cookie = NULL; mti->mti_max_cookie_size = 0; } if (unlikely(mti->mti_max_cookie == NULL)) { - OBD_ALLOC(mti->mti_max_cookie, max_cookie_size); + OBD_ALLOC_LARGE(mti->mti_max_cookie, max_cookie_size); if (likely(mti->mti_max_cookie != NULL)) mti->mti_max_cookie_size = max_cookie_size; } @@ -239,12 +218,12 @@ struct lov_mds_md *mdd_max_lmm_get(const struct lu_env *env, max_lmm_size = mdd_lov_mdsize(env, mdd); if (unlikely(mti->mti_max_lmm_size < max_lmm_size)) { if (mti->mti_max_lmm) - OBD_FREE(mti->mti_max_lmm, mti->mti_max_lmm_size); + OBD_FREE_LARGE(mti->mti_max_lmm, mti->mti_max_lmm_size); mti->mti_max_lmm = NULL; mti->mti_max_lmm_size = 0; } if (unlikely(mti->mti_max_lmm == NULL)) { - OBD_ALLOC(mti->mti_max_lmm, max_lmm_size); + OBD_ALLOC_LARGE(mti->mti_max_lmm, max_lmm_size); if (likely(mti->mti_max_lmm != NULL)) mti->mti_max_lmm_size = max_lmm_size; } @@ -509,7 +488,7 @@ static int mdd_path_current(const struct lu_env *env, EXIT; out: - if (buf && !IS_ERR(buf) && buf->lb_vmalloc) + if (buf && !IS_ERR(buf) && buf->lb_len > OBD_ALLOC_BIG) /* if we vmalloced a large buffer drop it */ mdd_buf_put(buf); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index c411615..1cb5d07 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5121,12 +5121,12 @@ static int mdt_export_cleanup(struct obd_export *exp) int cookie_size; lmm_size = mdt->mdt_max_mdsize; - OBD_ALLOC(ma->ma_lmm, lmm_size); + OBD_ALLOC_LARGE(ma->ma_lmm, lmm_size); if (ma->ma_lmm == NULL) GOTO(out_lmm, rc = -ENOMEM); cookie_size = mdt->mdt_max_cookiesize; - OBD_ALLOC(ma->ma_cookie, cookie_size); + OBD_ALLOC_LARGE(ma->ma_cookie, cookie_size); if (ma->ma_cookie == NULL) GOTO(out_cookie, rc = -ENOMEM); @@ -5143,10 +5143,10 @@ static int mdt_export_cleanup(struct obd_export *exp) ma->ma_valid = MA_FLAGS; mdt_mfd_close(info, mfd); } - OBD_FREE(ma->ma_cookie, cookie_size); + OBD_FREE_LARGE(ma->ma_cookie, cookie_size); ma->ma_cookie = NULL; out_cookie: - OBD_FREE(ma->ma_lmm, lmm_size); + OBD_FREE_LARGE(ma->ma_lmm, lmm_size); ma->ma_lmm = NULL; } out_lmm: diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index d581b82..98155cd 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -1664,13 +1664,13 @@ int mdt_done_writing(struct mdt_thread_info *info) info->mti_attr.ma_valid = 0; info->mti_attr.ma_lmm_size = info->mti_mdt->mdt_max_mdsize; - OBD_ALLOC(info->mti_attr.ma_lmm, info->mti_mdt->mdt_max_mdsize); + OBD_ALLOC_LARGE(info->mti_attr.ma_lmm, info->mti_mdt->mdt_max_mdsize); if (info->mti_attr.ma_lmm == NULL) RETURN(-ENOMEM); rc = mdt_mfd_close(info, mfd); - OBD_FREE(info->mti_attr.ma_lmm, info->mti_mdt->mdt_max_mdsize); + OBD_FREE_LARGE(info->mti_attr.ma_lmm, info->mti_mdt->mdt_max_mdsize); mdt_empty_transno(info); RETURN(rc); } diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index c142d53..343fcc9 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -557,13 +557,13 @@ static int mdt_reint_setattr(struct mdt_thread_info *info, /* Close the found mfd, update attributes. */ ma->ma_lmm_size = info->mti_mdt->mdt_max_mdsize; - OBD_ALLOC(ma->ma_lmm, info->mti_mdt->mdt_max_mdsize); + OBD_ALLOC_LARGE(ma->ma_lmm, info->mti_mdt->mdt_max_mdsize); if (ma->ma_lmm == NULL) GOTO(out_put, rc = -ENOMEM); mdt_mfd_close(info, mfd); - OBD_FREE(ma->ma_lmm, info->mti_mdt->mdt_max_mdsize); + OBD_FREE_LARGE(ma->ma_lmm, info->mti_mdt->mdt_max_mdsize); } else { rc = mdt_attr_set(info, mo, ma, rr->rr_flags); if (rc) diff --git a/lustre/mdt/mdt_xattr.c b/lustre/mdt/mdt_xattr.c index 0e5cc6d..631dab5 100644 --- a/lustre/mdt/mdt_xattr.c +++ b/lustre/mdt/mdt_xattr.c @@ -248,7 +248,7 @@ static int mdt_rmtlsetfacl(struct mdt_thread_info *info, buf->lb_len = rc; if (buf->lb_len > 0) { - OBD_ALLOC(buf->lb_buf, buf->lb_len); + OBD_ALLOC_LARGE(buf->lb_buf, buf->lb_len); if (unlikely(buf->lb_buf == NULL)) RETURN(-ENOMEM); @@ -266,7 +266,7 @@ static int mdt_rmtlsetfacl(struct mdt_thread_info *info, _out: if (rc <= 0 && buf->lb_buf != NULL) - OBD_FREE(buf->lb_buf, buf->lb_len); + OBD_FREE_LARGE(buf->lb_buf, buf->lb_len); return rc; } diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 8b1c3a8..8b10a64 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -159,7 +159,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) CDEBUG(D_IOCTL, "cmd = %x\n", cmd); if (obd_ioctl_getdata(&buf, &len, (void *)arg)) { CERROR("OBD ioctl: data error\n"); - GOTO(out, err = -EINVAL); + RETURN(-EINVAL); } data = (struct obd_ioctl_data *)buf; diff --git a/lustre/obdclass/darwin/darwin-module.c b/lustre/obdclass/darwin/darwin-module.c index 9269abe..3a6cf5d 100644 --- a/lustre/obdclass/darwin/darwin-module.c +++ b/lustre/obdclass/darwin/darwin-module.c @@ -80,9 +80,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg) RETURN(-EINVAL); } - /* XXX allocate this more intelligently, using kmalloc when - * appropriate */ - OBD_VMALLOC(*buf, hdr->ioc_len); + OBD_ALLOC_LARGE(*buf, hdr->ioc_len); if (*buf == NULL) { CERROR("Cannot allocate control buffer of len %d\n", hdr->ioc_len); @@ -99,6 +97,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg) if (obd_ioctl_is_invalid(data)) { CERROR("ioctl not correctly formatted\n"); + OBD_FREE_LARGE(*buf, hdr->ioc_len); return -EINVAL; } diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 4b6ca83..335ce71 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -120,9 +120,11 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg) RETURN(-EINVAL); } - /* XXX allocate this more intelligently, using kmalloc when - * appropriate */ - OBD_VMALLOC(*buf, hdr.ioc_len); + /* When there are lots of processes calling vmalloc on multi-core + * system, the high lock contention will hurt performance badly, + * obdfilter-survey is an example, which relies on ioctl. So we'd + * better avoid vmalloc on ioctl path. LU-66 */ + OBD_ALLOC_LARGE(*buf, hdr.ioc_len); if (*buf == NULL) { CERROR("Cannot allocate control buffer of len %d\n", hdr.ioc_len); @@ -133,13 +135,13 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg) err = cfs_copy_from_user(*buf, (void *)arg, hdr.ioc_len); if ( err ) { - OBD_VFREE(*buf, hdr.ioc_len); + OBD_FREE_LARGE(*buf, hdr.ioc_len); RETURN(err); } if (obd_ioctl_is_invalid(data)) { CERROR("ioctl not correctly formatted\n"); - OBD_VFREE(*buf, hdr.ioc_len); + OBD_FREE_LARGE(*buf, hdr.ioc_len); RETURN(-EINVAL); } @@ -198,8 +200,13 @@ static int obd_class_release(struct inode * inode, struct file * file) } /* to control /dev/obd */ +#ifdef HAVE_UNLOCKED_IOCTL +static long obd_class_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) +#else static int obd_class_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) +#endif { int err = 0; ENTRY; @@ -218,7 +225,11 @@ static int obd_class_ioctl(struct inode *inode, struct file *filp, /* declare character device */ static struct file_operations obd_psdev_fops = { .owner = THIS_MODULE, +#if HAVE_UNLOCKED_IOCTL + .unlocked_ioctl = obd_class_ioctl, /* unlocked_ioctl */ +#else .ioctl = obd_class_ioctl, /* ioctl */ +#endif .open = obd_class_open, /* open */ .release = obd_class_release, /* release */ }; diff --git a/lustre/obdclass/llog_ioctl.c b/lustre/obdclass/llog_ioctl.c index 601bc42..3cc0700 100644 --- a/lustre/obdclass/llog_ioctl.c +++ b/lustre/obdclass/llog_ioctl.c @@ -433,7 +433,7 @@ int llog_catalog_list(struct obd_device *obd, int count, ENTRY; size = sizeof(*idarray) * count; - OBD_VMALLOC(idarray, size); + OBD_ALLOC_LARGE(idarray, size); if (!idarray) RETURN(-ENOMEM); @@ -460,7 +460,7 @@ out: /* release semaphore */ cfs_mutex_up(&obd->obd_olg.olg_cat_processing); - OBD_VFREE(idarray, size); + OBD_FREE_LARGE(idarray, size); RETURN(rc); } diff --git a/lustre/obdclass/lustre_handles.c b/lustre/obdclass/lustre_handles.c index c0b4012..6213536 100644 --- a/lustre/obdclass/lustre_handles.c +++ b/lustre/obdclass/lustre_handles.c @@ -220,7 +220,7 @@ int class_handle_init(void) LASSERT(handle_hash == NULL); - OBD_VMALLOC(handle_hash, sizeof(*bucket) * HANDLE_HASH_SIZE); + OBD_ALLOC_LARGE(handle_hash, sizeof(*bucket) * HANDLE_HASH_SIZE); if (handle_hash == NULL) return -ENOMEM; @@ -271,7 +271,7 @@ void class_handle_cleanup(void) count = cleanup_all_handles(); - OBD_VFREE(handle_hash, sizeof(*handle_hash) * HANDLE_HASH_SIZE); + OBD_FREE_LARGE(handle_hash, sizeof(*handle_hash) * HANDLE_HASH_SIZE); handle_hash = NULL; if (count != 0) diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 9d548e0..c412303 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -1800,7 +1800,9 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int i; ENTRY; +#ifndef HAVE_UNLOCKED_IOCTL cfs_unlock_kernel(); +#endif memset(&dummy_oti, 0, sizeof(dummy_oti)); @@ -1931,7 +1933,9 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, ldlm_lock_decref(&ack_lock->lock, ack_lock->mode); } +#ifndef HAVE_UNLOCKED_IOCTL cfs_lock_kernel(); +#endif return rc; } diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 214be9c..796d289 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -412,7 +412,7 @@ void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool) cfs_list_del(&req->rq_list); LASSERT(req->rq_reqbuf); LASSERT(req->rq_reqbuf_len == pool->prp_rq_size); - OBD_FREE(req->rq_reqbuf, pool->prp_rq_size); + OBD_FREE_LARGE(req->rq_reqbuf, pool->prp_rq_size); OBD_FREE(req, sizeof(*req)); } cfs_spin_unlock(&pool->prp_lock); @@ -445,7 +445,7 @@ void ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq) OBD_ALLOC(req, sizeof(struct ptlrpc_request)); if (!req) return; - OBD_ALLOC_GFP(msg, size, CFS_ALLOC_STD); + OBD_ALLOC_LARGE(msg, size); if (!msg) { OBD_FREE(req, sizeof(struct ptlrpc_request)); return; diff --git a/lustre/ptlrpc/gss/gss_generic_token.c b/lustre/ptlrpc/gss/gss_generic_token.c index db32608..bc5778b 100644 --- a/lustre/ptlrpc/gss/gss_generic_token.c +++ b/lustre/ptlrpc/gss/gss_generic_token.c @@ -283,7 +283,7 @@ __u32 g_get_mech_oid(rawobj_t *mech, rawobj_t *in_buf) if ((len -= mech->len) < 0) return (G_BAD_TOK_HEADER); - OBD_ALLOC(mech->data, mech->len); + OBD_ALLOC_LARGE(mech->data, mech->len); if (!mech->data) return (G_BUFFER_ALLOC); memcpy(mech->data, buf, mech->len); diff --git a/lustre/ptlrpc/gss/gss_krb5_mech.c b/lustre/ptlrpc/gss/gss_krb5_mech.c index 4b7900f..e3b4d85 100644 --- a/lustre/ptlrpc/gss/gss_krb5_mech.c +++ b/lustre/ptlrpc/gss/gss_krb5_mech.c @@ -240,7 +240,7 @@ int get_rawobj(char **ptr, const char *end, rawobj_t *res) if (q > end || q < p) return -1; - OBD_ALLOC(res->data, len); + OBD_ALLOC_LARGE(res->data, len); if (!res->data) return -1; @@ -256,12 +256,12 @@ int get_keyblock(char **ptr, const char *end, { char *buf; - OBD_ALLOC(buf, keysize); + OBD_ALLOC_LARGE(buf, keysize); if (buf == NULL) return -1; if (get_bytes(ptr, end, buf, keysize)) { - OBD_FREE(buf, keysize); + OBD_FREE_LARGE(buf, keysize); return -1; } @@ -735,7 +735,7 @@ __s32 krb5_make_checksum(__u32 enctype, } cksum->len = ll_crypto_hash_digestsize(tfm); - OBD_ALLOC(cksum->data, cksum->len); + OBD_ALLOC_LARGE(cksum->data, cksum->len); if (!cksum->data) { cksum->len = 0; goto out_tfm; @@ -1563,7 +1563,7 @@ __u32 gss_unwrap_kerberos(struct gss_ctx *gctx, } /* decrypting */ - OBD_ALLOC(tmpbuf, bodysize); + OBD_ALLOC_LARGE(tmpbuf, bodysize); if (!tmpbuf) return GSS_S_FAILURE; @@ -1660,7 +1660,7 @@ arc4_out: major = GSS_S_COMPLETE; out_free: - OBD_FREE(tmpbuf, bodysize); + OBD_FREE_LARGE(tmpbuf, bodysize); rawobj_free(&cksum); return major; } diff --git a/lustre/ptlrpc/gss/gss_rawobj.c b/lustre/ptlrpc/gss/gss_rawobj.c index 1a88b45..6df81d6 100644 --- a/lustre/ptlrpc/gss/gss_rawobj.c +++ b/lustre/ptlrpc/gss/gss_rawobj.c @@ -65,7 +65,7 @@ int rawobj_alloc(rawobj_t *obj, char *buf, int len) obj->len = len; if (len) { - OBD_ALLOC(obj->data, len); + OBD_ALLOC_LARGE(obj->data, len); if (!obj->data) { obj->len = 0; RETURN(-ENOMEM); @@ -82,7 +82,7 @@ void rawobj_free(rawobj_t *obj) if (obj->len) { LASSERT(obj->data); - OBD_FREE(obj->data, obj->len); + OBD_FREE_LARGE(obj->data, obj->len); obj->len = 0; obj->data = NULL; } else @@ -103,7 +103,7 @@ int rawobj_dup(rawobj_t *dest, rawobj_t *src) dest->len = src->len; if (dest->len) { - OBD_ALLOC(dest->data, dest->len); + OBD_ALLOC_LARGE(dest->data, dest->len); if (!dest->data) { dest->len = 0; return -ENOMEM; @@ -167,7 +167,7 @@ static int __rawobj_extract(rawobj_t *obj, __u32 **buf, __u32 *buflen, if (!alloc) obj->data = (__u8 *) *buf; else { - OBD_ALLOC(obj->data, obj->len); + OBD_ALLOC_LARGE(obj->data, obj->len); if (!obj->data) { CERROR("fail to alloc %u bytes\n", obj->len); obj->len = 0; @@ -217,7 +217,7 @@ int rawobj_from_netobj_alloc(rawobj_t *rawobj, netobj_t *netobj) if (netobj->len == 0) return 0; - OBD_ALLOC(rawobj->data, netobj->len); + OBD_ALLOC_LARGE(rawobj->data, netobj->len); if (rawobj->data == NULL) return -ENOMEM; diff --git a/lustre/ptlrpc/gss/sec_gss.c b/lustre/ptlrpc/gss/sec_gss.c index 74b0d33..672f1cb 100644 --- a/lustre/ptlrpc/gss/sec_gss.c +++ b/lustre/ptlrpc/gss/sec_gss.c @@ -296,7 +296,7 @@ __u32 gss_unseal_msg(struct gss_ctx *mechctx, /* allocate a temporary clear text buffer, same sized as token, * we assume the final clear text size <= token size */ clear_buflen = lustre_msg_buflen(msgbuf, 1); - OBD_ALLOC(clear_buf, clear_buflen); + OBD_ALLOC_LARGE(clear_buf, clear_buflen); if (!clear_buf) RETURN(GSS_S_FAILURE); @@ -322,7 +322,7 @@ __u32 gss_unseal_msg(struct gss_ctx *mechctx, major = GSS_S_COMPLETE; out_free: - OBD_FREE(clear_buf, clear_buflen); + OBD_FREE_LARGE(clear_buf, clear_buflen); RETURN(major); } @@ -919,7 +919,7 @@ int gss_cli_ctx_seal(struct ptlrpc_cli_ctx *ctx, LASSERT(req->rq_reqbuf != req->rq_clrbuf); LASSERT(req->rq_reqbuf_len >= wiresize); } else { - OBD_ALLOC(req->rq_reqbuf, wiresize); + OBD_ALLOC_LARGE(req->rq_reqbuf, wiresize); if (!req->rq_reqbuf) RETURN(-ENOMEM); req->rq_reqbuf_len = wiresize; @@ -979,7 +979,7 @@ redo: err_free: if (!req->rq_pool) { - OBD_FREE(req->rq_reqbuf, req->rq_reqbuf_len); + OBD_FREE_LARGE(req->rq_reqbuf, req->rq_reqbuf_len); req->rq_reqbuf = NULL; req->rq_reqbuf_len = 0; } @@ -1316,7 +1316,7 @@ int gss_alloc_reqbuf_intg(struct ptlrpc_sec *sec, if (!req->rq_reqbuf) { bufsize = size_roundup_power2(bufsize); - OBD_ALLOC(req->rq_reqbuf, bufsize); + OBD_ALLOC_LARGE(req->rq_reqbuf, bufsize); if (!req->rq_reqbuf) RETURN(-ENOMEM); @@ -1403,7 +1403,7 @@ int gss_alloc_reqbuf_priv(struct ptlrpc_sec *sec, if (!req->rq_clrbuf) { clearsize = size_roundup_power2(clearsize); - OBD_ALLOC(req->rq_clrbuf, clearsize); + OBD_ALLOC_LARGE(req->rq_clrbuf, clearsize); if (!req->rq_clrbuf) RETURN(-ENOMEM); } @@ -1464,7 +1464,7 @@ void gss_free_reqbuf(struct ptlrpc_sec *sec, req->rq_clrbuf < req->rq_reqbuf || (char *) req->rq_clrbuf >= (char *) req->rq_reqbuf + req->rq_reqbuf_len) - OBD_FREE(req->rq_clrbuf, req->rq_clrbuf_len); + OBD_FREE_LARGE(req->rq_clrbuf, req->rq_clrbuf_len); req->rq_clrbuf = NULL; req->rq_clrbuf_len = 0; @@ -1473,7 +1473,7 @@ release_reqbuf: if (!req->rq_pool && req->rq_reqbuf) { LASSERT(req->rq_reqbuf_len); - OBD_FREE(req->rq_reqbuf, req->rq_reqbuf_len); + OBD_FREE_LARGE(req->rq_reqbuf, req->rq_reqbuf_len); req->rq_reqbuf = NULL; req->rq_reqbuf_len = 0; } @@ -1485,7 +1485,7 @@ static int do_alloc_repbuf(struct ptlrpc_request *req, int bufsize) { bufsize = size_roundup_power2(bufsize); - OBD_ALLOC(req->rq_repbuf, bufsize); + OBD_ALLOC_LARGE(req->rq_repbuf, bufsize); if (!req->rq_repbuf) return -ENOMEM; @@ -1605,7 +1605,7 @@ int gss_alloc_repbuf(struct ptlrpc_sec *sec, void gss_free_repbuf(struct ptlrpc_sec *sec, struct ptlrpc_request *req) { - OBD_FREE(req->rq_repbuf, req->rq_repbuf_len); + OBD_FREE_LARGE(req->rq_repbuf, req->rq_repbuf_len); req->rq_repbuf = NULL; req->rq_repbuf_len = 0; req->rq_repdata = NULL; @@ -1701,13 +1701,13 @@ int gss_enlarge_reqbuf_intg(struct ptlrpc_sec *sec, if (req->rq_reqbuf_len < newbuf_size) { newbuf_size = size_roundup_power2(newbuf_size); - OBD_ALLOC(newbuf, newbuf_size); + OBD_ALLOC_LARGE(newbuf, newbuf_size); if (newbuf == NULL) RETURN(-ENOMEM); memcpy(newbuf, req->rq_reqbuf, req->rq_reqbuf_len); - OBD_FREE(req->rq_reqbuf, req->rq_reqbuf_len); + OBD_FREE_LARGE(req->rq_reqbuf, req->rq_reqbuf_len); req->rq_reqbuf = newbuf; req->rq_reqbuf_len = newbuf_size; req->rq_reqmsg = lustre_msg_buf(req->rq_reqbuf, 1, 0); @@ -1790,7 +1790,7 @@ int gss_enlarge_reqbuf_priv(struct ptlrpc_sec *sec, if (req->rq_clrbuf_len < newclrbuf_size) { newclrbuf_size = size_roundup_power2(newclrbuf_size); - OBD_ALLOC(newclrbuf, newclrbuf_size); + OBD_ALLOC_LARGE(newclrbuf, newclrbuf_size); if (newclrbuf == NULL) RETURN(-ENOMEM); @@ -1800,7 +1800,7 @@ int gss_enlarge_reqbuf_priv(struct ptlrpc_sec *sec, req->rq_clrbuf < req->rq_reqbuf || (char *) req->rq_clrbuf >= (char *) req->rq_reqbuf + req->rq_reqbuf_len) { - OBD_FREE(req->rq_clrbuf, req->rq_clrbuf_len); + OBD_FREE_LARGE(req->rq_clrbuf, req->rq_clrbuf_len); } req->rq_clrbuf = newclrbuf; @@ -2579,7 +2579,7 @@ int gss_svc_alloc_rs(struct ptlrpc_request *req, int msglen) /* pre-allocated */ LASSERT(rs->rs_size >= rs_size); } else { - OBD_ALLOC(rs, rs_size); + OBD_ALLOC_LARGE(rs, rs_size); if (rs == NULL) RETURN(-ENOMEM); @@ -2651,7 +2651,7 @@ static int gss_svc_seal(struct ptlrpc_request *req, /* allocate temporary cipher buffer */ token_buflen = gss_mech_payload(gctx->gsc_mechctx, msglen, 1); - OBD_ALLOC(token_buf, token_buflen); + OBD_ALLOC_LARGE(token_buf, token_buflen); if (token_buf == NULL) RETURN(-ENOMEM); @@ -2708,7 +2708,7 @@ static int gss_svc_seal(struct ptlrpc_request *req, rc = 0; out_free: - OBD_FREE(token_buf, token_buflen); + OBD_FREE_LARGE(token_buf, token_buflen); RETURN(rc); } @@ -2769,7 +2769,7 @@ void gss_svc_free_rs(struct ptlrpc_reply_state *rs) rs->rs_svc_ctx = NULL; if (!rs->rs_prealloc) - OBD_FREE(rs, rs->rs_size); + OBD_FREE_LARGE(rs, rs->rs_size); } void gss_svc_free_ctx(struct ptlrpc_svc_ctx *ctx) diff --git a/lustre/ptlrpc/llog_server.c b/lustre/ptlrpc/llog_server.c index db59ddc..3929127 100644 --- a/lustre/ptlrpc/llog_server.c +++ b/lustre/ptlrpc/llog_server.c @@ -601,7 +601,7 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf, count = mds->mds_lov_desc.ld_tgt_count; size = sizeof(*idarray) * count; - OBD_VMALLOC(idarray, size); + OBD_ALLOC_LARGE(idarray, size); if (!idarray) GOTO(release_ctxt, rc = -ENOMEM); @@ -652,7 +652,7 @@ out_pop: pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL); out_free: cfs_mutex_up(&obd->obd_olg.olg_cat_processing); - OBD_VFREE(idarray, size); + OBD_FREE_LARGE(idarray, size); release_ctxt: llog_ctxt_put(ctxt); return rc; diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index 1a0cd25..1531475 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -482,7 +482,7 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req, /* save request message */ reqmsg_size = req->rq_reqlen; if (reqmsg_size != 0) { - OBD_ALLOC(reqmsg, reqmsg_size); + OBD_ALLOC_LARGE(reqmsg, reqmsg_size); if (reqmsg == NULL) return -ENOMEM; memcpy(reqmsg, req->rq_reqmsg, reqmsg_size); @@ -510,7 +510,7 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req, req->rq_flvr = old_flvr; } - OBD_FREE(reqmsg, reqmsg_size); + OBD_FREE_LARGE(reqmsg, reqmsg_size); } return rc; } @@ -1109,7 +1109,7 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, early_size = req->rq_nob_received; early_bufsz = size_roundup_power2(early_size); - OBD_ALLOC(early_buf, early_bufsz); + OBD_ALLOC_LARGE(early_buf, early_bufsz); if (early_buf == NULL) GOTO(err_req, rc = -ENOMEM); @@ -1173,7 +1173,7 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, err_ctx: sptlrpc_cli_ctx_put(early_req->rq_cli_ctx, 1); err_buf: - OBD_FREE(early_buf, early_bufsz); + OBD_FREE_LARGE(early_buf, early_bufsz); err_req: OBD_FREE_PTR(early_req); RETURN(rc); @@ -1191,7 +1191,7 @@ void sptlrpc_cli_finish_early_reply(struct ptlrpc_request *early_req) LASSERT(early_req->rq_repmsg); sptlrpc_cli_ctx_put(early_req->rq_cli_ctx, 1); - OBD_FREE(early_req->rq_repbuf, early_req->rq_repbuf_len); + OBD_FREE_LARGE(early_req->rq_repbuf, early_req->rq_repbuf_len); OBD_FREE_PTR(early_req); } diff --git a/lustre/ptlrpc/sec_null.c b/lustre/ptlrpc/sec_null.c index 4fc2242..911e3dc 100644 --- a/lustre/ptlrpc/sec_null.c +++ b/lustre/ptlrpc/sec_null.c @@ -173,7 +173,7 @@ int null_alloc_reqbuf(struct ptlrpc_sec *sec, int alloc_size = size_roundup_power2(msgsize); LASSERT(!req->rq_pool); - OBD_ALLOC(req->rq_reqbuf, alloc_size); + OBD_ALLOC_LARGE(req->rq_reqbuf, alloc_size); if (!req->rq_reqbuf) return -ENOMEM; @@ -200,7 +200,7 @@ void null_free_reqbuf(struct ptlrpc_sec *sec, "req %p: reqlen %d should smaller than buflen %d\n", req, req->rq_reqlen, req->rq_reqbuf_len); - OBD_FREE(req->rq_reqbuf, req->rq_reqbuf_len); + OBD_FREE_LARGE(req->rq_reqbuf, req->rq_reqbuf_len); req->rq_reqbuf = NULL; req->rq_reqbuf_len = 0; } @@ -216,7 +216,7 @@ int null_alloc_repbuf(struct ptlrpc_sec *sec, msgsize = size_roundup_power2(msgsize); - OBD_ALLOC(req->rq_repbuf, msgsize); + OBD_ALLOC_LARGE(req->rq_repbuf, msgsize); if (!req->rq_repbuf) return -ENOMEM; @@ -230,7 +230,7 @@ void null_free_repbuf(struct ptlrpc_sec *sec, { LASSERT(req->rq_repbuf); - OBD_FREE(req->rq_repbuf, req->rq_repbuf_len); + OBD_FREE_LARGE(req->rq_repbuf, req->rq_repbuf_len); req->rq_repbuf = NULL; req->rq_repbuf_len = 0; } @@ -261,13 +261,13 @@ int null_enlarge_reqbuf(struct ptlrpc_sec *sec, if (req->rq_reqbuf_len < newmsg_size) { alloc_size = size_roundup_power2(newmsg_size); - OBD_ALLOC(newbuf, alloc_size); + OBD_ALLOC_LARGE(newbuf, alloc_size); if (newbuf == NULL) return -ENOMEM; memcpy(newbuf, req->rq_reqbuf, req->rq_reqlen); - OBD_FREE(req->rq_reqbuf, req->rq_reqbuf_len); + OBD_FREE_LARGE(req->rq_reqbuf, req->rq_reqbuf_len); req->rq_reqbuf = req->rq_reqmsg = newbuf; req->rq_reqbuf_len = alloc_size; } @@ -319,7 +319,7 @@ int null_alloc_rs(struct ptlrpc_request *req, int msgsize) /* pre-allocated */ LASSERT(rs->rs_size >= rs_size); } else { - OBD_ALLOC(rs, rs_size); + OBD_ALLOC_LARGE(rs, rs_size); if (rs == NULL) return -ENOMEM; @@ -344,7 +344,7 @@ void null_free_rs(struct ptlrpc_reply_state *rs) cfs_atomic_dec(&rs->rs_svc_ctx->sc_refcount); if (!rs->rs_prealloc) - OBD_FREE(rs, rs->rs_size); + OBD_FREE_LARGE(rs, rs->rs_size); } static diff --git a/lustre/ptlrpc/sec_plain.c b/lustre/ptlrpc/sec_plain.c index 0e2bd16..b0b9035 100644 --- a/lustre/ptlrpc/sec_plain.c +++ b/lustre/ptlrpc/sec_plain.c @@ -591,7 +591,7 @@ int plain_alloc_reqbuf(struct ptlrpc_sec *sec, LASSERT(!req->rq_pool); alloc_len = size_roundup_power2(alloc_len); - OBD_ALLOC(req->rq_reqbuf, alloc_len); + OBD_ALLOC_LARGE(req->rq_reqbuf, alloc_len); if (!req->rq_reqbuf) RETURN(-ENOMEM); @@ -617,7 +617,7 @@ void plain_free_reqbuf(struct ptlrpc_sec *sec, { ENTRY; if (!req->rq_pool) { - OBD_FREE(req->rq_reqbuf, req->rq_reqbuf_len); + OBD_FREE_LARGE(req->rq_reqbuf, req->rq_reqbuf_len); req->rq_reqbuf = NULL; req->rq_reqbuf_len = 0; } @@ -648,7 +648,7 @@ int plain_alloc_repbuf(struct ptlrpc_sec *sec, alloc_len = size_roundup_power2(alloc_len); - OBD_ALLOC(req->rq_repbuf, alloc_len); + OBD_ALLOC_LARGE(req->rq_repbuf, alloc_len); if (!req->rq_repbuf) RETURN(-ENOMEM); @@ -661,7 +661,7 @@ void plain_free_repbuf(struct ptlrpc_sec *sec, struct ptlrpc_request *req) { ENTRY; - OBD_FREE(req->rq_repbuf, req->rq_repbuf_len); + OBD_FREE_LARGE(req->rq_repbuf, req->rq_repbuf_len); req->rq_repbuf = NULL; req->rq_repbuf_len = 0; EXIT; @@ -702,13 +702,13 @@ int plain_enlarge_reqbuf(struct ptlrpc_sec *sec, if (req->rq_reqbuf_len < newbuf_size) { newbuf_size = size_roundup_power2(newbuf_size); - OBD_ALLOC(newbuf, newbuf_size); + OBD_ALLOC_LARGE(newbuf, newbuf_size); if (newbuf == NULL) RETURN(-ENOMEM); memcpy(newbuf, req->rq_reqbuf, req->rq_reqbuf_len); - OBD_FREE(req->rq_reqbuf, req->rq_reqbuf_len); + OBD_FREE_LARGE(req->rq_reqbuf, req->rq_reqbuf_len); req->rq_reqbuf = newbuf; req->rq_reqbuf_len = newbuf_size; req->rq_reqmsg = lustre_msg_buf(req->rq_reqbuf, @@ -828,7 +828,7 @@ int plain_alloc_rs(struct ptlrpc_request *req, int msgsize) /* pre-allocated */ LASSERT(rs->rs_size >= rs_size); } else { - OBD_ALLOC(rs, rs_size); + OBD_ALLOC_LARGE(rs, rs_size); if (rs == NULL) RETURN(-ENOMEM); @@ -856,7 +856,7 @@ void plain_free_rs(struct ptlrpc_reply_state *rs) cfs_atomic_dec(&rs->rs_svc_ctx->sc_refcount); if (!rs->rs_prealloc) - OBD_FREE(rs, rs->rs_size); + OBD_FREE_LARGE(rs, rs->rs_size); EXIT; } diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 3dd00ba..d53232e 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -68,28 +68,6 @@ static int ptlrpc_server_post_idle_rqbds (struct ptlrpc_service *svc); static CFS_LIST_HEAD(ptlrpc_all_services); cfs_spinlock_t ptlrpc_all_services_lock; -static char * -ptlrpc_alloc_request_buffer (int size) -{ - char *ptr; - - if (size > SVC_BUF_VMALLOC_THRESHOLD) - OBD_VMALLOC(ptr, size); - else - OBD_ALLOC(ptr, size); - - return (ptr); -} - -static void -ptlrpc_free_request_buffer (char *ptr, int size) -{ - if (size > SVC_BUF_VMALLOC_THRESHOLD) - OBD_VFREE(ptr, size); - else - OBD_FREE(ptr, size); -} - struct ptlrpc_request_buffer_desc * ptlrpc_alloc_rqbd (struct ptlrpc_service *svc) { @@ -104,7 +82,7 @@ ptlrpc_alloc_rqbd (struct ptlrpc_service *svc) rqbd->rqbd_cbid.cbid_fn = request_in_callback; rqbd->rqbd_cbid.cbid_arg = rqbd; CFS_INIT_LIST_HEAD(&rqbd->rqbd_reqs); - rqbd->rqbd_buffer = ptlrpc_alloc_request_buffer(svc->srv_buf_size); + OBD_ALLOC_LARGE(rqbd->rqbd_buffer, svc->srv_buf_size); if (rqbd->rqbd_buffer == NULL) { OBD_FREE_PTR(rqbd); @@ -132,7 +110,7 @@ ptlrpc_free_rqbd (struct ptlrpc_request_buffer_desc *rqbd) svc->srv_nbufs--; cfs_spin_unlock(&svc->srv_lock); - ptlrpc_free_request_buffer (rqbd->rqbd_buffer, svc->srv_buf_size); + OBD_FREE_LARGE(rqbd->rqbd_buffer, svc->srv_buf_size); OBD_FREE_PTR(rqbd); } @@ -1028,7 +1006,7 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) OBD_ALLOC(reqcopy, sizeof *reqcopy); if (reqcopy == NULL) RETURN(-ENOMEM); - OBD_ALLOC(reqmsg, req->rq_reqlen); + OBD_ALLOC_LARGE(reqmsg, req->rq_reqlen); if (!reqmsg) { OBD_FREE(reqcopy, sizeof *reqcopy); RETURN(-ENOMEM); @@ -1088,7 +1066,7 @@ out_put: class_export_put(reqcopy->rq_export); out: sptlrpc_svc_ctx_decref(reqcopy); - OBD_FREE(reqmsg, req->rq_reqlen); + OBD_FREE_LARGE(reqmsg, req->rq_reqlen); OBD_FREE(reqcopy, sizeof *reqcopy); RETURN(rc); } @@ -2143,7 +2121,7 @@ static int ptlrpc_main(void *arg) env.le_ctx.lc_cookie = 0x6; /* Alloc reply state structure for this one */ - OBD_ALLOC_GFP(rs, svc->srv_max_reply_size, CFS_ALLOC_STD); + OBD_ALLOC_LARGE(rs, svc->srv_max_reply_size); if (!rs) { rc = -ENOMEM; goto out_srv_fini; @@ -2726,7 +2704,7 @@ int ptlrpc_unregister_service(struct ptlrpc_service *service) cfs_list_for_each_entry_safe(rs, t, &service->srv_free_rs_list, rs_list) { cfs_list_del(&rs->rs_list); - OBD_FREE(rs, service->srv_max_reply_size); + OBD_FREE_LARGE(rs, service->srv_max_reply_size); } /* In case somebody rearmed this in the meantime */ diff --git a/lustre/tests/obdfilter-survey.sh b/lustre/tests/obdfilter-survey.sh index 3c8aff9..1e1284b 100644 --- a/lustre/tests/obdfilter-survey.sh +++ b/lustre/tests/obdfilter-survey.sh @@ -5,6 +5,7 @@ set -e LUSTRE=${LUSTRE:-`dirname $0`/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ +init_logging nobjhi=${nobjhi:-1} thrhi=${thrhi:-16} -- 1.8.3.1