ia64/xen-unstable
changeset 529:4e67516e7fa8
bitkeeper revision 1.289.2.2 (3f0a897bGzUUM0kzMiUA41zn4irydw)
Find domains using find_domain_by_id rather than by looping over
the task list.
Find domains using find_domain_by_id rather than by looping over
the task list.
author | sos22@labyrinth.cl.cam.ac.uk |
---|---|
date | Tue Jul 08 09:06:03 2003 +0000 (2003-07-08) |
parents | b912fe2f29ba |
children | 35727deb8b0a |
files | xen/drivers/block/xen_physdisk.c xen/drivers/block/xen_segment.c |
line diff
1.1 --- a/xen/drivers/block/xen_physdisk.c Tue Jul 08 08:51:01 2003 +0000 1.2 +++ b/xen/drivers/block/xen_physdisk.c Tue Jul 08 09:06:03 2003 +0000 1.3 @@ -188,10 +188,8 @@ int xen_physdisk_grant(xp_disk_t *xpd_in 1.4 DPRINTK("Have current.\n"); 1.5 DPRINTK("Target domain %x\n", xpd->domain); 1.6 1.7 - do { 1.8 - p = p->next_task; 1.9 - } while (p != current && p->domain != xpd->domain); 1.10 - if (p->domain != xpd->domain) { 1.11 + p = find_domain_by_id(xpd->domain); 1.12 + if (p == NULL) { 1.13 DPRINTK("Bad domain!\n"); 1.14 res = 1; 1.15 goto out; 1.16 @@ -203,6 +201,7 @@ int xen_physdisk_grant(xp_disk_t *xpd_in 1.17 xpd->mode, 1.18 p); 1.19 spin_unlock(&p->physdev_lock); 1.20 + put_task_struct(p); 1.21 1.22 out: 1.23 unmap_domain_mem(xpd); 1.24 @@ -216,16 +215,14 @@ int xen_physdisk_probe(struct task_struc 1.25 physdisk_probebuf_t *buf = map_domain_mem(virt_to_phys(buf_in)); 1.26 int res; 1.27 1.28 - p = current; 1.29 - do { 1.30 - p = p->next_task; 1.31 - } while (p != current && p->domain != buf->domain); 1.32 - if (p->domain != buf->domain) { 1.33 + if (requesting_domain->domain != 0 && 1.34 + requesting_domain->domain != buf->domain) { 1.35 res = 1; 1.36 goto out; 1.37 } 1.38 - if (requesting_domain->domain != 0 && 1.39 - requesting_domain->domain != buf->domain) { 1.40 + 1.41 + p = find_domain_by_id(buf->domain); 1.42 + if (p == NULL) { 1.43 res = 1; 1.44 goto out; 1.45 } 1.46 @@ -233,6 +230,8 @@ int xen_physdisk_probe(struct task_struc 1.47 spin_lock(&p->physdev_lock); 1.48 xen_physdisk_probe_access(buf, p); 1.49 spin_unlock(&p->physdev_lock); 1.50 + put_task_struct(p); 1.51 + 1.52 res = 0; 1.53 out: 1.54 unmap_domain_mem(buf);
2.1 --- a/xen/drivers/block/xen_segment.c Tue Jul 08 08:51:01 2003 +0000 2.2 +++ b/xen/drivers/block/xen_segment.c Tue Jul 08 09:06:03 2003 +0000 2.3 @@ -250,15 +250,11 @@ int xen_segment_create(xv_disk_t *xvd_in 2.4 } 2.5 2.6 /* if the domain exists, assign the segment to the domain */ 2.7 - p = current; 2.8 - do 2.9 - { 2.10 - p = p->next_task; 2.11 - } while (p != current && p->domain != xvd->domain); 2.12 - 2.13 - if (p->domain == xvd->domain) 2.14 + p = find_domain_by_id(xvd->domain); 2.15 + if (p != NULL) 2.16 { 2.17 p->segment_list[xvd->segment] = &xsegments[idx]; 2.18 + put_task_struct(p); 2.19 } 2.20 2.21 unmap_domain_mem(xvd);