Message ID | 1452020761-24457-10-git-send-email-wei.liu2@citrix.com |
---|---|
State | New |
Headers | show |
Wei Liu <wei.liu2@citrix.com> writes: > Some structures virtio-9p.h have been unused since 2011 when relevant > functions switched to use coroutines. > > The declaration of pdu_packunpack and function do_pdu_unpack are > useless. > > The function virtio_9p_set_fd_limit is unused. > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- > hw/9pfs/virtio-9p.c | 11 --------- > hw/9pfs/virtio-9p.h | 68 ----------------------------------------------------- > 2 files changed, 79 deletions(-) > > diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c > index 30ff828..084fa6a 100644 > --- a/hw/9pfs/virtio-9p.c > +++ b/hw/9pfs/virtio-9p.c > @@ -3287,14 +3287,3 @@ void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) > } > free_pdu(s, pdu); > } > - > -static void __attribute__((__constructor__)) virtio_9p_set_fd_limit(void) > -{ > - struct rlimit rlim; > - if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { > - fprintf(stderr, "Failed to get the resource limit\n"); > - exit(1); > - } > - open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur/3); > - open_fd_rc = rlim.rlim_cur/2; > -} I am looking at when we stopped using that. We still do file descriptor reclaim. If we do that we need to set the open_fd_hw/rc. > diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h > index ac4cb00..3c78d3c 100644 > --- a/hw/9pfs/virtio-9p.h > +++ b/hw/9pfs/virtio-9p.h > @@ -227,65 +227,6 @@ typedef struct V9fsState > V9fsConf fsconf; >2.1.4 -aneesh
On 07/01/2016 17:41, Aneesh Kumar K.V wrote: >> > The function virtio_9p_set_fd_limit is unused. It's not, it's called at startup by libc. Paolo >> > Signed-off-by: Wei Liu <wei.liu2@citrix.com> >> > --- >> > hw/9pfs/virtio-9p.c | 11 --------- >> > hw/9pfs/virtio-9p.h | 68 ----------------------------------------------------- >> > 2 files changed, 79 deletions(-) >> > >> > diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c >> > index 30ff828..084fa6a 100644 >> > --- a/hw/9pfs/virtio-9p.c >> > +++ b/hw/9pfs/virtio-9p.c >> > @@ -3287,14 +3287,3 @@ void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) >> > } >> > free_pdu(s, pdu); >> > } >> > - >> > -static void __attribute__((__constructor__)) virtio_9p_set_fd_limit(void) >> > -{ >> > - struct rlimit rlim; >> > - if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { >> > - fprintf(stderr, "Failed to get the resource limit\n"); >> > - exit(1); >> > - } >> > - open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur/3); >> > - open_fd_rc = rlim.rlim_cur/2; >> > -} > I am looking at when we stopped using that. We still do file descriptor > reclaim. If we do that we need to set the open_fd_hw/rc. > > >
On Thu, 07 Jan 2016 22:11:11 +0530 "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote: > Wei Liu <wei.liu2@citrix.com> writes: > > > Some structures virtio-9p.h have been unused since 2011 when relevant > > functions switched to use coroutines. > > > > The declaration of pdu_packunpack and function do_pdu_unpack are > > useless. > > > > The function virtio_9p_set_fd_limit is unused. > > > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > > --- > > hw/9pfs/virtio-9p.c | 11 --------- > > hw/9pfs/virtio-9p.h | 68 ----------------------------------------------------- > > 2 files changed, 79 deletions(-) > > > > diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c > > index 30ff828..084fa6a 100644 > > --- a/hw/9pfs/virtio-9p.c > > +++ b/hw/9pfs/virtio-9p.c > > @@ -3287,14 +3287,3 @@ void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) > > } > > free_pdu(s, pdu); > > } > > - > > -static void __attribute__((__constructor__)) virtio_9p_set_fd_limit(void) > > -{ > > - struct rlimit rlim; > > - if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { > > - fprintf(stderr, "Failed to get the resource limit\n"); > > - exit(1); > > - } > > - open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur/3); > > - open_fd_rc = rlim.rlim_cur/2; > > -} > > I am looking at when we stopped using that. We still do file descriptor > reclaim. If we do that we need to set the open_fd_hw/rc. > Indeed this function has no explicit caller but it is not dead code. We must keep it. Wei, no need to repost, I'll fix this in my tree. > > > > diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h > > index ac4cb00..3c78d3c 100644 > > --- a/hw/9pfs/virtio-9p.h > > +++ b/hw/9pfs/virtio-9p.h > > @@ -227,65 +227,6 @@ typedef struct V9fsState > > V9fsConf fsconf; > >2.1.4 > > -aneesh Thanks Aneesh ! -- Greg
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index 30ff828..084fa6a 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -3287,14 +3287,3 @@ void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) } free_pdu(s, pdu); } - -static void __attribute__((__constructor__)) virtio_9p_set_fd_limit(void) -{ - struct rlimit rlim; - if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { - fprintf(stderr, "Failed to get the resource limit\n"); - exit(1); - } - open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur/3); - open_fd_rc = rlim.rlim_cur/2; -} diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h index ac4cb00..3c78d3c 100644 --- a/hw/9pfs/virtio-9p.h +++ b/hw/9pfs/virtio-9p.h @@ -227,65 +227,6 @@ typedef struct V9fsState V9fsConf fsconf; } V9fsState; -typedef struct V9fsStatState { - V9fsPDU *pdu; - size_t offset; - V9fsStat v9stat; - V9fsFidState *fidp; - struct stat stbuf; -} V9fsStatState; - -typedef struct V9fsOpenState { - V9fsPDU *pdu; - size_t offset; - int32_t mode; - V9fsFidState *fidp; - V9fsQID qid; - struct stat stbuf; - int iounit; -} V9fsOpenState; - -typedef struct V9fsReadState { - V9fsPDU *pdu; - size_t offset; - int32_t count; - int32_t total; - int64_t off; - V9fsFidState *fidp; - struct iovec iov[128]; /* FIXME: bad, bad, bad */ - struct iovec *sg; - off_t dir_pos; - struct dirent *dent; - struct stat stbuf; - V9fsString name; - V9fsStat v9stat; - int32_t len; - int32_t cnt; - int32_t max_count; -} V9fsReadState; - -typedef struct V9fsWriteState { - V9fsPDU *pdu; - size_t offset; - int32_t len; - int32_t count; - int32_t total; - int64_t off; - V9fsFidState *fidp; - struct iovec iov[128]; /* FIXME: bad, bad, bad */ - struct iovec *sg; - int cnt; -} V9fsWriteState; - -typedef struct V9fsMkState { - V9fsPDU *pdu; - size_t offset; - V9fsQID qid; - struct stat stbuf; - V9fsString name; - V9fsString fullname; -} V9fsMkState; - /* 9p2000.L open flags */ #define P9_DOTL_RDONLY 00000000 #define P9_DOTL_WRONLY 00000001 @@ -345,15 +286,6 @@ typedef struct V9fsGetlock extern int open_fd_hw; extern int total_open_fd; -size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count, - size_t offset, size_t size, int pack); - -static inline size_t do_pdu_unpack(void *dst, struct iovec *sg, int sg_count, - size_t offset, size_t size) -{ - return pdu_packunpack(dst, sg, sg_count, offset, size, 0); -} - static inline void v9fs_path_write_lock(V9fsState *s) { if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) {
Some structures virtio-9p.h have been unused since 2011 when relevant functions switched to use coroutines. The declaration of pdu_packunpack and function do_pdu_unpack are useless. The function virtio_9p_set_fd_limit is unused. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- hw/9pfs/virtio-9p.c | 11 --------- hw/9pfs/virtio-9p.h | 68 ----------------------------------------------------- 2 files changed, 79 deletions(-)