Whamcloud - gitweb
Branch HEAD
authoradilger <adilger>
Thu, 8 Jan 2009 10:17:58 +0000 (10:17 +0000)
committeradilger <adilger>
Thu, 8 Jan 2009 10:17:58 +0000 (10:17 +0000)
Use __GFP_HIGHMEM so that the pages can use all of the available memory
on 32-bit machines.

b=17576
i=adilger (alex.zhuravlev original patch)
i=nikita

Use local "obd" variable in filter_preprw_write() instead of exp->exp_obd.

lustre/obdfilter/filter_io.c

index 07b2f9c..74d64ef 100644 (file)
@@ -247,18 +247,17 @@ long filter_grant(struct obd_export *exp, obd_size current_grant,
  * use GFP_NOFS not allowing to enter FS as the client can run on this node
  * and we might end waiting on a page he sent in the request we're serving.
  *
- * use NORETRY so that the allocator doesn't go crazy: chance to more lucky
- * thread have enough memory to complete his request. for our request client
- * will do resend hopefully -bzzz
+ * use __GFP_HIGHMEM so that the pages can use all of the available memory
+ * on 32-bit machines
  */
-static struct page * filter_get_page(struct obd_device *obd,
-                                     struct inode *inode,
-                                     obd_off offset)
+static struct page *filter_get_page(struct obd_device *obd,
+                                    struct inode *inode,
+                                    obd_off offset)
 {
         struct page *page;
 
         page = find_or_create_page(inode->i_mapping, offset >> CFS_PAGE_SHIFT,
-                                   GFP_NOFS | __GFP_NORETRY);
+                                   GFP_NOFS | __GFP_HIGHMEM);
         if (unlikely(page == NULL))
                 lprocfs_counter_add(obd->obd_stats, LPROC_FILTER_NO_PAGE, 1);
 
@@ -635,13 +634,13 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
         if (rc)
                 RETURN(rc);
 
-        push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
-        iobuf = filter_iobuf_get(&exp->exp_obd->u.filter, oti);
+        push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+        iobuf = filter_iobuf_get(&obd->u.filter, oti);
         if (IS_ERR(iobuf))
                 GOTO(cleanup, rc = PTR_ERR(iobuf));
         cleanup_phase = 1;
 
-        dentry = filter_fid2dentry(exp->exp_obd, NULL, obj->ioo_gr,
+        dentry = filter_fid2dentry(obd, NULL, obj->ioo_gr,
                                    obj->ioo_id);
         if (IS_ERR(dentry))
                 GOTO(cleanup, rc = PTR_ERR(dentry));
@@ -649,7 +648,7 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
 
         if (dentry->d_inode == NULL) {
                 CERROR("%s: trying to BRW to non-existent file "LPU64"\n",
-                       exp->exp_obd->obd_name, obj->ioo_id);
+                       obd->obd_name, obj->ioo_id);
                 GOTO(cleanup, rc = -ENOENT);
         }
 
@@ -664,7 +663,7 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
         if (rc)
                 GOTO(cleanup, rc);
 
-        fsfilt_check_slow(exp->exp_obd, now, "preprw_write setup");
+        fsfilt_check_slow(obd, now, "preprw_write setup");
 
         /* Don't update inode timestamps if this write is older than a
          * setattr which modifies the timestamps. b=10150 */
@@ -674,7 +673,7 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
         fmd = filter_fmd_find(exp, obj->ioo_id, obj->ioo_gr);
 
         LASSERT(oa != NULL);
-        spin_lock(&exp->exp_obd->obd_osfs_lock);
+        spin_lock(&obd->obd_osfs_lock);
         filter_grant_incoming(exp, oa);
         if (fmd && fmd->fmd_mactime_xid > oti->oti_xid)
                 oa->o_valid &= ~(OBD_MD_FLMTIME | OBD_MD_FLCTIME |
@@ -697,7 +696,7 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
         if (oa->o_valid & OBD_MD_FLGRANT)
                 oa->o_grant = filter_grant(exp,oa->o_grant,oa->o_undirty,left);
 
-        spin_unlock(&exp->exp_obd->obd_osfs_lock);
+        spin_unlock(&obd->obd_osfs_lock);
         filter_fmd_put(exp, fmd);
 
         if (rc)
@@ -744,7 +743,7 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
                                                LPU64" flg %x before EOF %llu\n",
                                                lnb->len, lnb->offset,lnb->flags,
                                                i_size_read(dentry->d_inode));
-                                filter_iobuf_add_page(exp->exp_obd, iobuf,
+                                filter_iobuf_add_page(obd, iobuf,
                                                       dentry->d_inode,
                                                       lnb->page);
                         } else {
@@ -774,7 +773,7 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
         rc = filter_direct_io(OBD_BRW_READ, dentry, iobuf, exp,
                               NULL, NULL, NULL);
 
-        fsfilt_check_slow(exp->exp_obd, now, "start_page_write");
+        fsfilt_check_slow(obd, now, "start_page_write");
 
         if (exp->exp_nid_stats && exp->exp_nid_stats->nid_stats)
                 lprocfs_counter_add(exp->exp_nid_stats->nid_stats,
@@ -793,20 +792,20 @@ cleanup:
                         }
                 }
         case 3:
-                filter_iobuf_put(&exp->exp_obd->u.filter, iobuf, oti);
+                filter_iobuf_put(&obd->u.filter, iobuf, oti);
         case 2:
-                pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
+                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                 if (rc)
                         f_dput(dentry);
                 break;
         case 1:
-                filter_iobuf_put(&exp->exp_obd->u.filter, iobuf, oti);
+                filter_iobuf_put(&obd->u.filter, iobuf, oti);
         case 0:
-                spin_lock(&exp->exp_obd->obd_osfs_lock);
+                spin_lock(&obd->obd_osfs_lock);
                 if (oa)
                         filter_grant_incoming(exp, oa);
-                spin_unlock(&exp->exp_obd->obd_osfs_lock);
-                pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
+                spin_unlock(&obd->obd_osfs_lock);
+                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                 break;
         default:;
         }