From f8c4d7faa6defc70b5c5d6ea04fa0acf2c22e6c6 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 2 Mar 2009 10:57:35 +0000 Subject: [PATCH] - changes to ofd reflecting fixes in OSD API --- lustre/ofd/ofd_clients.c | 7 +++---- lustre/ofd/ofd_fs.c | 16 +++++++++------- lustre/ofd/ofd_io.c | 20 +++++++++++--------- lustre/ofd/ofd_objects.c | 12 ++++++------ lustre/ofd/ofd_recovery.c | 7 ++++--- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/lustre/ofd/ofd_clients.c b/lustre/ofd/ofd_clients.c index 49bd9a8..89abbc2 100644 --- a/lustre/ofd/ofd_clients.c +++ b/lustre/ofd/ofd_clients.c @@ -81,8 +81,7 @@ repeat: RETURN(PTR_ERR(th)); /* off is changed, use tmp value */ off = fed->fed_lr_off; - dt_declare_record_write(env, ofd->ofd_last_rcvd, sizeof(*lcd), - off, th, BYPASS_CAPA); + dt_declare_record_write(env, ofd->ofd_last_rcvd, sizeof(*lcd), off, th); err = filter_trans_start(env, ofd, th); if (err) RETURN(err); @@ -177,10 +176,10 @@ int filter_client_free(struct lu_env *env, struct obd_export *exp) GOTO(free, rc = PTR_ERR(th)); /* declare last_rcvd write */ dt_declare_record_write(env, ofd->ofd_last_rcvd, sizeof(*lcd), - fed->fed_lr_off, th, BYPASS_CAPA); + fed->fed_lr_off, th); /* declare header write */ dt_declare_record_write(env, ofd->ofd_last_rcvd, - sizeof(ofd->ofd_fsd), 0, th, BYPASS_CAPA); + sizeof(ofd->ofd_fsd), 0, th); rc = filter_trans_start(env, ofd, th); if (rc) diff --git a/lustre/ofd/ofd_fs.c b/lustre/ofd/ofd_fs.c index c152748..d707649 100644 --- a/lustre/ofd/ofd_fs.c +++ b/lustre/ofd/ofd_fs.c @@ -104,13 +104,14 @@ int filter_last_id_write(const struct lu_env *env, struct filter_device *ofd, if (IS_ERR(th)) RETURN(PTR_ERR(th)); rc = dt_declare_record_write(env, ofd->ofd_groups_file, - buf.lb_len, off, th, BYPASS_CAPA); + buf.lb_len, off, th); LASSERT(rc == 0); rc = filter_trans_start(env, ofd, th); if (rc) RETURN(rc); - rc = dt_record_write(env, ofd->ofd_groups_file, &buf, &off, th, 1); + rc = dt_record_write(env, ofd->ofd_groups_file, &buf, &off, + th, BYPASS_CAPA, 1); if (rc) CERROR("write group "LPU64" last objid: rc = %d\n", group, rc); @@ -273,7 +274,8 @@ int filter_last_rcvd_header_write(const struct lu_env *env, fsd_cpu_to_le(&ofd->ofd_fsd, &info->fti_fsd); - rc = dt_record_write(env, ofd->ofd_last_rcvd, &buf, &off, th, 1); + rc = dt_record_write(env, ofd->ofd_last_rcvd, &buf, + &off, th, BYPASS_CAPA, 1); CDEBUG(D_INFO, "write last_rcvd header rc = %d:\n" "uuid = %s\nlast_transno = "LPU64"\n", rc, ofd->ofd_fsd.lsd_uuid, ofd->ofd_fsd.lsd_last_transno); @@ -312,7 +314,8 @@ int filter_last_rcvd_write(const struct lu_env *env, buf.lb_buf = &info->fti_fsd; buf.lb_len = sizeof(info->fti_fsd); - rc = dt_record_write(env, ofd->ofd_last_rcvd, &buf, off, th, 1); + rc = dt_record_write(env, ofd->ofd_last_rcvd, &buf, + off, th, BYPASS_CAPA, 1); return rc; } @@ -442,7 +445,7 @@ int filter_server_data_update(const struct lu_env *env, if (IS_ERR(th)) RETURN(PTR_ERR(th)); dt_declare_record_write(env, ofd->ofd_last_rcvd, - sizeof(ofd->ofd_fsd), 0, th, BYPASS_CAPA); + sizeof(ofd->ofd_fsd), 0, th); rc = filter_trans_start(env, ofd, th); if (rc) RETURN(rc); @@ -465,8 +468,7 @@ int filter_server_data_init(const struct lu_env *env, #endif int rc; - rc = dt_attr_get(env, ofd->ofd_last_rcvd, &info->fti_attr, - BYPASS_CAPA); + rc = dt_attr_get(env, ofd->ofd_last_rcvd, &info->fti_attr, BYPASS_CAPA); if (rc) RETURN(rc); diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index b4a80cf..64578fe 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -52,7 +52,8 @@ static int filter_preprw_read(const struct lu_env *env, and prepare the latter */ for (i = 0, j = 0; i < niocount; i++) { rc = dt_bufs_get(env, filter_object_child(fo), - nb + i, res + j); + nb + i, res + j, 0, + filter_object_capa(env, fo)); LASSERT(rc > 0); LASSERT(rc < PTLRPC_MAX_BRW_PAGES); /* correct index for local buffers to continue with */ @@ -111,7 +112,8 @@ static int filter_preprw_write(const struct lu_env *env, struct obd_export *exp, /* parse remote buffers to local buffers and prepare the latter */ for (i = 0, j = 0; i < obj->ioo_bufcnt; i++) { rc = dt_bufs_get(env, filter_object_child(fo), - nb + i, res + j); + nb + i, res + j, 1, + filter_object_capa(env, fo)); LASSERT(rc > 0); LASSERT(rc < PTLRPC_MAX_BRW_PAGES); /* correct index for local buffers to continue with */ @@ -122,7 +124,7 @@ static int filter_preprw_write(const struct lu_env *env, struct obd_export *exp, LASSERT(*nr_local > 0 && *nr_local <= PTLRPC_MAX_BRW_PAGES); spin_lock(&exp->exp_obd->obd_osfs_lock); - filter_grant_incoming(exp, oa); + filter_grant_incoming(env, exp, oa); left = filter_grant_space_left(env, exp); rc = filter_grant_check(env, exp, oa, objcount, obj, nb, @@ -188,9 +190,9 @@ int filter_preprw(int cmd, struct obd_export *exp, struct obdo *oa, int objcount if (oa && oa->o_valid & OBD_MD_FLGRANT) { struct obd_device *obd = filter_obd(ofd); spin_lock(&obd->obd_osfs_lock); - filter_grant_incoming(exp, oa); - - oa->o_grant = 0; + filter_grant_incoming(&env, exp, oa); + if (!(oa->o_flags & OBD_FL_SHRINK_GRANT)) + oa->o_grant = 0; spin_unlock(&obd->obd_osfs_lock); } rc = filter_preprw_read(&env, ofd, &info->fti_fid, @@ -265,8 +267,7 @@ filter_commitrw_write(const struct lu_env *env, struct filter_device *ofd, LASSERT(rc == 0); if (la->la_valid) { - rc = dt_declare_attr_set(env, filter_object_child(fo), la, - th, filter_object_capa(env, fo)); + rc = dt_declare_attr_set(env, filter_object_child(fo), la, th); LASSERT(rc == 0); } @@ -278,7 +279,8 @@ filter_commitrw_write(const struct lu_env *env, struct filter_device *ofd, LASSERT(rc == 0); if (la->la_valid) { - rc = dt_attr_set(env, filter_object_child(fo), la, th); + rc = dt_attr_set(env, filter_object_child(fo), la, th, + filter_object_capa(env, fo)); LASSERT(rc == 0); } diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index cbfa05d..029291b 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -130,15 +130,15 @@ int filter_attr_set(const struct lu_env *env, struct filter_object *fo, if (IS_ERR(th)) RETURN(PTR_ERR(th)); - rc = dt_declare_attr_set(env, filter_object_child(fo), la, th, - filter_object_capa(env, fo)); + rc = dt_declare_attr_set(env, filter_object_child(fo), la, th); LASSERT(rc == 0); rc = filter_trans_start(env, ofd, th); if (rc) RETURN(rc); - rc = dt_attr_set(env, filter_object_child(fo), la, th); + rc = dt_attr_set(env, filter_object_child(fo), la, th, + filter_object_capa(env, fo)); filter_trans_stop(env, ofd, th); @@ -173,15 +173,15 @@ int filter_object_punch(const struct lu_env *env, struct filter_object *fo, if (IS_ERR(th)) RETURN(PTR_ERR(th)); - rc = dt_declare_attr_set(env, filter_object_child(fo), &attr, th, - filter_object_capa(env, fo)); + rc = dt_declare_attr_set(env, filter_object_child(fo), &attr, th); LASSERT(rc == 0); rc = filter_trans_start(env, ofd, th); if (rc) RETURN(rc); - rc = dt_attr_set(env, filter_object_child(fo), &attr, th); + rc = dt_attr_set(env, filter_object_child(fo), &attr, th, + filter_object_capa(env, fo)); filter_trans_stop(env, ofd, th); diff --git a/lustre/ofd/ofd_recovery.c b/lustre/ofd/ofd_recovery.c index 9641a16..22c2302 100644 --- a/lustre/ofd/ofd_recovery.c +++ b/lustre/ofd/ofd_recovery.c @@ -63,11 +63,12 @@ struct thandle *filter_trans_create(const struct lu_env *env, /* declare last_rcvd update */ fed = &info->fti_exp->exp_filter_data; - rc = dt_declare_record_write(env, ofd->ofd_last_rcvd, sizeof(*fed->fed_lcd), - fed->fed_lr_off, th, BYPASS_CAPA); + rc = dt_declare_record_write(env, ofd->ofd_last_rcvd, + sizeof(*fed->fed_lcd), + fed->fed_lr_off, th); /* declare last_rcvd header update */ rc = dt_declare_record_write(env, ofd->ofd_last_rcvd, - sizeof(ofd->ofd_fsd), 0, th, BYPASS_CAPA); + sizeof(ofd->ofd_fsd), 0, th); LASSERT(rc == 0); return th; -- 1.8.3.1