diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 09397fe8a23043fcee54b0f989cfe036c19db167..3ce0b4513ca480732edb5fe57df5e3560067f32b 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -54,6 +54,12 @@ Severity : normal Bugzilla : 10595 Description: Error message improvement. Details : Merging of two LCONSOLE_ERROR_MSG into one. + +Severity : normal +Bugzilla : 12606 +Description: don't use GFP_* in generic Lustre code. +Details : Use cfs_alloc_* functions and CFS_* flags for code portability. + -------------------------------------------------------------------------------- 2007-07-30 Cluster File Systems, Inc. <info@clusterfs.com> diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 46b5fc831ef402939cec6591f73898704812fed0..3e1963a3cc0cb63f407c8ccde4d9c533683a906b 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -413,8 +413,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) { @@ -425,9 +427,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 50a94e2e2dc176a30863e3c5b0f6ef524a8f7589..da2eb26f386e1a6058ca35085e7107fdee4928aa 100644 --- a/lustre/liblustre/dir.c +++ b/lustre/liblustre/dir.c @@ -131,7 +131,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 4248d35e987b1bbb5c1ce4d94eb7f8b1685f69e7..19b4091d04d8e2b31b392f39d1b2cfa0fdffb38b 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -37,14 +37,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); } static int ll_close_inode_openhandle(struct inode *inode, diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 8a38d08ac7c7a566592ebd1f5bfb1a9ebfbf627c..6382a4d61c7f4087025a860ca07bdc792c1a3306 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -824,7 +824,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); diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 0fd0bf5f77f87d5a047a34106cd3f2561893446b..6ab6fcf9bd184e4c6ae88d6106db7caf89900934 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -591,7 +591,7 @@ static 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 3795de770854c6883bcdf07b511330f2278ef034..c631c2bea6c990be3e0cabcee1def59d0aed18de 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -102,7 +102,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)- (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 f66826c746df96b6e77c3f6593f6df9a9420be55..e9147cf5b3c5df8defd0debf2b2ffd9f519e53d7 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 860125fd053aac5fe24ca259c552241856015766..827533fc9ea2b8d0acde286fd4a1281cae50a60c 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 035a355768137f2a24b55382692a2fa3f75b11fc..40c8d7b2b187df3653acd7d5e32c3c386c554df0 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -752,7 +752,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 07e565cd52dec1b44aee548ef366dd9205ead0fc..a9668220a8fb6bd158ef755fefb620c8687c19d6 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -97,7 +97,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); @@ -156,7 +156,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 38ef2949d0a394a880d07346339cd3fbb70f74d4..16e5237bb557a299e436643610a1f0f6b120e6a0 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -59,7 +59,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; } @@ -72,7 +72,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 ebb8caaeba90974d8e994cd532233cf3de28980f..fcf10970805ea85e216522358063e1db10203148 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -482,7 +482,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 512c1c63754164d12093a3a0c9a8b8eda524ba47..c56d8d003b9f46cc6b5a8124a198ef75239fe5a8 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1615,7 +1615,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; @@ -1646,7 +1646,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 36098c7234b8164d6cdb8409dd554ba24e8a7350..d2b6c2e828ffc6ea8eecd95e2db457b160deab61 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -290,7 +290,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 40b359aa466d0d588c48ce8f8ec0ace8a6538d87..615c73cc693f070d93f03128143e96191ff042e7 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);