Store and use max concurrent requests

This commit is contained in:
Thomas Veerman 2011-08-22 16:24:29 +00:00
parent 12d9a08f0d
commit 30be017762
3 changed files with 14 additions and 9 deletions

View File

@ -172,7 +172,7 @@ int rdonly,
char mount_label[LABEL_MAX] ) char mount_label[LABEL_MAX] )
{ {
int rdir, mdir; /* TRUE iff {root|mount} file is dir */ int rdir, mdir; /* TRUE iff {root|mount} file is dir */
int i, r = OK, found, isroot, mount_root; int i, r = OK, found, isroot, mount_root, con_reqs;
struct fproc *tfp; struct fproc *tfp;
struct dmap *dp; struct dmap *dp;
struct vnode *root_node, *vp = NULL, *bspec; struct vnode *root_node, *vp = NULL, *bspec;
@ -260,10 +260,8 @@ char mount_label[LABEL_MAX] )
else new_vmp->m_flags &= ~VMNT_READONLY; else new_vmp->m_flags &= ~VMNT_READONLY;
/* Tell FS which device to mount */ /* Tell FS which device to mount */
if (verbose) r = req_readsuper(fs_e, label, dev, rdonly, isroot, &res, &con_reqs);
printf("Tell FS %d to mount device %s %d\n", fs_e, label, dev); if (r != OK) {
if ((r = req_readsuper(fs_e, label, dev, rdonly, isroot, &res)) != OK) {
if (verbose) printf("Failed: %d\n", r);
if (vp != NULL) { if (vp != NULL) {
unlock_vnode(vp); unlock_vnode(vp);
put_vnode(vp); put_vnode(vp);
@ -274,7 +272,6 @@ char mount_label[LABEL_MAX] )
unlock_vmnt(new_vmp); unlock_vmnt(new_vmp);
return(r); return(r);
} }
if (verbose) printf("Ok done: r=%d\n", r);
/* Fill in root node's fields */ /* Fill in root node's fields */
root_node->v_fs_e = res.fs_e; root_node->v_fs_e = res.fs_e;
@ -290,6 +287,11 @@ char mount_label[LABEL_MAX] )
/* Root node is indeed on the partition */ /* Root node is indeed on the partition */
root_node->v_vmnt = new_vmp; root_node->v_vmnt = new_vmp;
root_node->v_dev = new_vmp->m_dev; root_node->v_dev = new_vmp->m_dev;
if (con_reqs == 0)
new_vmp->m_comm.c_max_reqs = 1; /* Default if FS doesn't tell us */
else
new_vmp->m_comm.c_max_reqs = con_reqs;
new_vmp->m_comm.c_cur_reqs = 0;
lock_bsf(); lock_bsf();
@ -454,7 +456,7 @@ PUBLIC int unmount(
if (is_vnode_locked(vp)) locks++; if (is_vnode_locked(vp)) locks++;
} }
if (count > 1 || locks > 1) { if (count > 1 || locks > 1 || tll_haspendinglock(&vmp->m_lock)) {
unlock_vmnt(vmp); unlock_vmnt(vmp);
return(EBUSY); /* can't umount a busy file system */ return(EBUSY); /* can't umount a busy file system */
} }

View File

@ -252,7 +252,8 @@ _PROTOTYPE( int req_rdlink, (endpoint_t fs_e, ino_t inode_nr,
int direct) ); int direct) );
_PROTOTYPE( int req_readsuper, (endpoint_t fs_e, char *driver_name, _PROTOTYPE( int req_readsuper, (endpoint_t fs_e, char *driver_name,
dev_t dev, int readonly, int isroot, dev_t dev, int readonly, int isroot,
struct node_details *res_nodep) ); struct node_details *res_nodep,
int *con_reqs) );
_PROTOTYPE( int req_readwrite, (endpoint_t fs_e, ino_t inode_nr, _PROTOTYPE( int req_readwrite, (endpoint_t fs_e, ino_t inode_nr,
u64_t pos, int rw_flag, u64_t pos, int rw_flag,
endpoint_t user_e, char *user_addr, endpoint_t user_e, char *user_addr,

View File

@ -707,7 +707,8 @@ PUBLIC int req_readsuper(
dev_t dev, dev_t dev,
int readonly, int readonly,
int isroot, int isroot,
struct node_details *res_nodep struct node_details *res_nodep,
int *con_reqs
) )
{ {
int r; int r;
@ -741,6 +742,7 @@ PUBLIC int req_readsuper(
res_nodep->fsize = m.RES_FILE_SIZE_LO; res_nodep->fsize = m.RES_FILE_SIZE_LO;
res_nodep->uid = m.RES_UID; res_nodep->uid = m.RES_UID;
res_nodep->gid = m.RES_GID; res_nodep->gid = m.RES_GID;
*con_reqs = m.RES_CONREQS;
} }
return(r); return(r);