Store number of io block operations for processes

Store number of io block operations for processes for getrusage
This commit is contained in:
Xiaoguang Sun 2013-06-05 11:28:49 +00:00
parent a32f59cbb2
commit f8e3887484
11 changed files with 332 additions and 12 deletions

View File

@ -63,6 +63,10 @@ void lmfs_blockschange(dev_t dev, int delta);
void fs_blockstats(u32_t *blocks, u32_t *free, u32_t *used); void fs_blockstats(u32_t *blocks, u32_t *free, u32_t *used);
int fs_sync(void); int fs_sync(void);
typedef void (*lmfs_io_event_listener)(int rw_flag, dev_t dev, block_t block, void *user_data);
void lmfs_set_io_event_listener(lmfs_io_event_listener listener, void *user_data);
/* get_block arguments */ /* get_block arguments */
#define NORMAL 0 /* forces get_block to do disk read */ #define NORMAL 0 /* forces get_block to do disk read */
#define NO_READ 1 /* prevents get_block from doing disk read */ #define NO_READ 1 /* prevents get_block from doing disk read */

View File

@ -55,6 +55,49 @@
#define RES_SYMLOOP m9_s3 #define RES_SYMLOOP m9_s3
#define RES_UID m9_s4 #define RES_UID m9_s4
#define RES_CONREQS m9_s3 #define RES_CONREQS m9_s3
/* These fields are used when number of io blocks in one request could be large
* These requests use RES_INPUT_BLOCKS and RES_OUTPUT_BLOCKS
* REQ_BREAD
* REQ_READ
* REQ_BPEEK
* REQ_PEEK
* REQ_BWRITE
* REQ_WRITE
* REQ_FLUSH
* REQ_SYNC
*/
#define RES_INPUT_BLOCKS m9_l1
#define RES_OUTPUT_BLOCKS m9_l2
/* This field is used when both in and out blocks are required and small enough
* to be encoded into one field, HI stores in and LO stores out blocks.
* These requests use RES_INPUT_BLOCKS
* REQ_CHMOD
* REQ_CHOWN
* REQ_CREATE
* REQ_FSTATFS
* REQ_STATVFS
* REQ_FTRUNC
* REQ_GETDENTS
* REQ_INHIBREAD
* REQ_LINK
* REQ_LOOKUP
* REQ_MKDIR
* REQ_MKNOD
* REQ_MOUNTPOINT
* REQ_NEWNODE
* REQ_NEW_DRIVER
* REQ_PUTNODE
* REQ_RDLINK
* REQ_READSUPER
* REQ_RENAME
* REQ_RMDIR
* REQ_SLINK
* REQ_STAT
* REQ_UNLINK
* REQ_UNMOUNT
* REQ_UTIME
*/
#define RES_IO_BLOCKS m9_l2
/* VFS/FS flags */ /* VFS/FS flags */
#define REQ_RDONLY 001 #define REQ_RDONLY 001
@ -127,6 +170,10 @@ typedef struct {
#define TRNS_ADD_ID(t,id) (((t) << 16) | ((id) & 0xFFFF)) #define TRNS_ADD_ID(t,id) (((t) << 16) | ((id) & 0xFFFF))
#define TRNS_DEL_ID(t) ((short)((t) >> 16)) #define TRNS_DEL_ID(t) ((short)((t) >> 16))
#define IO_IN_BLOCKS(blocks) ((short)(blocks >> 16))
#define IO_OUT_BLOCKS(blocks) ((short)(blocks & 0xFFFF))
#define ENCODE_IO_BLOCKS(in, out) (in << 16 | (out & 0xFFFF))
#define PFS_BASE (VFS_BASE + 100) #define PFS_BASE (VFS_BASE + 100)
#define PFS_REQ_CHECK_PERMS (PFS_BASE + 1) #define PFS_REQ_CHECK_PERMS (PFS_BASE + 1)

View File

@ -44,6 +44,9 @@ static int rdwt_err;
static int quiet = 0; static int quiet = 0;
static lmfs_io_event_listener io_event_listener = NULL;
static void *io_event_listener_user_data = NULL;
void void
lmfs_setquiet(int q) { quiet = q; } lmfs_setquiet(int q) { quiet = q; }
@ -544,7 +547,8 @@ register struct buf *bp; /* buffer pointer */
/* Report read errors to interested parties. */ /* Report read errors to interested parties. */
rdwt_err = r; rdwt_err = r;
} } else if (io_event_listener)
io_event_listener(READING, bp->lmfs_dev, bp->lmfs_blocknr, io_event_listener_user_data);
} }
@ -703,6 +707,8 @@ void lmfs_rw_scattered(
MARKCLEAN(bp); MARKCLEAN(bp);
} }
r -= fs_block_size; r -= fs_block_size;
if (io_event_listener)
io_event_listener(rw_flag, dev, bp->lmfs_blocknr, io_event_listener_user_data);
} }
bufq += nblocks; bufq += nblocks;
bufqsize -= nblocks; bufqsize -= nblocks;
@ -928,3 +934,9 @@ int lmfs_do_bpeek(message *m)
return OK; return OK;
} }
void lmfs_set_io_event_listener(lmfs_io_event_listener listener, void *user_data)
{
io_event_listener = listener;
io_event_listener_user_data = user_data;
}

