diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 6eb45b7a213a5780e630baf66213289875e65752..76f2d24bd377eb2bcede8805dd9093172b908bd3 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -423,8 +423,10 @@ static inline cfs_page_t *alloc_pages(int mask, unsigned long order) } return pg; } +#define cfs_alloc_pages(mask, order) alloc_pages((mask), (order)) -#define alloc_page(mask) alloc_pages((mask), 0) +#define alloc_page(mask) alloc_pages((mask), 0) +#define cfs_alloc_page(mask) alloc_page(mask) static inline void __free_pages(cfs_page_t *pg, int what) { @@ -435,9 +437,11 @@ static inline void __free_pages(cfs_page_t *pg, int what) #endif free(pg); } +#define __cfs_free_pages(pg, order) __free_pages((pg), (order)) #define __free_page(page) __free_pages((page), 0) #define free_page(page) __free_page(page) +#define __cfs_free_page(page) __cfs_free_pages((page), 0) static inline cfs_page_t* __grab_cache_page(unsigned long index) { diff --git a/lustre/liblustre/dir.c b/lustre/liblustre/dir.c index 8498d8066284b3c136087c095fbae201331d89dc..8d632eadc8f45014648c7554f42700ff2964f792 100644 --- a/lustre/liblustre/dir.c +++ b/lustre/liblustre/dir.c @@ -129,7 +129,7 @@ static struct page *llu_dir_read_page(struct inode *ino, unsigned long pgidx) int rc; ENTRY; - page = alloc_page(0); + page = cfs_alloc_page(0); if (!page) { CERROR("alloc page failed\n"); RETURN(ERR_PTR(-ENOMEM)); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 8db92ee530487c8736dff0d1e5c532b40d615c4a..e7798c3eda380a9ea6b91bd7ed82224c54b69cf1 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -38,14 +38,14 @@ struct ll_file_data *ll_file_data_get(void) { struct ll_file_data *fd; - OBD_SLAB_ALLOC(fd, ll_file_data_slab, GFP_KERNEL, sizeof *fd); + OBD_SLAB_ALLOC_PTR(fd, ll_file_data_slab); return fd; } static void ll_file_data_put(struct ll_file_data *fd) { if (fd != NULL) - OBD_SLAB_FREE(fd, ll_file_data_slab, sizeof *fd); + OBD_SLAB_FREE_PTR(fd, ll_file_data_slab); } void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data, diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index d8334ef3a75ebecf17af71a37ec5003af7bff1e6..9ce86e42400644653040eb7782a79a5384e77dcd 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -841,7 +841,7 @@ static int llite_dump_pgcache_seq_open(struct inode *inode, struct file *file) LPROCFS_ENTRY_AND_CHECK(dp); - OBD_ALLOC_GFP(dummy_llap, sizeof(*dummy_llap), GFP_KERNEL); + OBD_ALLOC_PTR_WAIT(dummy_llap); if (dummy_llap == NULL) GOTO(out, rc); dummy_llap->llap_page = NULL; diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 435b145c55b0a6d6246bff4f60b06963a5e548be..723dd908efb4fd0eaf416cb47878f3ff0cc8b14a 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -614,7 +614,7 @@ struct ll_async_page *llap_from_page(struct page *page, unsigned origin) if (sbi->ll_async_page_count >= sbi->ll_async_page_max) llap_shrink_cache(sbi, 0); - OBD_SLAB_ALLOC(llap, ll_async_page_slab, GFP_KERNEL, + OBD_SLAB_ALLOC(llap, ll_async_page_slab, CFS_ALLOC_STD, ll_async_page_slab_size); if (llap == NULL) RETURN(ERR_PTR(-ENOMEM)); diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 8454d471f965ca5c65ac50a94ade43a4018076cb..c1393917fbf41b91c42ae843a9c92982ccd95b77 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -114,7 +114,7 @@ static inline int ll_get_user_pages(int rw, unsigned long user_addr, page_count = (user_addr + size + CFS_PAGE_SIZE - 1) >> CFS_PAGE_SHIFT; page_count -= user_addr >> CFS_PAGE_SHIFT; - OBD_ALLOC_GFP(*pages, page_count * sizeof(**pages), GFP_KERNEL); + OBD_ALLOC_WAIT(*pages, page_count * sizeof(**pages)); if (*pages) { down_read(¤t->mm->mmap_sem); result = get_user_pages(current, current->mm, user_addr, diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 376a1067bc09277894c44597e2dcf0b2c6d54c9d..ea1564c0c1b5255643ea9f4b01ae9f79cd2afd41 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -41,7 +41,7 @@ static struct inode *ll_alloc_inode(struct super_block *sb) { struct ll_inode_info *lli; ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_ALLOC_INODE, 1); - OBD_SLAB_ALLOC(lli, ll_inode_cachep, GFP_KERNEL, sizeof *lli); + OBD_SLAB_ALLOC_PTR(lli, ll_inode_cachep); if (lli == NULL) return NULL; @@ -54,7 +54,7 @@ static struct inode *ll_alloc_inode(struct super_block *sb) static void ll_destroy_inode(struct inode *inode) { struct ll_inode_info *ptr = ll_i2info(inode); - OBD_SLAB_FREE(ptr, ll_inode_cachep, sizeof(*ptr)); + OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep); } int ll_init_inodecache(void) diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 51258b32a842fcb9c699cb3296d75afa1e4133ca..9e3463c8ec970e652319efcb9de36a1ecb88ba09 100755 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -95,7 +95,7 @@ struct lov_stripe_md *lsm_alloc_plain(int stripe_count, int *size) return NULL;; for (i = 0; i < stripe_count; i++) { - OBD_SLAB_ALLOC(loi, lov_oinfo_slab, GFP_NOFS, sizeof(*loi)); + OBD_SLAB_ALLOC(loi, lov_oinfo_slab, CFS_ALLOC_IO, sizeof(*loi)); if (loi == NULL) goto err; lsm->lsm_oinfo[i] = loi; diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 6f84809cf196ff1f150653ca93b1ed098177792c..73222567e3d20bd0d6d41c3827d0a6bba10e4cb7 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -698,7 +698,7 @@ static int fsfilt_ext3_add_journal_cb(struct obd_device *obd, __u64 last_rcvd, { struct fsfilt_cb_data *fcb; - OBD_SLAB_ALLOC(fcb, fcb_cache, GFP_NOFS, sizeof *fcb); + OBD_SLAB_ALLOC(fcb, fcb_cache, CFS_ALLOC_IO, sizeof *fcb); if (fcb == NULL) RETURN(-ENOMEM); diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 56f3a228dc545ecdbc18185dd6970d341afd86e9..cc51660d4ff107f987d532212c2f9f6bd897ebb1 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -98,7 +98,7 @@ static int mds_sendpage(struct ptlrpc_request *req, struct file *file, for (i = 0, tmpcount = count; i < npages; i++, tmpcount -= tmpsize) { tmpsize = tmpcount > CFS_PAGE_SIZE ? CFS_PAGE_SIZE : tmpcount; - pages[i] = alloc_pages(GFP_KERNEL, 0); + pages[i] = cfs_alloc_page(CFS_ALLOC_STD); if (pages[i] == NULL) GOTO(cleanup_buf, rc = -ENOMEM); @@ -157,7 +157,7 @@ static int mds_sendpage(struct ptlrpc_request *req, struct file *file, cleanup_buf: for (i = 0; i < npages; i++) if (pages[i]) - __free_pages(pages[i], 0); + __cfs_free_page(pages[i]); ptlrpc_free_bulk(desc); out_free: diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index c00580480bd895d7e950887d6546a4f6dfa4fc26..e3b44469c5e13a12d6e375f9ef05224ac9a79a12 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -58,7 +58,7 @@ static struct obd_device *obd_device_alloc(void) { struct obd_device *obd; - OBD_SLAB_ALLOC(obd, obd_device_cachep, GFP_KERNEL, sizeof(*obd)); + OBD_SLAB_ALLOC_PTR(obd, obd_device_cachep); if (obd != NULL) { obd->obd_magic = OBD_DEVICE_MAGIC; } @@ -71,7 +71,7 @@ static void obd_device_free(struct obd_device *obd) LASSERT(obd != NULL); LASSERTF(obd->obd_magic == OBD_DEVICE_MAGIC, "obd %p obd_magic %08x != %08x\n", obd, obd->obd_magic, OBD_DEVICE_MAGIC); - OBD_SLAB_FREE(obd, obd_device_cachep, sizeof(*obd)); + OBD_SLAB_FREE_PTR(obd, obd_device_cachep); } EXPORT_SYMBOL(obd_device_free); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 3e8c928e32a2deefd8a0b2bd21be4096abe29a47..c7cc02fd50c96a48a8903e46a1ba6d0412d0121e 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -484,7 +484,7 @@ struct filter_mod_data *filter_fmd_get(struct obd_export *exp, struct filter_export_data *fed = &exp->exp_filter_data; struct filter_mod_data *found = NULL, *fmd_new = NULL; - OBD_SLAB_ALLOC(fmd_new, ll_fmd_cachep, GFP_NOFS, sizeof(*fmd_new)); + OBD_SLAB_ALLOC(fmd_new, ll_fmd_cachep, CFS_ALLOC_IO, sizeof(*fmd_new)); spin_lock(&fed->fed_lock); found = filter_fmd_find_nolock(&exp->exp_obd->u.filter,fed,objid,group); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 888ce737ff61945f043f2151c7760f7b54431849..966728b701fa76407fbea6d2a7b53698af70d96c 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1660,7 +1660,7 @@ static void ost_thread_done(struct ptlrpc_thread *thread) if (tls != NULL) { for (i = 0; i < OST_THREAD_POOL_SIZE; ++ i) { if (tls->page[i] != NULL) - __free_page(tls->page[i]); + __cfs_free_page(tls->page[i]); } OBD_FREE_PTR(tls); thread->t_data = NULL; @@ -1691,7 +1691,7 @@ static int ost_thread_init(struct ptlrpc_thread *thread) * populate pool */ for (i = 0; i < OST_THREAD_POOL_SIZE; ++ i) { - tls->page[i] = alloc_page(OST_THREAD_POOL_GFP); + tls->page[i] = cfs_alloc_page(OST_THREAD_POOL_GFP); if (tls->page[i] == NULL) { ost_thread_done(thread); result = -ENOMEM; diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h index 3407a960229e50a55631fed6d2c6b6fcaaba9fdf..ecc977aec3eb2d2ab32021f703fcc80446fd860c 100644 --- a/lustre/ost/ost_internal.h +++ b/lustre/ost/ost_internal.h @@ -15,7 +15,7 @@ extern void ost_print_req(void *seq_file, struct ptlrpc_request *req); * tunables for per-thread page pool (bug 5137) */ #define OST_THREAD_POOL_SIZE PTLRPC_MAX_BRW_PAGES /* pool size in pages */ -#define OST_THREAD_POOL_GFP GFP_HIGHUSER /* GFP mask for pool pages */ +#define OST_THREAD_POOL_GFP CFS_ALLOC_HIGHUSER /* GFP mask for pool pages */ struct page; struct niobuf_local; diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 3f034259d3c4de56cdd69c995cef106f50d142ab..e93230761702c8675c5c8f565c2dd832c339f102 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -289,7 +289,7 @@ static struct lustre_qunit *alloc_qunit(struct lustre_quota_ctxt *qctxt, struct lustre_qunit *qunit = NULL; ENTRY; - OBD_SLAB_ALLOC(qunit, qunit_cachep, GFP_NOFS, sizeof(*qunit)); + OBD_SLAB_ALLOC(qunit, qunit_cachep, CFS_ALLOC_IO, sizeof(*qunit)); if (qunit == NULL) RETURN(NULL); diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index 8b4c358d41835173757bfd54803e0e15c10c92e3..216f2c2217acd7aa492acb270eb2b89c3674fe8c 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -112,7 +112,7 @@ static struct lustre_dquot *alloc_dquot(struct lustre_quota_info *lqi, struct lustre_dquot *dquot = NULL; ENTRY; - OBD_SLAB_ALLOC(dquot, lustre_dquot_cachep, GFP_NOFS, sizeof(*dquot)); + OBD_SLAB_ALLOC(dquot, lustre_dquot_cachep, CFS_ALLOC_IO, sizeof(*dquot)); if (dquot == NULL) RETURN(NULL);