[sheepdog] [PATCH 3/6] sheep, sockfd cache: cache more than one FD for each node

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Jun 25 08:39:27 CEST 2012


At Mon, 25 Jun 2012 13:56:42 +0800,
Liu Yuan wrote:
> 
> On 06/25/2012 01:42 PM, MORITA Kazutaka wrote:
> > At Sun, 24 Jun 2012 20:51:50 +0800,
> > Liu Yuan wrote:
> >>
> >> From: Liu Yuan <tailai.ly at taobao.com>
> >>
> >> This is inspired by the observation that each Guest can issue as much
> >> as 4 requests in one go.
> > 
> > Is it true for any kind of guest OSes?
> > 
> 
> Dunno others, but current Linux virtio_blk driver can only issue as much
> as 4 requests in one go. IDE driver is less than 4 I think. From the
> driver perspective, it seems that only scsi driver can issue more than 4
> requests in one go, but QEMU support to emulate scsi disk ?
> 
> Anyway, this is just a hint. Suppose request size from guest is 512k,
> then 4M / 512k = 8, so at most 8 request can be issued to one sheep
> object. So I think 8 is enough.

Why do you assume the request size is 512k?  Maybe I'm missing
something, and I'm fine with it if 8 is not too small.

> > 
> >> @@ -42,9 +56,10 @@ static struct sockfd_cache sockfd_cache = {
> >>  
> >>  struct sockfd_cache_entry {
> >>  	struct rb_node rb;
> >> -	int fd;
> >> -	uint8_t refcount;
> >>  	struct node_id nid;
> >> +#define SOCKFD_CACHE_MAX_FD	8 /* How many FDs we cache for one node */
> >> +	int fd[SOCKFD_CACHE_MAX_FD];
> >> +	uint8_t fd_in_use[SOCKFD_CACHE_MAX_FD];
> >>  };
> > 
> > SOCKFD_CACHE_MAX_FD should be 12 because the default redundancy level
> > is 3?
> > 
> 
> why? I think FD number has nothing to do with redundancy, instead it is
> affected by how many requests Guest can issue in one go.

Ah, yes.  I misunderstood your code, sorry.

Thanks,

Kazutaka



More information about the sheepdog mailing list