return 0;
}
+static int osc_punch(struct obd_conn *conn, struct obdo *oa, obd_size count, obd_off offset)
+{
+ struct ptlrpc_request *request;
+ int rc;
+
+ if (!oa) {
+ CERROR("oa NULL\n");
+ }
+ request = ost_prep_req(OST_PUNCH, 0, NULL, 0, NULL);
+ if (!request) {
+ CERROR("cannot pack req!\n");
+ return -ENOMEM;
+ }
+
+ memcpy(&request->rq_req.ost->oa, oa, sizeof(*oa));
+ request->rq_req.ost->oa.o_valid = ~0;
+ request->rq_req.ost->oa.o_size = offset;
+ request->rq_req.ost->oa.o_blocks = count;
+ request->rq_replen =
+ sizeof(struct ptlrep_hdr) + sizeof(struct ost_rep);
+
+ rc = osc_queue_wait(conn, request);
+ if (rc) {
+ EXIT;
+ goto out;
+ }
+ memcpy(oa, &request->rq_rep.ost->oa, sizeof(*oa));
+
+ out:
+ osc_free_req(request);
+ return 0;
+}
+
static int osc_destroy(struct obd_conn *conn, struct obdo *oa)
{
struct ptlrpc_request *request;
o_setattr: osc_setattr,
o_connect: osc_connect,
o_disconnect: osc_disconnect,
- o_brw: osc_brw
+ o_brw: osc_brw,
+ o_punch: osc_punch
};
static int __init osc_init(void)
return 0;
}
+static int ost_punch(struct ost_obd *ost, struct ptlrpc_request *req)
+{
+ struct obd_conn conn;
+ int rc;
+
+ ENTRY;
+
+ conn.oc_id = req->rq_req.ost->connid;
+ conn.oc_dev = ost->ost_tgt;
+
+ rc = ost_pack_rep(NULL, 0, NULL, 0, &req->rq_rephdr, &req->rq_rep.ost,
+ &req->rq_replen, &req->rq_repbuf);
+ if (rc) {
+ CERROR("cannot pack reply\n");
+ return rc;
+ }
+
+ memcpy(&req->rq_rep.ost->oa, &req->rq_req.ost->oa, sizeof(req->rq_req.ost->oa));
+
+ req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_punch
+ (&conn, &req->rq_rep.ost->oa,
+ req->rq_rep.ost->oa.o_size,
+ req->rq_rep.ost->oa.o_blocks);
+
+ EXIT;
+ return 0;
+}
+
static int ost_setattr(struct ost_obd *ost, struct ptlrpc_request *req)
{
CDEBUG(D_INODE, "brw\n");
rc = ost_brw(ost, req);
break;
+ case OST_PUNCH:
+ CDEBUG(D_INODE, "punch\n");
+ rc = ost_punch(ost, req);
+ break;
default:
req->rq_status = -ENOTSUPP;
return ost_error(obddev, req);