diff --git a/include/minix/libminixfs.h b/include/minix/libminixfs.h index cece2c2f3..21408cfa8 100644 --- a/include/minix/libminixfs.h +++ b/include/minix/libminixfs.h @@ -63,6 +63,10 @@ void lmfs_blockschange(dev_t dev, int delta); void fs_blockstats(u32_t *blocks, u32_t *free, u32_t *used); 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 */ #define NORMAL 0 /* forces get_block to do disk read */ #define NO_READ 1 /* prevents get_block from doing disk read */ diff --git a/include/minix/vfsif.h b/include/minix/vfsif.h index 10a8568f4..ebaa7e0f5 100644 --- a/include/minix/vfsif.h +++ b/include/minix/vfsif.h @@ -55,6 +55,49 @@ #define RES_SYMLOOP m9_s3 #define RES_UID m9_s4 #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 */ #define REQ_RDONLY 001 @@ -127,6 +170,10 @@ typedef struct { #define TRNS_ADD_ID(t,id) (((t) << 16) | ((id) & 0xFFFF)) #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_REQ_CHECK_PERMS (PFS_BASE + 1) diff --git a/lib/libminixfs/cache.c b/lib/libminixfs/cache.c index adb482d99..59dfbdd02 100644 --- a/lib/libminixfs/cache.c +++ b/lib/libminixfs/cache.c @@ -44,6 +44,9 @@ static int rdwt_err; static int quiet = 0; +static lmfs_io_event_listener io_event_listener = NULL; +static void *io_event_listener_user_data = NULL; + void lmfs_setquiet(int q) { quiet = q; } @@ -544,7 +547,8 @@ register struct buf *bp; /* buffer pointer */ /* Report read errors to interested parties. */ 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); } r -= fs_block_size; + if (io_event_listener) + io_event_listener(rw_flag, dev, bp->lmfs_blocknr, io_event_listener_user_data); } bufq += nblocks; bufqsize -= nblocks; @@ -928,3 +934,9 @@ int lmfs_do_bpeek(message *m) 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; +} diff --git a/lib/libsffs/main.c b/lib/libsffs/main.c index b45b7847e..ff9406704 100644 --- a/lib/libsffs/main.c +++ b/lib/libsffs/main.c @@ -94,6 +94,23 @@ int transid; */ 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; if (IS_VFS_FS_TRANSID(transid)) { /* If a transaction ID was set, reset it */ diff --git a/lib/libvtreefs/vtreefs.c b/lib/libvtreefs/vtreefs.c index 1c69e0868..a6a08dc23 100644 --- a/lib/libvtreefs/vtreefs.c +++ b/lib/libvtreefs/vtreefs.c @@ -129,6 +129,23 @@ static void send_reply(int err, int transid) */ 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; if (IS_VFS_FS_TRANSID(transid)) { fs_m_out.m_type = TRNS_ADD_ID(fs_m_out.m_type, transid); diff --git a/servers/ext2/main.c b/servers/ext2/main.c index fc8b26503..3afe7fef3 100644 --- a/servers/ext2/main.c +++ b/servers/ext2/main.c @@ -21,6 +21,14 @@ static void sef_local_startup(void); static int sef_cb_init_fresh(int type, sef_init_info_t *info); 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 char **env_argv; @@ -61,6 +69,8 @@ int main(int argc, char *argv[]) /* Wait for request message. */ 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); 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 */ ) { + 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 */ 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++; +} diff --git a/servers/iso9660fs/main.c b/servers/iso9660fs/main.c index 8fae36a66..1073368e8 100644 --- a/servers/iso9660fs/main.c +++ b/servers/iso9660fs/main.c @@ -144,6 +144,23 @@ void reply(who, m_out) int who; 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 */ printf("ISOFS(%d) was unable to send reply\n", SELF_E); } diff --git a/servers/mfs/main.c b/servers/mfs/main.c index 039953fb9..c256a126b 100644 --- a/servers/mfs/main.c +++ b/servers/mfs/main.c @@ -20,6 +20,14 @@ static void sef_local_startup(void); static int sef_cb_init_fresh(int type, sef_init_info_t *info); 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 * *===========================================================================*/ @@ -34,12 +42,15 @@ int main(int argc, char *argv[]) /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); + lmfs_set_io_event_listener(mfs_io_event_listener, &io_event_count); while(!unmountdone || !exitsignaled) { endpoint_t src; /* Wait for request message. */ 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); 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 */ ) { + 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 */ printf("MFS(%d) was unable to send reply\n", SELF_E); } @@ -203,3 +232,10 @@ static void cch_check(void) } #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++; +} diff --git a/servers/vfs/exec.c b/servers/vfs/exec.c index 9e9b6d096..df84ef73b 100644 --- a/servers/vfs/exec.c +++ b/servers/vfs/exec.c @@ -253,6 +253,10 @@ int pm_exec(endpoint_t proc_e, vir_bytes path, size_t path_len, okendpt(proc_e, &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); @@ -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 */ 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: if(newfilp) unlock_filp(newfilp); diff --git a/servers/vfs/fproc.h b/servers/vfs/fproc.h index 9ef7acbd0..82351602a 100644 --- a/servers/vfs/fproc.h +++ b/servers/vfs/fproc.h @@ -50,6 +50,11 @@ EXTERN struct fproc { int fp_vp_rdlocks; /* number of read-only locks on vnodes */ int fp_vmnt_rdlocks; /* number of read-only locks on vmnts */ #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]; /* fp_flags */ diff --git a/servers/vfs/request.c b/servers/vfs/request.c index d1cd0b02e..93280a32a 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -60,6 +60,10 @@ int req_breadwrite( /* Send/rec request */ r = fs_sendrec(fs_e, &m); cpf_revoke(grant_id); + + fp->in_blocks += m.RES_INPUT_BLOCKS; + fp->out_blocks += m.RES_OUTPUT_BLOCKS; + if (r != OK) return(r); /* 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 r = OK; message 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; /* 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. */ *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); } @@ -145,6 +156,9 @@ int req_chown( /* Return new mode to caller. */ *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); } @@ -187,6 +201,10 @@ int req_create( /* Send/rec request */ r = fs_sendrec(fs_e, &m); 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); /* Fill in response structure */ @@ -207,6 +225,7 @@ int req_create( *===========================================================================*/ int req_flush(endpoint_t fs_e, dev_t dev) { + int r; message m; /* Fill in request message */ @@ -214,7 +233,12 @@ int req_flush(endpoint_t fs_e, dev_t dev) m.REQ_DEV = dev; /* 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); 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); } @@ -266,6 +293,9 @@ int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf) r = fs_sendrec(fs_e, &m); 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); } @@ -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 r; message m; /* 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. */ /* 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); 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) { *new_pos = cvul64(m.RES_SEEK_POS_LO); r = m.RES_NBYTES; @@ -342,6 +381,7 @@ int req_getdents( *===========================================================================*/ int req_inhibread(endpoint_t fs_e, ino_t inode_nr) { + int r; message m; /* 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; /* 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); 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); } @@ -459,6 +507,9 @@ int req_lookup( /* Fill in response according to the return value */ 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) { case OK: res->inode_nr = m.RES_INODE_NR; @@ -524,6 +575,9 @@ int req_mkdir( r = fs_sendrec(fs_e, &m); 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); } @@ -565,6 +619,9 @@ int req_mknod( r = fs_sendrec(fs_e, &m); 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); } @@ -574,6 +631,7 @@ int req_mknod( *===========================================================================*/ int req_mountpoint(endpoint_t fs_e, ino_t inode_nr) { + int r; message m; /* 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; /* 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->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); } @@ -653,6 +719,9 @@ int req_newdriver( 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); } @@ -665,6 +734,7 @@ int fs_e; ino_t inode_nr; int count; { + int r; message m; /* Fill in request message */ @@ -673,7 +743,12 @@ int count; m.REQ_COUNT = count; /* 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); 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; return(r); @@ -752,6 +830,9 @@ int req_readsuper( r = fs_sendrec(fs_e, &m); 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) { /* Fill in response structure */ res_nodep->fs_e = m.m_source; @@ -806,6 +887,9 @@ unsigned int *cum_iop; r = fs_sendrec(fs_e, &m); cpf_revoke(grant_id); + fp->in_blocks += m.RES_INPUT_BLOCKS; + fp->out_blocks += m.RES_OUTPUT_BLOCKS; + if (r == OK) { /* Fill in response structure */ *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 r = OK; message 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; /* 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_new); + fp->in_blocks += IO_IN_BLOCKS(m.RES_IO_BLOCKS); + fp->out_blocks += IO_OUT_BLOCKS(m.RES_IO_BLOCKS); + return(r); } @@ -910,6 +1003,9 @@ char *lastc; r = fs_sendrec(fs_e, &m); 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); } @@ -959,6 +1055,9 @@ int req_slink( cpf_revoke(gid_name); 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); } @@ -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); 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); } @@ -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) endpoint_t fs_e; { + int r; message m; /* Fill in request message */ m.m_type = REQ_SYNC; /* 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); 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); } @@ -1045,13 +1156,19 @@ char *lastc; int req_unmount(fs_e) endpoint_t fs_e; { + int r; message m; /* Fill in request message */ m.m_type = REQ_UNMOUNT; /* 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, struct timespec * modtimespec) { + int r; message m; 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; /* 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; }