hw/9pfs: Drop unused print_sg helper
PATCH 1/1 hw/9pfs: Drop unused print_sg helper
Remove the print_sg() debug helper and its always-disabled call sites in v9fs_read() and v9fs_write(). The function was only reachable via if (0) blocks, so it has been dead code for a long time.
--- hw/9pfs/9p.c | 20 -------------------- 1 file changed, 20 deletions(-)
hw/9pfs/9p.c +0 -20
@@ -1389,20 +1389,6 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf,return stat_to_qid (pdu, stbuf, &v9lstat->qid); } -static void print_sg (struct iovec *sg,int cnt) -{ -int i; - -printf ("sg[%d]: {" , cnt); -for (i =0 ; i < cnt; i++) { -if (i) { -printf (", " ); - } -printf ("(%p, %zd)" , sg[i].iov_base, sg[i].iov_len); - } -printf ("}\n" ); -} -/* Will call this only for path name based fid */ static void v9fs_fix_path (V9fsPath *dst,V9fsPath *src,int len) {
@@ -2468,9 +2454,6 @@ static void coroutine_fn v9fs_read(void *opaque) do { qemu_iovec_reset(&qiov); qemu_iovec_concat(&qiov, &qiov_full, count, qiov_full.size - count); - if (0) { - print_sg(qiov.iov, qiov.niov); - } /* Loop in case of EINTR */ do { len = v9fs_co_preadv(pdu, fidp, qiov.iov, qiov.niov, off);
@@ -2785,9 +2768,6 @@ static void coroutine_fn v9fs_write(void *opaque) do { qemu_iovec_reset(&qiov); qemu_iovec_concat(&qiov, &qiov_full, total, qiov_full.size - total); - if (0) { - print_sg(qiov.iov, qiov.niov); - } /* Loop in case of EINTR */ do { len = v9fs_co_pwritev(pdu, fidp, qiov.iov, qiov.niov, off);
Signature · 1 line
2.43.0
Hi Osama,
Quoted 35 lines · Osama Abdelkader
Remove the
print_sg()debug helper and its always-disabled call sites inv9fs_read()andv9fs_write(). The function was only reachable via if (0) blocks, so it has been dead code for a long time.Signed-off-by Osama Abdelkader <[email protected]>--- hw/9pfs/9p.c | 20 -------------------- 1 file changed, 20 deletions(-)hw/9pfs/9p.c +0
-14@@ -1389,20 +1389,6 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf,return stat_to_qid (pdu, stbuf, &v9lstat->qid); } -static void print_sg (struct iovec *sg,int cnt) -{ -int i; - -printf ("sg[%d]: {" , cnt); -for (i =0 ; i < cnt; i++) { -if (i) { -printf (", " ); - } -printf ("(%p, %zd)" , sg[i].iov_base, sg[i].iov_len); - } -printf ("}\n" ); -} -/* Will call this only for path name based fid */ static void v9fs_fix_path (V9fsPath *dst,V9fsPath *src,int len) {
hw/9pfs/9p.c static void coroutine_fn v9fs_read(void *opaque) · line 2472
Quoted 5 lines
hw/9pfs/9p.c +0
-2@@ -2468,9 +2454,6 @@ static void coroutine_fn v9fs_read(void *opaque) do { qemu_iovec_reset(&qiov); qemu_iovec_concat(&qiov, &qiov_full, count, qiov_full.size - count); - if (0) { - print_sg(qiov.iov, qiov.niov);
Alternatively, consider converting to trace event so we can keep dumping the entries, but select that at runtime (see for conversion example commit 4847c5701a3 "hw/rtc/mc146818rtc: Convert CMOS_DPRINTF into trace events").
hw/9pfs/9p.c static void coroutine_fn v9fs_read(void *opaque) · line 2473
Quoted 1 line
hw/9pfs/9p.c +0
-1- }
Regards,
Phil.
Quoted 9 lines · CET Philippe Mathieu-Daudé
Hi Osama,
Quoted 6 lines · Osama Abdelkader
Remove the
print_sg()debug helper and its always-disabled call sites inv9fs_read()andv9fs_write(). The function was only reachable via if (0) blocks, so it has been dead code for a long time.Signed-off-by Osama Abdelkader <[email protected]>---
TBH low care level for this on my side. It's just passive debug code and the suggested change does not change anything on the resulting binary.
It's not that this debug code is not used at all, but very seldom. Last time I personally used it was like 3 years ago.
Quoted 41 lines
Quoted 41 lines
hw/9pfs/9p.c | 20 -------------------- 1 file changed, 20 deletions(-)hw/9pfs/9p.c +0
-0@@ -1389,20 +1389,6 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, conststruct stat *stbuf,>
return stat_to_qid(pdu, stbuf, &v9lstat->qid);}hw/9pfs/9p.c +0
-14-static void print_sg (struct iovec *sg,int cnt) -{ -int i; - -printf ("sg[%d]: {" , cnt); -for (i =0 ; i < cnt; i++) { -if (i) { -printf (", " ); - } -printf ("(%p, %zd)" , sg[i].iov_base, sg[i].iov_len); - } -printf ("}\n" ); -} -/* Will call this only for path name based fid */ static void v9fs_fix_path (V9fsPath *dst,V9fsPath *src,int len) {@@ -2468,9 +2454,6 @@ static void coroutine_fn v9fs_read(void *opaque) do { qemu_iovec_reset(&qiov); qemu_iovec_concat(&qiov, &qiov_full, count, qiov_full.size - count);
Quoted 7 lines
hw/9pfs/9p.c static void coroutine_fn v9fs_read(void *opaque) · line 2475
Quoted 2 lines
hw/9pfs/9p.c +0
-2-if (0 ) { -print_sg (qiov.iov, qiov.niov);Alternatively, consider converting to trace event so we can keep dumping the entries, but select that at runtime (see for conversion example commit
4847c5701a3"hw/rtc/mc146818rtc: ConvertCMOS_DPRINTFinto trace events").
Probably overkill. We have a bunch of trace events where it makes, especially for investigating issues on 9p protocol level. But this debug code is usually just enabled if you are working on a virtio transport issue or new virtio feature and then you are usually working on this source code already.
But again: no strong opinion about this overall issue whatsoever.
/Christian
Quoted 66 lines · Christian Schoenebeck
Quoted 9 lines · CET Philippe Mathieu-Daudé
Hi Osama,
Quoted 6 lines · Osama Abdelkader
Remove the
print_sg()debug helper and its always-disabled call sites inv9fs_read()andv9fs_write(). The function was only reachable via if (0) blocks, so it has been dead code for a long time.Signed-off-by Osama Abdelkader <[email protected]>---
TBH low care level for this on my side. It's just passive debug code and the suggested change does not change anything on the resulting binary.
It's not that this debug code is not used at all, but very seldom. Last time I personally used it was like 3 years ago.
Quoted 41 lines
Quoted 41 lines
hw/9pfs/9p.c | 20 -------------------- 1 file changed, 20 deletions(-)hw/9pfs/9p.c +0
-0@@ -1389,20 +1389,6 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, conststruct stat *stbuf,>
return stat_to_qid(pdu, stbuf, &v9lstat->qid);}hw/9pfs/9p.c +0
-14-static void print_sg (struct iovec *sg,int cnt) -{ -int i; - -printf ("sg[%d]: {" , cnt); -for (i =0 ; i < cnt; i++) { -if (i) { -printf (", " ); - } -printf ("(%p, %zd)" , sg[i].iov_base, sg[i].iov_len); - } -printf ("}\n" ); -} -/* Will call this only for path name based fid */ static void v9fs_fix_path (V9fsPath *dst,V9fsPath *src,int len) {@@ -2468,9 +2454,6 @@ static void coroutine_fn v9fs_read(void *opaque) do { qemu_iovec_reset(&qiov); qemu_iovec_concat(&qiov, &qiov_full, count, qiov_full.size - count);Quoted 7 lines
hw/9pfs/9p.c static void coroutine_fn v9fs_read(void *opaque) · line 2475
Quoted 2 lines
hw/9pfs/9p.c +0
-2-if (0 ) { -print_sg (qiov.iov, qiov.niov);Alternatively, consider converting to trace event so we can keep dumping the entries, but select that at runtime (see for conversion example commit
4847c5701a3"hw/rtc/mc146818rtc: ConvertCMOS_DPRINTFinto trace events").
Quoted 6 lines
Probably overkill. We have a bunch of trace events where it makes, especially for investigating issues on 9p protocol level. But this debug code is usually just enabled if you are working on a virtio transport issue or new virtio feature and then you are usually working on this source code already.
But again: no strong opinion about this overall issue whatsoever.
Fine then!
Quoted 65 lines · Philippe Mathieu-Daudé
Quoted 64 lines · Christian Schoenebeck
Quoted 9 lines · CET Philippe Mathieu-Daudé
Hi Osama,
Quoted 6 lines · Osama Abdelkader
Remove the
print_sg()debug helper and its always-disabled call sites inv9fs_read()andv9fs_write(). The function was only reachable via if (0) blocks, so it has been dead code for a long time.Signed-off-by Osama Abdelkader <[email protected]>---
TBH low care level for this on my side. It's just passive debug code and the suggested change does not change anything on the resulting binary.
It's not that this debug code is not used at all, but very seldom. Last time I personally used it was like 3 years ago.
Quoted 46 lines
Quoted 33 lines
hw/9pfs/9p.c | 20 -------------------- 1 file changed, 20 deletions(-)hw/9pfs/9p.c +0
-0@@ -1389,20 +1389,6 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, conststruct stat *stbuf,>
return stat_to_qid(pdu, stbuf, &v9lstat->qid);}
hw/9pfs/9p.c +0
-14-static void print_sg (struct iovec *sg,int cnt) -{ -int i; - -printf ("sg[%d]: {" , cnt); -for (i =0 ; i < cnt; i++) { -if (i) { -printf (", " ); - } -printf ("(%p, %zd)" , sg[i].iov_base, sg[i].iov_len); - } -printf ("}\n" ); -} -/* Will call this only for path name based fid */ static void v9fs_fix_path (V9fsPath *dst,V9fsPath *src,int len) {hw/9pfs/9p.c static void coroutine_fn v9fs_read(void *opaque) · line 2475
Quoted 8 lines
hw/9pfs/9p.c +0
-2@@ -2468,9 +2454,6 @@ static void coroutine_fn v9fs_read(void *opaque) do { qemu_iovec_reset(&qiov); qemu_iovec_concat(&qiov, &qiov_full, count, qiov_full.size - count); - if (0) { - print_sg(qiov.iov, qiov.niov);Alternatively, consider converting to trace event so we can keep dumping the entries, but select that at runtime (see for conversion example commit
4847c5701a3"hw/rtc/mc146818rtc: ConvertCMOS_DPRINTFinto trace events").
Quoted 8 lines
Quoted 6 lines
Probably overkill. We have a bunch of trace events where it makes, especially for investigating issues on 9p protocol level. But this debug code is usually just enabled if you are working on a virtio transport issue or new virtio feature and then you are usually working on this source code already.
But again: no strong opinion about this overall issue whatsoever.
Fine then!
Thanks for your review.