From b45be8d31a33d707f697ba076b46184440d8b540 Mon Sep 17 00:00:00 2001 From: pschwan Date: Fri, 25 Oct 2002 01:15:43 +0000 Subject: [PATCH] b=611336 Land Alok's patch with a couple small modifications (which were my fault, for lying to him about the return values of osc_brw_{read,write}) --- lustre/osc/osc_request.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 64a1e26..3e26333 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -36,6 +36,7 @@ #include #include /* for OBD_FAIL_CHECK */ #include /* for ll_i2info */ +#include /* for PTL_MD_MAX_IOV */ static int osc_getattr(struct lustre_handle *conn, struct obdo *oa, struct lov_stripe_md *md) @@ -609,10 +610,31 @@ static int osc_brw(int cmd, struct lustre_handle *conn, struct brw_page *pga, brw_callback_t callback, struct io_cb_data *data) { - if (cmd & OBD_BRW_WRITE) - return osc_brw_write(conn, md, page_count, pga, callback, data); - else - return osc_brw_read(conn, md, page_count, pga, callback, data); + ENTRY; + + while (page_count) { + obd_count pages_per_brw; + int rc; + + if (page_count > PTL_MD_MAX_IOV) + pages_per_brw = PTL_MD_MAX_IOV; + else + pages_per_brw = page_count; + + if (cmd & OBD_BRW_WRITE) + rc = osc_brw_write(conn, md, pages_per_brw, pga, + callback, data); + else + rc = osc_brw_read(conn, md, pages_per_brw, pga, + callback, data); + + if (rc != 0) + RETURN(rc); + + page_count -= pages_per_brw; + pga += pages_per_brw; + } + RETURN(0); } static int osc_enqueue(struct lustre_handle *connh, struct lov_stripe_md *lsm, @@ -783,7 +805,7 @@ static int osc_iocontrol(long cmd, struct lustre_handle *conn, int len, obddev->u.cli.cl_containing_lov = (struct obd_device *)karg; GOTO(out, err); } - + default: GOTO(out, err = -ENOTTY); } -- 1.8.3.1