* Lustre is a trademark of Cluster File Systems, Inc.
*
*/
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <pthread.h>
#include <poll.h>
#include <lnet/lib-lnet.h>
*/
#define __USE_FILE_OFFSET64
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <stdio.h>
#ifdef HAVE_NETDB_H
__u32 version, int opcode, char **bufs,
struct ptlrpc_cli_ctx *ctx);
struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, __u32 version,
- int opcode, int count, int *lengths,
+ int opcode, int count, __u32 *lengths,
char **bufs);
struct ptlrpc_request *ptlrpc_prep_req_pool(struct obd_import *imp,
__u32 version, int opcode,
- int count, int *lengths, char **bufs,
+ int count, __u32 *lengths, char **bufs,
struct ptlrpc_request_pool *pool);
void ptlrpc_free_req(struct ptlrpc_request *request);
void ptlrpc_req_finished(struct ptlrpc_request *request);
int ptlrpc_reconnect_import(struct obd_import *imp);
int lustre_msg_swabbed(struct lustre_msg *msg);
int lustre_msg_check_version(struct lustre_msg *msg, __u32 version);
-void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, int *lens,
+void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens,
char **bufs);
int lustre_pack_request(struct ptlrpc_request *, __u32 magic, int count,
- int *lens, char **bufs);
-int lustre_pack_reply(struct ptlrpc_request *, int count, int *lens,
+ __u32 *lens, char **bufs);
+int lustre_pack_reply(struct ptlrpc_request *, int count, __u32 *lens,
char **bufs);
int lustre_pack_reply_v2(struct ptlrpc_request *req, int count,
- int *lens, char **bufs, int flags);
+ __u32 *lens, char **bufs, int flags);
#define LPRFL_EARLY_REPLY 1
-int lustre_pack_reply_flags(struct ptlrpc_request *, int count, int *lens,
+int lustre_pack_reply_flags(struct ptlrpc_request *, int count, __u32 *lens,
char **bufs, int flags);
int lustre_shrink_msg(struct lustre_msg *msg, int segment,
unsigned int newlen, int move_data);
void lustre_free_reply_state(struct ptlrpc_reply_state *rs);
int lustre_msg_hdr_size(__u32 magic, int count);
-int lustre_msg_size(__u32 magic, int count, int *lengths);
-int lustre_msg_size_v2(int count, int *lengths);
+int lustre_msg_size(__u32 magic, int count, __u32 *lengths);
+int lustre_msg_size_v2(int count, __u32 *lengths);
int lustre_packed_msg_size(struct lustre_msg *msg);
int lustre_msg_early_size(void);
int lustre_unpack_msg(struct lustre_msg *m, int len);
void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno);
void lustre_msg_set_status(struct lustre_msg *msg, __u32 status);
void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt);
-void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, int *sizes);
+void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *sizes);
void ptlrpc_request_set_replen(struct ptlrpc_request *req);
void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout);
void lustre_msg_set_service_time(struct lustre_msg *msg, __u32 service_time);
const struct req_format *rc_fmt;
__u32 rc_swabbed;
enum req_location rc_loc;
- int rc_area[RCL_NR][REQ_MAX_FIELD_NR];
+ __u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR];
};
#if !defined(__REQ_LAYOUT_USER__)
int req_capsule_get_size(const struct req_capsule *pill,
const struct req_msg_field *field,
enum req_location loc);
-int req_capsule_msg_size(const struct req_capsule *pill, enum req_location loc);
+int req_capsule_msg_size(struct req_capsule *pill, enum req_location loc);
int req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
enum req_location loc);
void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt);
EXIT;
}
-static void target_recovery_expired(unsigned long castmeharder)
-{
- struct obd_device *obd = (struct obd_device *)castmeharder;
- LCONSOLE_WARN("%s: recovery timed out; %d clients never reconnected "
- "after %lds (%d clients did)\n",
- obd->obd_name, obd->obd_recoverable_clients,
- cfs_time_current_sec()- obd->obd_recovery_start,
- obd->obd_connected_clients);
- spin_lock_bh(&obd->obd_processing_task_lock);
- if (obd->obd_recovering)
- obd->obd_abort_recovery = 1;
- cfs_waitq_signal(&obd->obd_next_transno_waitq);
- spin_unlock_bh(&obd->obd_processing_task_lock);
-}
-
-
/* obd_processing_task_lock should be held */
void target_cancel_recovery_timer(struct obd_device *obd)
{
obd->obd_name, (unsigned)left);
}
-static void resume_recovery_timer(struct obd_device *obd)
-{
- LASSERT(!cfs_timer_is_armed(&obd->obd_recovery_timer));
-
- /* to be safe, make it at least OBD_RECOVERY_FACTOR * obd_timeout */
- reset_recovery_timer(obd, OBD_RECOVERY_FACTOR * obd_timeout, 1);
-}
-
static void check_and_start_recovery_timer(struct obd_device *obd)
{
spin_lock_bh(&obd->obd_processing_task_lock);
RETURN(0);
}
+static void resume_recovery_timer(struct obd_device *obd)
+{
+ LASSERT(!cfs_timer_is_armed(&obd->obd_recovery_timer));
+
+ /* to be safe, make it at least OBD_RECOVERY_FACTOR * obd_timeout */
+ reset_recovery_timer(obd, OBD_RECOVERY_FACTOR * obd_timeout, 1);
+}
+
static int target_recovery_thread(void *arg)
{
struct obd_device *obd = arg;
}
EXPORT_SYMBOL(target_recovery_fini);
+static void target_recovery_expired(unsigned long castmeharder)
+{
+ struct obd_device *obd = (struct obd_device *)castmeharder;
+ LCONSOLE_WARN("%s: recovery timed out; %d clients never reconnected "
+ "after %lds (%d clients did)\n",
+ obd->obd_name, obd->obd_recoverable_clients,
+ cfs_time_current_sec()- obd->obd_recovery_start,
+ obd->obd_connected_clients);
+ spin_lock_bh(&obd->obd_processing_task_lock);
+ if (obd->obd_recovering)
+ obd->obd_abort_recovery = 1;
+ cfs_waitq_signal(&obd->obd_next_transno_waitq);
+ spin_unlock_bh(&obd->obd_processing_task_lock);
+}
+
void target_recovery_init(struct obd_device *obd, svc_handler_t handler)
{
if (obd->obd_max_recoverable_clients == 0)
struct ptlrpc_request *req;
struct mgs_send_param *req_msp, *rep_msp;
int size[] = { sizeof(struct ptlrpc_body), sizeof(*req_msp) };
- int rep_size[] = { sizeof(struct ptlrpc_body), sizeof(*msp) };
+ __u32 rep_size[] = { sizeof(struct ptlrpc_body), sizeof(*msp) };
int rc;
ENTRY;
int idx, rc, tmpflags = 0, only_liblustre = 1;
struct ldlm_interval_tree *tree;
struct filter_intent_args arg;
- int repsize[3] = { [MSG_PTLRPC_BODY_OFF] = sizeof(struct ptlrpc_body),
+ __u32 repsize[3] = { [MSG_PTLRPC_BODY_OFF] = sizeof(struct ptlrpc_body),
[DLM_LOCKREPLY_OFF] = sizeof(*rep),
[DLM_REPLY_REC_OFF] = sizeof(*reply_lvb) };
ENTRY;
{
struct ptlrpc_request *request;
struct ost_body *body;
- int size[] = { sizeof(struct ptlrpc_body), sizeof(*body) };
+ __u32 size[] = { sizeof(struct ptlrpc_body), sizeof(*body) };
ENTRY;
LASSERT_SPIN_LOCKED(&oscc->oscc_lock);
struct obd_trans_info *oti)
{
struct ost_body *body, *repbody;
- int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*body) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*body) };
+ int rc;
ENTRY;
body = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*body),
{
struct ost_body *body, *repbody;
struct obd_info oinfo = { { { 0 } } };
- int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*body) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*body) };
+ int rc;
ENTRY;
body = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*body),
static int ost_statfs(struct ptlrpc_request *req)
{
struct obd_statfs *osfs;
- int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*osfs) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*osfs) };
+ int rc;
ENTRY;
rc = lustre_pack_reply(req, 2, size, NULL);
struct obd_trans_info *oti)
{
struct ost_body *body, *repbody;
- int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*repbody) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*repbody) };
+ int rc;
ENTRY;
body = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*body),
{
struct obd_info oinfo = { { { 0 } } };
struct ost_body *body, *repbody;
- int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*repbody) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*repbody) };
+ int rc;
struct lustre_handle lh = {0,};
ENTRY;
{
struct ost_body *body, *repbody;
struct lustre_capa *capa = NULL;
- int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*repbody) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*repbody) };
+ int rc;
ENTRY;
body = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*body),
struct obd_trans_info *oti)
{
struct ost_body *body, *repbody;
- int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*repbody) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*repbody) };
+ int rc;
struct obd_info oinfo = { { { 0 } } };
ENTRY;
struct lustre_capa *capa = NULL;
struct l_wait_info lwi;
struct lustre_handle lockh = { 0 };
- int size[2] = { sizeof(struct ptlrpc_body), sizeof(*body) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*body) };
int niocount, npages, nob = 0, rc, i;
int no_reply = 0;
ENTRY;
struct lustre_handle lockh = {0};
struct lustre_capa *capa = NULL;
__u32 *rcs;
- int size[3] = { sizeof(struct ptlrpc_body), sizeof(*body) };
+ __u32 size[3] = { sizeof(struct ptlrpc_body), sizeof(*body) };
int objcount, niocount, npages;
int rc, swab, i, j;
obd_count client_cksum = 0, server_cksum = 0;
static int ost_handle_quotactl(struct ptlrpc_request *req)
{
struct obd_quotactl *oqctl, *repoqc;
- int rc, size[2] = { sizeof(struct ptlrpc_body), sizeof(*repoqc) };
+ __u32 size[2] = { sizeof(struct ptlrpc_body), sizeof(*repoqc) };
+ int rc;
ENTRY;
oqctl = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*oqctl),
static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request,
__u32 version, int opcode,
- int count, int *lengths, char **bufs,
+ int count, __u32 *lengths, char **bufs,
struct ptlrpc_cli_ctx *ctx)
{
struct obd_import *imp = request->rq_import;
struct ptlrpc_request *
ptlrpc_prep_req_pool(struct obd_import *imp,
__u32 version, int opcode,
- int count, int *lengths, char **bufs,
+ int count, __u32 *lengths, char **bufs,
struct ptlrpc_request_pool *pool)
{
struct ptlrpc_request *request;
struct ptlrpc_request *
ptlrpc_prep_req(struct obd_import *imp, __u32 version, int opcode, int count,
- int *lengths, char **bufs)
+ __u32 *lengths, char **bufs)
{
return ptlrpc_prep_req_pool(imp, version, opcode, count, lengths, bufs,
NULL);
struct gss_cli_ctx *gctx;
rawobj_t hdrobj, msgobj, token;
struct gss_header *ghdr;
- int buflens[2], wiresize, rc;
- __u32 major;
+ __u32 buflens[2], major;
+ int wiresize, rc;
ENTRY;
LASSERT(req->rq_clrbuf);
int svc, int msgsize)
{
int bufsize, txtsize;
- int buflens[5], bufcnt = 2;
+ int bufcnt = 2;
+ __u32 buflens[5];
ENTRY;
/*
struct ptlrpc_request *req,
int msgsize)
{
- int ibuflens[3], ibufcnt;
- int wbuflens[2];
+ __u32 ibuflens[3], wbuflens[2];
+ int ibufcnt;
int clearsize, wiresize;
ENTRY;
int svc, int msgsize)
{
int txtsize;
- int buflens[4], bufcnt = 2;
+ __u32 buflens[4];
+ int bufcnt = 2;
int alloc_size;
/*
int msgsize)
{
int txtsize;
- int buflens[2], bufcnt;
+ __u32 buflens[2];
+ int bufcnt;
int alloc_size;
/* inner buffers */
{
struct lustre_msg *newclrbuf;
int newmsg_size, newclrbuf_size, newcipbuf_size;
- int buflens[3];
+ __u32 buflens[3];
/*
* embedded msg is at seg 0 of clear buffer;
struct gss_svc_reqctx *grctx;
struct ptlrpc_reply_state *rs;
int early, privacy, svc, bsd_off = 0;
- int ibuflens[2], ibufcnt = 0;
- int buflens[4], bufcnt;
+ __u32 ibuflens[2], buflens[4];
+ int ibufcnt = 0, bufcnt;
int txtsize, wmsg_size, rs_size;
ENTRY;
rawobj_t hdrobj, msgobj, token;
struct gss_header *ghdr;
__u8 *token_buf;
- int token_buflen, buflens[2];
+ int token_buflen;
+ __u32 buflens[2], major;
int msglen, rc;
- __u32 major;
ENTRY;
/* get clear data length. note embedded lustre_msg might
static void gss_init_at_reply_offset(void)
{
- int buflens[3], clearsize;
+ __u32 buflens[3];
+ int clearsize;
buflens[0] = PTLRPC_GSS_HEADER_SIZE;
buflens[1] = lustre_msg_early_size();
}
EXPORT_SYMBOL(req_capsule_get_size);
-int req_capsule_msg_size(const struct req_capsule *pill, enum req_location loc)
+int req_capsule_msg_size(struct req_capsule *pill, enum req_location loc)
{
return lustre_msg_size(pill->rc_req->rq_import->imp_msg_magic,
pill->rc_fmt->rf_fields[loc].nr,
- (int *)pill->rc_area[loc]);
+ pill->rc_area[loc]);
}
int req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
}
EXPORT_SYMBOL(lustre_msg_early_size);
-int lustre_msg_size_v2(int count, int *lengths)
+int lustre_msg_size_v2(int count, __u32 *lengths)
{
int size;
int i;
* in the form of a v2 request. If this is a connection to a v1
* target then the first buffer will be stripped because the ptlrpc
* data is part of the lustre_msg_v1 header. b=14043 */
-int lustre_msg_size(__u32 magic, int count, int *lens)
+int lustre_msg_size(__u32 magic, int count, __u32 *lens)
{
- int size[] = { sizeof(struct ptlrpc_body) };
+ __u32 size[] = { sizeof(struct ptlrpc_body) };
if (!lens) {
LASSERT(count == 1);
}
}
-void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, int *lens,
+void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens,
char **bufs)
{
char *ptr;
EXPORT_SYMBOL(lustre_init_msg_v2);
static int lustre_pack_request_v2(struct ptlrpc_request *req,
- int count, int *lens, char **bufs)
+ int count, __u32 *lens, char **bufs)
{
int reqlen, rc;
}
int lustre_pack_request(struct ptlrpc_request *req, __u32 magic, int count,
- int *lens, char **bufs)
+ __u32 *lens, char **bufs)
{
- int size[] = { sizeof(struct ptlrpc_body) };
+ __u32 size[] = { sizeof(struct ptlrpc_body) };
if (!lens) {
LASSERT(count == 1);
}
int lustre_pack_reply_v2(struct ptlrpc_request *req, int count,
- int *lens, char **bufs, int flags)
+ __u32 *lens, char **bufs, int flags)
{
struct ptlrpc_reply_state *rs;
int msg_len, rc;
}
EXPORT_SYMBOL(lustre_pack_reply_v2);
-int lustre_pack_reply_flags(struct ptlrpc_request *req, int count, int *lens,
+int lustre_pack_reply_flags(struct ptlrpc_request *req, int count, __u32 *lens,
char **bufs, int flags)
{
int rc = 0;
- int size[] = { sizeof(struct ptlrpc_body) };
+ __u32 size[] = { sizeof(struct ptlrpc_body) };
if (!lens) {
LASSERT(count == 1);
return rc;
}
-int lustre_pack_reply(struct ptlrpc_request *req, int count, int *lens,
+int lustre_pack_reply(struct ptlrpc_request *req, int count, __u32 *lens,
char **bufs)
{
return lustre_pack_reply_flags(req, count, lens, bufs, 0);
memcpy(newpos, tail, tail_len);
}
out:
- return lustre_msg_size_v2(msg->lm_bufcount, (int *)msg->lm_buflens);
+ return lustre_msg_size_v2(msg->lm_bufcount, msg->lm_buflens);
}
/*
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
- return crc32_le(~(__u32)0, (char *)pb, sizeof(*pb));
+ return crc32_le(~(__u32)0, (unsigned char *)pb, sizeof(*pb));
}
default:
CERROR("incorrect message magic: %08x\n", msg->lm_magic);
req->rq_reqmsg->lm_repsize = req->rq_replen;
}
-void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, int *lens)
+void ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *lens)
{
req->rq_replen = lustre_msg_size(req->rq_reqmsg->lm_magic, count, lens);
if (req->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V2)
nob : pga[i]->count;
desc->bd_iov[i].kiov_offset = pga[i]->off & ~CFS_PAGE_MASK;
#else
-#warning FIXME for liblustre!
desc->bd_iov[i].iov_base = pga[i]->pg->addr;
desc->bd_iov[i].iov_len = pga[i]->count > nob ?
nob : pga[i]->count;
if (req->rq_repdata->lm_magic == LUSTRE_MSG_MAGIC_V2_SWABBED)
__swab32s(&cksums);
- cksumc = crc32_le(!(__u32) 0, (char *) req->rq_repdata,
+ cksumc = crc32_le(!(__u32) 0, (unsigned char *)req->rq_repdata,
req->rq_repdata_len);
if (cksumc != cksums) {
CWARN("early reply checksum mismatch: %08x != %08x\n",
req->rq_reply_off = lustre_msg_early_size();
} else {
rs->rs_repbuf->lm_cksum =
- crc32_le(!(__u32) 0, (char *) rs->rs_repbuf,
+ crc32_le(!(__u32) 0,
+ (unsigned char *)rs->rs_repbuf,
rs->rs_repdata_len);
req->rq_reply_off = 0;
}
struct ptlrpc_request *req,
int msgsize)
{
- int buflens[PLAIN_PACK_SEGMENTS] = { 0, };
+ __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
int alloc_len;
ENTRY;
struct ptlrpc_request *req,
int msgsize)
{
- int buflens[PLAIN_PACK_SEGMENTS] = { 0, };
+ __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
int alloc_len;
ENTRY;
{
struct ptlrpc_reply_state *rs;
struct ptlrpc_bulk_sec_desc *bsd;
- int buflens[PLAIN_PACK_SEGMENTS] = { 0, };
+ __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
int rs_size = sizeof(*rs);
ENTRY;
int sptlrpc_plain_init(void)
{
- int buflens[PLAIN_PACK_SEGMENTS] = { 0, };
+ __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
int rc;
buflens[PLAIN_PACK_MSG_OFF] = lustre_msg_early_size();
else
cfs_timer_arm(&svc->srv_at_timer, cfs_time_shift(next));
spin_unlock(&svc->srv_at_lock);
- CDEBUG(D_INFO, "armed %s at %+lds\n", svc->srv_name, next);
+ CDEBUG(D_INFO, "armed %s at %+ds\n", svc->srv_name, next);
}
/* Add rpc to early reply check list */
*/
/* for O_DIRECT */
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include<stdio.h>
#include<errno.h>
*/
/* for O_DIRECTORY */
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <stdlib.h>
#include <stdio.h>
*/
/* Safely read the last_rcvd file from a device */
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
*/
/* This source file is compiled into both mkfs.lustre and tunefs.lustre */
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
*
*/
-
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>