Whamcloud - gitweb
Branch:b1_6
authorbobijam <bobijam>
Thu, 2 Aug 2007 02:26:36 +0000 (02:26 +0000)
committerbobijam <bobijam>
Thu, 2 Aug 2007 02:26:36 +0000 (02:26 +0000)
b=12606
i=shadow, nikita

Description: don't use GFP_* in generic Lustre code.
Details    : Use cfs_alloc_* functions and CFS_* flags for code portability.

17 files changed:
lustre/ChangeLog
lustre/include/liblustre.h
lustre/liblustre/dir.c
lustre/llite/file.c
lustre/llite/lproc_llite.c
lustre/llite/rw.c
lustre/llite/rw26.c
lustre/llite/super25.c
lustre/lov/lov_ea.c
lustre/lvfs/fsfilt_ext3.c
lustre/mds/handler.c
lustre/obdclass/genops.c
lustre/obdfilter/filter.c
lustre/ost/ost_handler.c
lustre/ost/ost_internal.h
lustre/quota/quota_context.c
lustre/quota/quota_master.c

index 09397fe..3ce0b45 100644 (file)
@@ -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>
index 46b5fc8..3e1963a 100644 (file)
@@ -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)
 {
index 50a94e2..da2eb26 100644 (file)
@@ -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));
index 4248d35..19b4091 100644 (file)
@@ -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,
index 8a38d08..6382a4d 100644 (file)
@@ -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);
 
index 0fd0bf5..6ab6fcf 100644 (file)
@@ -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));
index 3795de7..c631c2b 100644 (file)
@@ -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(&current->mm->mmap_sem);
                 result = get_user_pages(current, current->mm, user_addr,
index f66826c..e9147cf 100644 (file)
@@ -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)
index 860125f..827533f 100755 (executable)
@@ -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;
index 035a355..40c8d7b 100644 (file)
@@ -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);
 
index 07e565c..a966822 100644 (file)
@@ -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:
index 38ef294..16e5237 100644 (file)
@@ -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);
 
index ebb8caa..fcf1097 100644 (file)
@@ -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);
index 512c1c6..c56d8d0 100644 (file)
@@ -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;
index 3407a96..ecc977a 100644 (file)
@@ -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;
index 36098c7..d2b6c2e 100644 (file)
@@ -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);
 
index 40b359a..615c73c 100644 (file)
@@ -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);