Whamcloud - gitweb
LU-1347 build: remove the vim/emacs modelines
[fs/lustre-release.git] / lustre / obdecho / echo.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2010, 2011, Whamcloud, Inc.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/obdecho/echo.c
37  *
38  * Author: Peter Braam <braam@clusterfs.com>
39  * Author: Andreas Dilger <adilger@clusterfs.com>
40  */
41
42 #ifndef EXPORT_SYMTAB
43 # define EXPORT_SYMTAB
44 #endif
45
46 #define DEBUG_SUBSYSTEM S_ECHO
47
48 #include <obd_support.h>
49 #include <obd_class.h>
50 #include <lustre_debug.h>
51 #include <lustre_dlm.h>
52 #include <lprocfs_status.h>
53
54 #include "echo_internal.h"
55
56 /* The echo objid needs to be below 2^32, because regular FID numbers are
57  * limited to 2^32 objects in f_oid for the FID_SEQ_ECHO range. b=23335 */
58 #define ECHO_INIT_OID        0x10000000ULL
59 #define ECHO_HANDLE_MAGIC    0xabcd0123fedc9876ULL
60
61 #define ECHO_PERSISTENT_PAGES (ECHO_PERSISTENT_SIZE >> CFS_PAGE_SHIFT)
62 static cfs_page_t *echo_persistent_pages[ECHO_PERSISTENT_PAGES];
63
64 enum {
65         LPROC_ECHO_READ_BYTES = 1,
66         LPROC_ECHO_WRITE_BYTES = 2,
67         LPROC_ECHO_LAST = LPROC_ECHO_WRITE_BYTES +1
68 };
69
70 static int echo_connect(const struct lu_env *env,
71                         struct obd_export **exp, struct obd_device *obd,
72                         struct obd_uuid *cluuid, struct obd_connect_data *data,
73                         void *localdata)
74 {
75         struct lustre_handle conn = { 0 };
76         int rc;
77
78         data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED;
79         rc = class_connect(&conn, obd, cluuid);
80         if (rc) {
81                 CERROR("can't connect %d\n", rc);
82                 return rc;
83         }
84         *exp = class_conn2export(&conn);
85
86         return 0;
87 }
88
89 static int echo_disconnect(struct obd_export *exp)
90 {
91         LASSERT (exp != NULL);
92
93         return server_disconnect_export(exp);
94 }
95
96 static int echo_init_export(struct obd_export *exp)
97 {
98         return ldlm_init_export(exp);
99 }
100
101 static int echo_destroy_export(struct obd_export *exp)
102 {
103         ENTRY;
104
105         target_destroy_export(exp);
106         ldlm_destroy_export(exp);
107
108         RETURN(0);
109 }
110
111  static __u64 echo_next_id(struct obd_device *obddev)
112 {
113         obd_id id;
114
115         cfs_spin_lock(&obddev->u.echo.eo_lock);
116         id = ++obddev->u.echo.eo_lastino;
117         cfs_spin_unlock(&obddev->u.echo.eo_lock);
118
119         return id;
120 }
121
122 static int echo_create(struct obd_export *exp, struct obdo *oa,
123                        struct lov_stripe_md **ea, struct obd_trans_info *oti)
124 {
125         struct obd_device *obd = class_exp2obd(exp);
126
127         if (!obd) {
128                 CERROR("invalid client cookie "LPX64"\n",
129                        exp->exp_handle.h_cookie);
130                 return -EINVAL;
131         }
132
133         if (!(oa->o_mode && S_IFMT)) {
134                 CERROR("echo obd: no type!\n");
135                 return -ENOENT;
136         }
137
138         if (!(oa->o_valid & OBD_MD_FLTYPE)) {
139                 CERROR("invalid o_valid "LPX64"\n", oa->o_valid);
140                 return -EINVAL;
141         }
142
143         oa->o_id = echo_next_id(obd);
144         oa->o_valid = OBD_MD_FLID;
145
146         return 0;
147 }
148
149 static int echo_destroy(struct obd_export *exp, struct obdo *oa,
150                         struct lov_stripe_md *ea, struct obd_trans_info *oti,
151                         struct obd_export *md_exp, void *capa)
152 {
153         struct obd_device *obd = class_exp2obd(exp);
154
155         ENTRY;
156         if (!obd) {
157                 CERROR("invalid client cookie "LPX64"\n",
158                        exp->exp_handle.h_cookie);
159                 RETURN(-EINVAL);
160         }
161
162         if (!(oa->o_valid & OBD_MD_FLID)) {
163                 CERROR("obdo missing FLID valid flag: "LPX64"\n", oa->o_valid);
164                 RETURN(-EINVAL);
165         }
166
167         if (oa->o_id > obd->u.echo.eo_lastino || oa->o_id < ECHO_INIT_OID) {
168                 CERROR("bad destroy objid: "LPX64"\n", oa->o_id);
169                 RETURN(-EINVAL);
170         }
171
172         RETURN(0);
173 }
174
175 static int echo_getattr(struct obd_export *exp, struct obd_info *oinfo)
176 {
177         struct obd_device *obd = class_exp2obd(exp);
178         obd_id id = oinfo->oi_oa->o_id;
179
180         ENTRY;
181         if (!obd) {
182                 CERROR("invalid client cookie "LPX64"\n",
183                        exp->exp_handle.h_cookie);
184                 RETURN(-EINVAL);
185         }
186
187         if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
188                 CERROR("obdo missing FLID valid flag: "LPX64"\n",
189                        oinfo->oi_oa->o_valid);
190                 RETURN(-EINVAL);
191         }
192
193         obdo_cpy_md(oinfo->oi_oa, &obd->u.echo.eo_oa, oinfo->oi_oa->o_valid);
194         oinfo->oi_oa->o_id = id;
195
196         RETURN(0);
197 }
198
199 static int echo_setattr(struct obd_export *exp, struct obd_info *oinfo,
200                         struct obd_trans_info *oti)
201 {
202         struct obd_device *obd = class_exp2obd(exp);
203
204         ENTRY;
205         if (!obd) {
206                 CERROR("invalid client cookie "LPX64"\n",
207                        exp->exp_handle.h_cookie);
208                 RETURN(-EINVAL);
209         }
210
211         if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
212                 CERROR("obdo missing FLID valid flag: "LPX64"\n",
213                        oinfo->oi_oa->o_valid);
214                 RETURN(-EINVAL);
215         }
216
217         memcpy(&obd->u.echo.eo_oa, oinfo->oi_oa, sizeof(*oinfo->oi_oa));
218
219         if (oinfo->oi_oa->o_id & 4) {
220                 /* Save lock to force ACKed reply */
221                 ldlm_lock_addref (&obd->u.echo.eo_nl_lock, LCK_NL);
222                 oti->oti_ack_locks[0].mode = LCK_NL;
223                 oti->oti_ack_locks[0].lock = obd->u.echo.eo_nl_lock;
224         }
225
226         RETURN(0);
227 }
228
229 static void
230 echo_page_debug_setup(cfs_page_t *page, int rw, obd_id id,
231                       __u64 offset, int len)
232 {
233         int   page_offset = offset & ~CFS_PAGE_MASK;
234         char *addr        = ((char *)cfs_kmap(page)) + page_offset;
235
236         if (len % OBD_ECHO_BLOCK_SIZE != 0)
237                 CERROR("Unexpected block size %d\n", len);
238
239         while (len > 0) {
240                 if (rw & OBD_BRW_READ)
241                         block_debug_setup(addr, OBD_ECHO_BLOCK_SIZE,
242                                           offset, id);
243                 else
244                         block_debug_setup(addr, OBD_ECHO_BLOCK_SIZE,
245                                           0xecc0ecc0ecc0ecc0ULL,
246                                           0xecc0ecc0ecc0ecc0ULL);
247
248                 addr   += OBD_ECHO_BLOCK_SIZE;
249                 offset += OBD_ECHO_BLOCK_SIZE;
250                 len    -= OBD_ECHO_BLOCK_SIZE;
251         }
252
253         cfs_kunmap(page);
254 }
255
256 static int
257 echo_page_debug_check(cfs_page_t *page, obd_id id,
258                       __u64 offset, int len)
259 {
260         int   page_offset = offset & ~CFS_PAGE_MASK;
261         char *addr        = ((char *)cfs_kmap(page)) + page_offset;
262         int   rc          = 0;
263         int   rc2;
264
265         if (len % OBD_ECHO_BLOCK_SIZE != 0)
266                 CERROR("Unexpected block size %d\n", len);
267
268         while (len > 0) {
269                 rc2 = block_debug_check("echo", addr, OBD_ECHO_BLOCK_SIZE,
270                                         offset, id);
271
272                 if (rc2 != 0 && rc == 0)
273                         rc = rc2;
274
275                 addr   += OBD_ECHO_BLOCK_SIZE;
276                 offset += OBD_ECHO_BLOCK_SIZE;
277                 len    -= OBD_ECHO_BLOCK_SIZE;
278         }
279
280         cfs_kunmap(page);
281
282         return (rc);
283 }
284
285 /* This allows us to verify that desc_private is passed unmolested */
286 #define DESC_PRIV 0x10293847
287
288 static int echo_map_nb_to_lb(struct obdo *oa, struct obd_ioobj *obj,
289                              struct niobuf_remote *nb, int *pages,
290                              struct niobuf_local *lb, int cmd, int *left)
291 {
292         int gfp_mask = (obj->ioo_id & 1) ? CFS_ALLOC_HIGHUSER : CFS_ALLOC_STD;
293         int ispersistent = obj->ioo_id == ECHO_PERSISTENT_OBJID;
294         int debug_setup = (!ispersistent &&
295                            (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
296                            (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
297         struct niobuf_local *res = lb;
298         obd_off offset = nb->offset;
299         int len = nb->len;
300
301         while (len > 0) {
302                 int plen = CFS_PAGE_SIZE - (offset & (CFS_PAGE_SIZE-1));
303                 if (len < plen)
304                         plen = len;
305
306                 /* check for local buf overflow */
307                 if (*left == 0)
308                         return -EINVAL;
309
310                 res->offset = offset;
311                 res->len = plen;
312                 LASSERT((res->offset & ~CFS_PAGE_MASK) + res->len <= CFS_PAGE_SIZE);
313
314
315                 if (ispersistent &&
316                     (res->offset >> CFS_PAGE_SHIFT) < ECHO_PERSISTENT_PAGES) {
317                         res->page = echo_persistent_pages[res->offset >>
318                                 CFS_PAGE_SHIFT];
319                         /* Take extra ref so __free_pages() can be called OK */
320                         cfs_get_page (res->page);
321                 } else {
322                         OBD_PAGE_ALLOC(res->page, gfp_mask);
323                         if (res->page == NULL) {
324                                 CERROR("can't get page for id " LPU64"\n",
325                                        obj->ioo_id);
326                                 return -ENOMEM;
327                         }
328                 }
329
330                 CDEBUG(D_PAGE, "$$$$ get page %p @ "LPU64" for %d\n",
331                        res->page, res->offset, res->len);
332
333                 if (cmd & OBD_BRW_READ)
334                         res->rc = res->len;
335
336                 if (debug_setup)
337                         echo_page_debug_setup(res->page, cmd, obj->ioo_id,
338                                               res->offset, res->len);
339
340                 offset += plen;
341                 len -= plen;
342                 res++;
343
344                 (*left)--;
345                 (*pages)++;
346         }
347
348         return 0;
349 }
350
351 static int echo_finalize_lb(struct obdo *oa, struct obd_ioobj *obj,
352                             struct niobuf_remote *rb, int *pgs,
353                             struct niobuf_local *lb, int verify)
354 {
355         struct niobuf_local *res = lb;
356         obd_off start  = rb->offset >> CFS_PAGE_SHIFT;
357         obd_off end    = (rb->offset + rb->len + CFS_PAGE_SIZE - 1) >> CFS_PAGE_SHIFT;
358         int     count  = (int)(end - start);
359         int     rc     = 0;
360         int     i;
361
362         for (i = 0; i < count; i++, (*pgs) ++, res++) {
363                 cfs_page_t *page = res->page;
364                 void       *addr;
365
366                 if (page == NULL) {
367                         CERROR("null page objid "LPU64":%p, buf %d/%d\n",
368                                obj->ioo_id, page, i, obj->ioo_bufcnt);
369                         return -EFAULT;
370                 }
371
372                 addr = cfs_kmap(page);
373
374                 CDEBUG(D_PAGE, "$$$$ use page %p, addr %p@"LPU64"\n",
375                        res->page, addr, res->offset);
376
377                 if (verify) {
378                         int vrc = echo_page_debug_check(page, obj->ioo_id,
379                                                         res->offset, res->len);
380                         /* check all the pages always */
381                         if (vrc != 0 && rc == 0)
382                                 rc = vrc;
383                 }
384
385                 cfs_kunmap(page);
386                 /* NB see comment above regarding persistent pages */
387                 OBD_PAGE_FREE(page);
388         }
389
390         return rc;
391 }
392
393 static int echo_preprw(int cmd, struct obd_export *export, struct obdo *oa,
394                        int objcount, struct obd_ioobj *obj,
395                        struct niobuf_remote *nb, int *pages,
396                        struct niobuf_local *res, struct obd_trans_info *oti,
397                        struct lustre_capa *unused)
398 {
399         struct obd_device *obd;
400         int tot_bytes = 0;
401         int rc = 0;
402         int i, left;
403         ENTRY;
404
405         obd = export->exp_obd;
406         if (obd == NULL)
407                 RETURN(-EINVAL);
408
409         /* Temp fix to stop falling foul of osc_announce_cached() */
410         oa->o_valid &= ~(OBD_MD_FLBLOCKS | OBD_MD_FLGRANT);
411
412         memset(res, 0, sizeof(*res) * *pages);
413
414         CDEBUG(D_PAGE, "%s %d obdos with %d IOs\n",
415                cmd == OBD_BRW_READ ? "reading" : "writing", objcount, *pages);
416
417         if (oti)
418                 oti->oti_handle = (void *)DESC_PRIV;
419
420         left = *pages;
421         *pages = 0;
422
423         for (i = 0; i < objcount; i++, obj++) {
424                 int j;
425
426                 for (j = 0 ; j < obj->ioo_bufcnt ; j++, nb++) {
427
428                         rc = echo_map_nb_to_lb(oa, obj, nb, pages,
429                                                res + *pages, cmd, &left);
430                         if (rc)
431                                 GOTO(preprw_cleanup, rc);
432
433                         tot_bytes += nb->len;
434                 }
435         }
436
437         cfs_atomic_add(*pages, &obd->u.echo.eo_prep);
438
439         if (cmd & OBD_BRW_READ)
440                 lprocfs_counter_add(obd->obd_stats, LPROC_ECHO_READ_BYTES,
441                                     tot_bytes);
442         else
443                 lprocfs_counter_add(obd->obd_stats, LPROC_ECHO_WRITE_BYTES,
444                                     tot_bytes);
445
446         CDEBUG(D_PAGE, "%d pages allocated after prep\n",
447                cfs_atomic_read(&obd->u.echo.eo_prep));
448
449         RETURN(0);
450
451 preprw_cleanup:
452         /* It is possible that we would rather handle errors by  allow
453          * any already-set-up pages to complete, rather than tearing them
454          * all down again.  I believe that this is what the in-kernel
455          * prep/commit operations do.
456          */
457         CERROR("cleaning up %u pages (%d obdos)\n", *pages, objcount);
458         for (i = 0; i < *pages; i++) {
459                 cfs_kunmap(res[i].page);
460                 /* NB if this is a persistent page, __free_pages will just
461                  * lose the extra ref gained above */
462                 OBD_PAGE_FREE(res[i].page);
463                 res[i].page = NULL;
464                 cfs_atomic_dec(&obd->u.echo.eo_prep);
465         }
466
467         return rc;
468 }
469
470 static int echo_commitrw(int cmd, struct obd_export *export, struct obdo *oa,
471                          int objcount, struct obd_ioobj *obj,
472                          struct niobuf_remote *rb, int niocount,
473                          struct niobuf_local *res, struct obd_trans_info *oti,
474                          int rc)
475 {
476         struct obd_device *obd;
477         int pgs = 0;
478         int i;
479         ENTRY;
480
481         obd = export->exp_obd;
482         if (obd == NULL)
483                 RETURN(-EINVAL);
484
485         if (rc)
486                 GOTO(commitrw_cleanup, rc);
487
488         if ((cmd & OBD_BRW_RWMASK) == OBD_BRW_READ) {
489                 CDEBUG(D_PAGE, "reading %d obdos with %d IOs\n",
490                        objcount, niocount);
491         } else {
492                 CDEBUG(D_PAGE, "writing %d obdos with %d IOs\n",
493                        objcount, niocount);
494         }
495
496         if (niocount && res == NULL) {
497                 CERROR("NULL res niobuf with niocount %d\n", niocount);
498                 RETURN(-EINVAL);
499         }
500
501         LASSERT(oti == NULL || oti->oti_handle == (void *)DESC_PRIV);
502
503         for (i = 0; i < objcount; i++, obj++) {
504                 int verify = (rc == 0 &&
505                               obj->ioo_id != ECHO_PERSISTENT_OBJID &&
506                               (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
507                               (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
508                 int j;
509
510                 for (j = 0 ; j < obj->ioo_bufcnt ; j++, rb++) {
511                         int vrc = echo_finalize_lb(oa, obj, rb, &pgs, &res[pgs], verify);
512
513                         if (vrc == 0)
514                                 continue;
515
516                         if (vrc == -EFAULT)
517                                 GOTO(commitrw_cleanup, rc = vrc);
518
519                         if (rc == 0)
520                                 rc = vrc;
521                 }
522
523         }
524
525         cfs_atomic_sub(pgs, &obd->u.echo.eo_prep);
526
527         CDEBUG(D_PAGE, "%d pages remain after commit\n",
528                cfs_atomic_read(&obd->u.echo.eo_prep));
529         RETURN(rc);
530
531 commitrw_cleanup:
532         cfs_atomic_sub(pgs, &obd->u.echo.eo_prep);
533
534         CERROR("cleaning up %d pages (%d obdos)\n",
535                niocount - pgs - 1, objcount);
536
537         while (pgs < niocount) {
538                 cfs_page_t *page = res[pgs++].page;
539
540                 if (page == NULL)
541                         continue;
542
543                 /* NB see comment above regarding persistent pages */
544                 OBD_PAGE_FREE(page);
545                 cfs_atomic_dec(&obd->u.echo.eo_prep);
546         }
547         return rc;
548 }
549
550 static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
551 {
552         struct lprocfs_static_vars lvars;
553         int                        rc;
554         int                        lock_flags = 0;
555         struct ldlm_res_id         res_id = {.name = {1}};
556         char                       ns_name[48];
557         ENTRY;
558
559         obd->u.echo.eo_obt.obt_magic = OBT_MAGIC;
560         cfs_spin_lock_init(&obd->u.echo.eo_lock);
561         obd->u.echo.eo_lastino = ECHO_INIT_OID;
562
563         sprintf(ns_name, "echotgt-%s", obd->obd_uuid.uuid);
564         obd->obd_namespace = ldlm_namespace_new(obd, ns_name,
565                                                 LDLM_NAMESPACE_SERVER,
566                                                 LDLM_NAMESPACE_MODEST,
567                                                 LDLM_NS_TYPE_OST);
568         if (obd->obd_namespace == NULL) {
569                 LBUG();
570                 RETURN(-ENOMEM);
571         }
572
573         rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id, LDLM_PLAIN,
574                                     NULL, LCK_NL, &lock_flags, NULL,
575                                     ldlm_completion_ast, NULL, NULL, 0, NULL,
576                                     &obd->u.echo.eo_nl_lock);
577         LASSERT (rc == ELDLM_OK);
578
579         lprocfs_echo_init_vars(&lvars);
580         if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 &&
581             lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) {
582                 lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
583                                      LPROCFS_CNTR_AVGMINMAX,
584                                      "read_bytes", "bytes");
585                 lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_WRITE_BYTES,
586                                      LPROCFS_CNTR_AVGMINMAX,
587                                      "write_bytes", "bytes");
588         }
589
590         ptlrpc_init_client (LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
591                             "echo_ldlm_cb_client", &obd->obd_ldlm_client);
592         RETURN(0);
593 }
594
595 static int echo_cleanup(struct obd_device *obd)
596 {
597         int leaked;
598         ENTRY;
599
600         lprocfs_obd_cleanup(obd);
601         lprocfs_free_obd_stats(obd);
602
603         ldlm_lock_decref(&obd->u.echo.eo_nl_lock, LCK_NL);
604
605         /* XXX Bug 3413; wait for a bit to ensure the BL callback has
606          * happened before calling ldlm_namespace_free() */
607         cfs_schedule_timeout_and_set_state(CFS_TASK_UNINT, cfs_time_seconds(1));
608
609         ldlm_namespace_free(obd->obd_namespace, NULL, obd->obd_force);
610         obd->obd_namespace = NULL;
611
612         leaked = cfs_atomic_read(&obd->u.echo.eo_prep);
613         if (leaked != 0)
614                 CERROR("%d prep/commitrw pages leaked\n", leaked);
615
616         RETURN(0);
617 }
618
619 struct obd_ops echo_obd_ops = {
620         .o_owner           = THIS_MODULE,
621         .o_connect         = echo_connect,
622         .o_disconnect      = echo_disconnect,
623         .o_init_export     = echo_init_export,
624         .o_destroy_export  = echo_destroy_export,
625         .o_create          = echo_create,
626         .o_destroy         = echo_destroy,
627         .o_getattr         = echo_getattr,
628         .o_setattr         = echo_setattr,
629         .o_preprw          = echo_preprw,
630         .o_commitrw        = echo_commitrw,
631         .o_setup           = echo_setup,
632         .o_cleanup         = echo_cleanup
633 };
634
635 void echo_persistent_pages_fini(void)
636 {
637         int     i;
638
639         for (i = 0; i < ECHO_PERSISTENT_PAGES; i++)
640                 if (echo_persistent_pages[i] != NULL) {
641                         OBD_PAGE_FREE(echo_persistent_pages[i]);
642                         echo_persistent_pages[i] = NULL;
643                 }
644 }
645
646 int echo_persistent_pages_init(void)
647 {
648         cfs_page_t *pg;
649         int          i;
650
651         for (i = 0; i < ECHO_PERSISTENT_PAGES; i++) {
652                 int gfp_mask = (i < ECHO_PERSISTENT_PAGES/2) ?
653                         CFS_ALLOC_STD : CFS_ALLOC_HIGHUSER;
654
655                 OBD_PAGE_ALLOC(pg, gfp_mask);
656                 if (pg == NULL) {
657                         echo_persistent_pages_fini ();
658                         return (-ENOMEM);
659                 }
660
661                 memset (cfs_kmap (pg), 0, CFS_PAGE_SIZE);
662                 cfs_kunmap (pg);
663
664                 echo_persistent_pages[i] = pg;
665         }
666
667         return (0);
668 }