View File

@ -94,6 +94,23 @@ int transid;
*/ */
int r; int r;
switch (m_in.m_type) {
case REQ_BREAD:
case REQ_READ:
case REQ_BPEEK:
case REQ_PEEK:
case REQ_BWRITE:
case REQ_WRITE:
case REQ_FLUSH:
case REQ_SYNC:
m_out.RES_INPUT_BLOCKS = 0;
m_out.RES_OUTPUT_BLOCKS = 0;
break;
default:
m_out.RES_IO_BLOCKS = ENCODE_IO_BLOCKS(0, 0);
break;
}
m_out.m_type = err; m_out.m_type = err;
if (IS_VFS_FS_TRANSID(transid)) { if (IS_VFS_FS_TRANSID(transid)) {
/* If a transaction ID was set, reset it */ /* If a transaction ID was set, reset it */

View File

@ -129,6 +129,23 @@ static void send_reply(int err, int transid)
*/ */
int r; int r;
switch (fs_m_in.m_type) {
case REQ_BREAD:
case REQ_READ:
case REQ_BPEEK:
case REQ_PEEK:
case REQ_BWRITE:
case REQ_WRITE:
case REQ_FLUSH:
case REQ_SYNC:
fs_m_out.RES_INPUT_BLOCKS = 0;
fs_m_out.RES_OUTPUT_BLOCKS = 0;
break;
default:
fs_m_out.RES_IO_BLOCKS = ENCODE_IO_BLOCKS(0, 0);
break;
}
fs_m_out.m_type = err; fs_m_out.m_type = err;
if (IS_VFS_FS_TRANSID(transid)) { if (IS_VFS_FS_TRANSID(transid)) {
fs_m_out.m_type = TRNS_ADD_ID(fs_m_out.m_type, transid); fs_m_out.m_type = TRNS_ADD_ID(fs_m_out.m_type, transid);

View File

@ -21,6 +21,14 @@ static void sef_local_startup(void);
static int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
static void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/* IO event listener and variables */
typedef struct {
int in_blocks;
int out_blocks;
} ext2_io_event_listener_user_data;
static void ext2_io_event_listener(int rw_flag, dev_t dev, block_t block, void *user_data);
static ext2_io_event_listener_user_data io_event_count;
EXTERN int env_argc; EXTERN int env_argc;
EXTERN char **env_argv; EXTERN char **env_argv;
@ -61,6 +69,8 @@ int main(int argc, char *argv[])
/* Wait for request message. */ /* Wait for request message. */
get_work(&fs_m_in); get_work(&fs_m_in);
io_event_count.in_blocks = 0;
io_event_count.out_blocks = 0;
transid = TRNS_GET_ID(fs_m_in.m_type); transid = TRNS_GET_ID(fs_m_in.m_type);
fs_m_in.m_type = TRNS_DEL_ID(fs_m_in.m_type); fs_m_in.m_type = TRNS_DEL_ID(fs_m_in.m_type);
@ -213,6 +223,32 @@ static void reply(
message *m_out /* report result */ message *m_out /* report result */
) )
{ {
switch (fs_m_in.m_type) {
case REQ_BREAD:
case REQ_READ:
case REQ_BPEEK:
case REQ_PEEK:
case REQ_BWRITE:
case REQ_WRITE:
case REQ_FLUSH:
case REQ_SYNC:
fs_m_out.RES_INPUT_BLOCKS = io_event_count.in_blocks;
fs_m_out.RES_OUTPUT_BLOCKS = io_event_count.out_blocks;
break;
default:
fs_m_out.RES_IO_BLOCKS = ENCODE_IO_BLOCKS(
io_event_count.in_blocks,
io_event_count.out_blocks);
break;
}
if (OK != send(who, m_out)) /* send the message */ if (OK != send(who, m_out)) /* send the message */
printf("ext2(%d) was unable to send reply\n", SELF_E); printf("ext2(%d) was unable to send reply\n", SELF_E);
} }
void ext2_io_event_listener(int rw_flag, dev_t dev, block_t block, void *user_data)
{
if (rw_flag == WRITING)
((ext2_io_event_listener_user_data *) user_data)->out_blocks++;
else
((ext2_io_event_listener_user_data *) user_data)->in_blocks++;
}

View File

@ -144,6 +144,23 @@ void reply(who, m_out)
int who; int who;
message *m_out; /* report result */ message *m_out; /* report result */
{ {
switch (fs_m_in.m_type) {
case REQ_BREAD:
case REQ_READ:
case REQ_BPEEK:
case REQ_PEEK:
case REQ_BWRITE:
case REQ_WRITE:
case REQ_FLUSH:
case REQ_SYNC:
fs_m_out.RES_INPUT_BLOCKS = 0;
fs_m_out.RES_OUTPUT_BLOCKS = 0;
break;
default:
fs_m_out.RES_IO_BLOCKS = ENCODE_IO_BLOCKS(0, 0);
break;
}
if (OK != send(who, m_out)) /* send the message */ if (OK != send(who, m_out)) /* send the message */
printf("ISOFS(%d) was unable to send reply\n", SELF_E); printf("ISOFS(%d) was unable to send reply\n", SELF_E);
} }

View File

@ -20,6 +20,14 @@ static void sef_local_startup(void);
static int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
static void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/* IO event listener and variables */
typedef struct {
int in_blocks;
int out_blocks;
} mfs_io_event_listener_user_data;
static void mfs_io_event_listener(int rw_flag, dev_t dev, block_t block, void *user_data);
static mfs_io_event_listener_user_data io_event_count;
/*===========================================================================* /*===========================================================================*
* main * * main *
*===========================================================================*/ *===========================================================================*/
@ -34,12 +42,15 @@ int main(int argc, char *argv[])
/* SEF local startup. */ /* SEF local startup. */
env_setargs(argc, argv); env_setargs(argc, argv);
sef_local_startup(); sef_local_startup();
lmfs_set_io_event_listener(mfs_io_event_listener, &io_event_count);
while(!unmountdone || !exitsignaled) { while(!unmountdone || !exitsignaled) {
endpoint_t src; endpoint_t src;
/* Wait for request message. */ /* Wait for request message. */
get_work(&fs_m_in); get_work(&fs_m_in);
io_event_count.in_blocks = 0;
io_event_count.out_blocks = 0;
transid = TRNS_GET_ID(fs_m_in.m_type); transid = TRNS_GET_ID(fs_m_in.m_type);
fs_m_in.m_type = TRNS_DEL_ID(fs_m_in.m_type); fs_m_in.m_type = TRNS_DEL_ID(fs_m_in.m_type);
@ -176,6 +187,24 @@ static void reply(
message *m_out /* report result */ message *m_out /* report result */
) )
{ {
switch (fs_m_in.m_type) {
case REQ_BREAD:
case REQ_READ:
case REQ_BPEEK:
case REQ_PEEK:
case REQ_BWRITE:
case REQ_WRITE:
case REQ_FLUSH:
case REQ_SYNC:
fs_m_out.RES_INPUT_BLOCKS = io_event_count.in_blocks;
fs_m_out.RES_OUTPUT_BLOCKS = io_event_count.out_blocks;
break;
default:
fs_m_out.RES_IO_BLOCKS = ENCODE_IO_BLOCKS(
io_event_count.in_blocks,
io_event_count.out_blocks);
break;
}
if (OK != send(who, m_out)) /* send the message */ if (OK != send(who, m_out)) /* send the message */
printf("MFS(%d) was unable to send reply\n", SELF_E); printf("MFS(%d) was unable to send reply\n", SELF_E);
} }
@ -203,3 +232,10 @@ static void cch_check(void)
} }
#endif #endif
void mfs_io_event_listener(int rw_flag, dev_t dev, block_t block, void *user_data)
{
if (rw_flag == WRITING)
((mfs_io_event_listener_user_data *) user_data)->out_blocks++;
else
((mfs_io_event_listener_user_data *) user_data)->in_blocks++;
}

View File

@ -253,6 +253,10 @@ int pm_exec(endpoint_t proc_e, vir_bytes path, size_t path_len,
okendpt(proc_e, &slot); okendpt(proc_e, &slot);
rfp = fp = &fproc[slot]; rfp = fp = &fproc[slot];
rfp->text_size = 0;
rfp->data_size = 0;
rfp->in_blocks = 0;
rfp->out_blocks = 0;
lookup_init(&resolve, fullpath, PATH_NOFLAGS, &execi.vmp, &execi.vp); lookup_init(&resolve, fullpath, PATH_NOFLAGS, &execi.vmp, &execi.vp);
@ -409,6 +413,8 @@ int pm_exec(endpoint_t proc_e, vir_bytes path, size_t path_len,
/* Remember the new name of the process */ /* Remember the new name of the process */
strlcpy(rfp->fp_name, execi.args.progname, PROC_NAME_LEN); strlcpy(rfp->fp_name, execi.args.progname, PROC_NAME_LEN);
rfp->text_size = execi.args.text_size;
rfp->data_size = execi.args.data_size;
pm_execfinal: pm_execfinal:
if(newfilp) unlock_filp(newfilp); if(newfilp) unlock_filp(newfilp);

View File

@ -50,6 +50,11 @@ EXTERN struct fproc {
int fp_vp_rdlocks; /* number of read-only locks on vnodes */ int fp_vp_rdlocks; /* number of read-only locks on vnodes */
int fp_vmnt_rdlocks; /* number of read-only locks on vmnts */ int fp_vmnt_rdlocks; /* number of read-only locks on vmnts */
#endif #endif
vir_bytes text_size; /* text segment size of current process */
vir_bytes data_size; /* data segment size of current process */
u64_t in_blocks; /* block input operations */
u64_t out_blocks; /* block output operations */
} fproc[NR_PROCS]; } fproc[NR_PROCS];
/* fp_flags */ /* fp_flags */

View File

@ -60,6 +60,10 @@ int req_breadwrite(
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += m.RES_INPUT_BLOCKS;
fp->out_blocks += m.RES_OUTPUT_BLOCKS;
if (r != OK) return(r); if (r != OK) return(r);
/* Fill in response structure */ /* Fill in response structure */
@ -74,6 +78,7 @@ int req_breadwrite(
*===========================================================================*/ *===========================================================================*/
int req_bpeek(endpoint_t fs_e, dev_t dev, u64_t pos, unsigned int num_of_bytes) int req_bpeek(endpoint_t fs_e, dev_t dev, u64_t pos, unsigned int num_of_bytes)
{ {
int r = OK;
message m; message m;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
@ -86,9 +91,12 @@ int req_bpeek(endpoint_t fs_e, dev_t dev, u64_t pos, unsigned int num_of_bytes)
m.REQ_NBYTES = num_of_bytes; m.REQ_NBYTES = num_of_bytes;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
return(OK); fp->in_blocks += m.RES_INPUT_BLOCKS;
fp->out_blocks += m.RES_OUTPUT_BLOCKS;
return r;
} }
/*===========================================================================* /*===========================================================================*
@ -115,6 +123,9 @@ int req_chmod(
/* Copy back actual mode. */ /* Copy back actual mode. */
*new_modep = m.RES_MODE; *new_modep = m.RES_MODE;
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -145,6 +156,9 @@ int req_chown(
/* Return new mode to caller. */ /* Return new mode to caller. */
*new_modep = m.RES_MODE; *new_modep = m.RES_MODE;
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -187,6 +201,10 @@ int req_create(
/* Send/rec request */ /* Send/rec request */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
if (r != OK) return(r); if (r != OK) return(r);
/* Fill in response structure */ /* Fill in response structure */
@ -207,6 +225,7 @@ int req_create(
*===========================================================================*/ *===========================================================================*/
int req_flush(endpoint_t fs_e, dev_t dev) int req_flush(endpoint_t fs_e, dev_t dev)
{ {
int r;
message m; message m;
/* Fill in request message */ /* Fill in request message */
@ -214,7 +233,12 @@ int req_flush(endpoint_t fs_e, dev_t dev)
m.REQ_DEV = dev; m.REQ_DEV = dev;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += m.RES_INPUT_BLOCKS;
fp->out_blocks += m.RES_OUTPUT_BLOCKS;
return r;
} }
@ -240,6 +264,9 @@ int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf)
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -266,6 +293,9 @@ int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf)
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -275,6 +305,7 @@ int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf)
*===========================================================================*/ *===========================================================================*/
int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end) int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
{ {
int r;
message m; message m;
/* Fill in request message */ /* Fill in request message */
@ -286,7 +317,12 @@ int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
m.REQ_TRC_END_HI = 0; /* Not used for now, so clear it. */ m.REQ_TRC_END_HI = 0; /* Not used for now, so clear it. */
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return r;
} }
@ -329,6 +365,9 @@ int req_getdents(
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
if (r == OK) { if (r == OK) {
*new_pos = cvul64(m.RES_SEEK_POS_LO); *new_pos = cvul64(m.RES_SEEK_POS_LO);
r = m.RES_NBYTES; r = m.RES_NBYTES;
@ -342,6 +381,7 @@ int req_getdents(
*===========================================================================*/ *===========================================================================*/
int req_inhibread(endpoint_t fs_e, ino_t inode_nr) int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
{ {
int r;
message m; message m;
/* Fill in request message */ /* Fill in request message */
@ -349,7 +389,12 @@ int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
m.REQ_INODE_NR = inode_nr; m.REQ_INODE_NR = inode_nr;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return r;
} }
@ -383,6 +428,9 @@ int req_link(
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -459,6 +507,9 @@ int req_lookup(
/* Fill in response according to the return value */ /* Fill in response according to the return value */
res->fs_e = m.m_source; res->fs_e = m.m_source;
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
switch (r) { switch (r) {
case OK: case OK:
res->inode_nr = m.RES_INODE_NR; res->inode_nr = m.RES_INODE_NR;
@ -524,6 +575,9 @@ int req_mkdir(
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -565,6 +619,9 @@ int req_mknod(
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -574,6 +631,7 @@ int req_mknod(
*===========================================================================*/ *===========================================================================*/
int req_mountpoint(endpoint_t fs_e, ino_t inode_nr) int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
{ {
int r;
message m; message m;
/* Fill in request message */ /* Fill in request message */
@ -581,7 +639,12 @@ int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
m.REQ_INODE_NR = inode_nr; m.REQ_INODE_NR = inode_nr;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return r;
} }
@ -618,6 +681,9 @@ int req_newnode(
res->uid = m.RES_UID; res->uid = m.RES_UID;
res->gid = m.RES_GID; res->gid = m.RES_GID;
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -653,6 +719,9 @@ int req_newdriver(
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -665,6 +734,7 @@ int fs_e;
ino_t inode_nr; ino_t inode_nr;
int count; int count;
{ {
int r;
message m; message m;
/* Fill in request message */ /* Fill in request message */
@ -673,7 +743,12 @@ int count;
m.REQ_COUNT = count; m.REQ_COUNT = count;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return r;
} }
@ -710,6 +785,9 @@ int direct; /* set to 1 to use direct grants instead of magic grants */
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
if (r == OK) r = m.RES_NBYTES; if (r == OK) r = m.RES_NBYTES;
return(r); return(r);
@ -752,6 +830,9 @@ int req_readsuper(
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
if(r == OK) { if(r == OK) {
/* Fill in response structure */ /* Fill in response structure */
res_nodep->fs_e = m.m_source; res_nodep->fs_e = m.m_source;
@ -806,6 +887,9 @@ unsigned int *cum_iop;
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += m.RES_INPUT_BLOCKS;
fp->out_blocks += m.RES_OUTPUT_BLOCKS;
if (r == OK) { if (r == OK) {
/* Fill in response structure */ /* Fill in response structure */
*new_posp = cvul64(m.RES_SEEK_POS_LO); *new_posp = cvul64(m.RES_SEEK_POS_LO);
@ -820,6 +904,7 @@ unsigned int *cum_iop;
*===========================================================================*/ *===========================================================================*/
int req_peek(endpoint_t fs_e, ino_t inode_nr, u64_t pos, unsigned int bytes) int req_peek(endpoint_t fs_e, ino_t inode_nr, u64_t pos, unsigned int bytes)
{ {
int r = OK;
message m; message m;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
@ -836,7 +921,12 @@ int req_peek(endpoint_t fs_e, ino_t inode_nr, u64_t pos, unsigned int bytes)
m.REQ_NBYTES = bytes; m.REQ_NBYTES = bytes;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += m.RES_INPUT_BLOCKS;
fp->out_blocks += m.RES_OUTPUT_BLOCKS;
return r;
} }
/*===========================================================================* /*===========================================================================*
@ -878,6 +968,9 @@ char *new_name;
cpf_revoke(gid_old); cpf_revoke(gid_old);
cpf_revoke(gid_new); cpf_revoke(gid_new);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -910,6 +1003,9 @@ char *lastc;
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -959,6 +1055,9 @@ int req_slink(
cpf_revoke(gid_name); cpf_revoke(gid_name);
cpf_revoke(gid_buf); cpf_revoke(gid_buf);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -987,6 +1086,9 @@ int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf)
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -997,13 +1099,19 @@ int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf)
int req_sync(fs_e) int req_sync(fs_e)
endpoint_t fs_e; endpoint_t fs_e;
{ {
int r;
message m; message m;
/* Fill in request message */ /* Fill in request message */
m.m_type = REQ_SYNC; m.m_type = REQ_SYNC;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += m.RES_INPUT_BLOCKS;
fp->out_blocks += m.RES_OUTPUT_BLOCKS;
return r;
} }
@ -1035,6 +1143,9 @@ char *lastc;
r = fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
cpf_revoke(grant_id); cpf_revoke(grant_id);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return(r); return(r);
} }
@ -1045,13 +1156,19 @@ char *lastc;
int req_unmount(fs_e) int req_unmount(fs_e)
endpoint_t fs_e; endpoint_t fs_e;
{ {
int r;
message m; message m;
/* Fill in request message */ /* Fill in request message */
m.m_type = REQ_UNMOUNT; m.m_type = REQ_UNMOUNT;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return r;
} }
@ -1061,6 +1178,7 @@ endpoint_t fs_e;
int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actimespec, int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actimespec,
struct timespec * modtimespec) struct timespec * modtimespec)
{ {
int r;
message m; message m;
assert(actimespec != NULL); assert(actimespec != NULL);
@ -1075,5 +1193,10 @@ int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actimespec,
m.REQ_MODNSEC = modtimespec->tv_nsec; m.REQ_MODNSEC = modtimespec->tv_nsec;
/* Send/rec request */ /* Send/rec request */
return fs_sendrec(fs_e, &m); r = fs_sendrec(fs_e, &m);
fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS);
fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS);
return r;
} }