Staging: lustre: Remove unused functions
cover Staging: lustre: Remove unused functions
These patches remove the definitions of functions which are not used.
Shraddha Barke (2):
Staging: lustre: ptlrpc: Remove unused functions
Staging: lustre: obdclass: Remove unused functions
.../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------- 2 files changed, 202 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/2 Staging: lustre: ptlrpc: Remove unused functions
Remove the functions which are not used anywhere throughout the kernel
--- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------------------- 1 file changed, 63 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +0 -63
@@ -1182,30 +1182,6 @@ EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd);#undef BUFLEN -int lprocfs_wr_ping (struct file *file,const char __user *buffer, -size_t count,loff_t *off) -{ -struct obd_device *obd = ((struct seq_file *)file->private_data)->private; -struct ptlrpc_request *req; -int rc; - -LPROCFS_CLIMP_CHECK (obd); - req =ptlrpc_prep_ping (obd->u.cli.cl_import); -LPROCFS_CLIMP_EXIT (obd); -if (req ==NULL ) -return -ENOMEM ; - - req->rq_send_state =LUSTRE_IMP_FULL ; - - rc =ptlrpc_queue_wait (req); - -ptlrpc_req_finished (req); -if (rc >=0 ) -return count; -return rc; -} -EXPORT_SYMBOL (lprocfs_wr_ping); -/* Write the connection UUID to this file to attempt to connect to that node. * The connection UUID is a node's primary NID. For example, * "echo connection=192.168.0.1@tcp0::instance > .../import".
@@ -1273,42 +1249,3 @@ out:return count; }EXPORT_SYMBOL (lprocfs_wr_import); - -int lprocfs_rd_pinger_recov (struct seq_file *m,void *n) -{ -struct obd_device *obd = m->private; -struct obd_import *imp = obd->u.cli.cl_import; - -LPROCFS_CLIMP_CHECK (obd); -seq_printf (m,"%d\n" , !imp->imp_no_pinger_recover); -LPROCFS_CLIMP_EXIT (obd); - -return 0 ; -} -EXPORT_SYMBOL (lprocfs_rd_pinger_recov); - -int lprocfs_wr_pinger_recov (struct file *file,const char __user *buffer, -size_t count,loff_t *off) -{ -struct obd_device *obd = ((struct seq_file *)file->private_data)->private; -struct client_obd *cli = &obd->u.cli; -struct obd_import *imp = cli->cl_import; -int rc, val; - - rc =lprocfs_write_helper (buffer, count, &val); -if (rc <0 ) -return rc; - -if (val !=0 && val !=1 ) -return -ERANGE ; - -LPROCFS_CLIMP_CHECK (obd); -spin_lock (&imp->imp_lock); - imp->imp_no_pinger_recover = !val; -spin_unlock (&imp->imp_lock); -LPROCFS_CLIMP_EXIT (obd); - -return count; - -} -EXPORT_SYMBOL (lprocfs_wr_pinger_recov);
Signature · 1 line
2.1.4
PATCH 2/2 Staging: lustre: obdclass: Remove unused functions
In reply to Shraddha BarkeRemove the functions since they are not used anywhere throughout the kernel
--- .../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- 1 file changed, 139 deletions(-)
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +0 -139
@@ -330,32 +330,6 @@ out:EXPORT_SYMBOL (ldebugfs_register);/* Generic callbacks */ -int lprocfs_rd_uint (struct seq_file *m,void *data) -{ -seq_printf (m,"%u\n" , *(unsigned int *)data); -return 0 ; -} -EXPORT_SYMBOL (lprocfs_rd_uint); - -int lprocfs_wr_uint (struct file *file,const char __user *buffer, -unsigned long count,void *data) -{ -unsigned *p = data; -char dummy[MAX_STRING_SIZE +1 ], *end; -unsigned long tmp; - - dummy[MAX_STRING_SIZE ] ='\0' ; -if (copy_from_user (dummy, buffer,MAX_STRING_SIZE )) -return -EFAULT ; - - tmp =simple_strtoul (dummy, &end,0 ); -if (dummy == end) -return -EINVAL ; - - *p = (unsigned int )tmp; -return count; -} -EXPORT_SYMBOL (lprocfs_wr_uint);static ssize_t uuid_show (struct kobject *kobj,struct attribute *attr,char *buf)
@@ -484,46 +458,6 @@ static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr, }LUSTRE_RO_ATTR (filesfree); -int lprocfs_rd_server_uuid (struct seq_file *m,void *data) -{ -struct obd_device *obd = data; -struct obd_import *imp; -char *imp_state_name =NULL ; - -LASSERT (obd !=NULL ); -LPROCFS_CLIMP_CHECK (obd); - imp = obd->u.cli.cl_import; - imp_state_name =ptlrpc_import_state_name (imp->imp_state); -seq_printf (m,"%s\t%s%s\n" , -obd2cli_tgt (obd), imp_state_name, - imp->imp_deactive ?"\tDEACTIVATED" :"" ); - -LPROCFS_CLIMP_EXIT (obd); - -return 0 ; -} -EXPORT_SYMBOL (lprocfs_rd_server_uuid); - -int lprocfs_rd_conn_uuid (struct seq_file *m,void *data) -{ -struct obd_device *obd = data; -struct ptlrpc_connection *conn; - -LASSERT (obd !=NULL ); - -LPROCFS_CLIMP_CHECK (obd); - conn = obd->u.cli.cl_import->imp_connection; -if (conn && obd->u.cli.cl_import) -seq_printf (m,"%s\n" , conn->c_remote_uuid.uuid); -else -seq_puts (m,"<none>\n" ); - -LPROCFS_CLIMP_EXIT (obd); - -return 0 ; -} -EXPORT_SYMBOL (lprocfs_rd_conn_uuid); -/** add up per-cpu counters */ void lprocfs_stats_collect (struct lprocfs_stats *stats,int idx,struct lprocfs_counter *cnt)
@@ -755,34 +689,6 @@ out_climp: }EXPORT_SYMBOL (lprocfs_rd_import); -int lprocfs_rd_state (struct seq_file *m,void *data) -{ -struct obd_device *obd = data; -struct obd_import *imp; -int j, k; - -LASSERT (obd !=NULL ); -LPROCFS_CLIMP_CHECK (obd); - imp = obd->u.cli.cl_import; - -seq_printf (m,"current_state: %s\n" , -ptlrpc_import_state_name (imp->imp_state)); -seq_printf (m,"state_history:\n" ); - k = imp->imp_state_hist_idx; -for (j =0 ; j <IMP_STATE_HIST_LEN ; j++) { -struct import_state_hist *ish = - &imp->imp_state_hist[(k + j) %IMP_STATE_HIST_LEN ]; -if (ish->ish_state ==0 ) -continue ; -seq_printf (m," - [%lld, %s]\n" , (s64 )ish->ish_time, -ptlrpc_import_state_name (ish->ish_state)); - } - -LPROCFS_CLIMP_EXIT (obd); -return 0 ; -} -EXPORT_SYMBOL (lprocfs_rd_state); -int lprocfs_at_hist_helper (struct seq_file *m,struct adaptive_timeout *at) {int i;
@@ -795,51 +701,6 @@ int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at)EXPORT_SYMBOL (lprocfs_at_hist_helper);/* See also ptlrpc_lprocfs_rd_timeouts */ -int lprocfs_rd_timeouts (struct seq_file *m,void *data) -{ -struct obd_device *obd = data; -struct obd_import *imp; -unsigned int cur, worst; -time64_t now, worstt; -struct dhms ts; -int i; - -LASSERT (obd !=NULL ); -LPROCFS_CLIMP_CHECK (obd); - imp = obd->u.cli.cl_import; - - now =ktime_get_real_seconds (); - -/* Some network health info for kicks */ -s2dhms (&ts, now - imp->imp_last_reply_time); -seq_printf (m,"%-10s : %lld, " DHMS_FMT " ago\n" , -"last reply" , (s64 )imp->imp_last_reply_time,DHMS_VARS (&ts)); - - cur =at_get (&imp->imp_at.iat_net_latency); - worst = imp->imp_at.iat_net_latency.at_worst_ever; - worstt = imp->imp_at.iat_net_latency.at_worst_time; -s2dhms (&ts, now - worstt); -seq_printf (m,"%-10s : cur %3u worst %3u (at %lld, " DHMS_FMT " ago) " , -"network" , cur, worst, (s64 )worstt,DHMS_VARS (&ts)); -lprocfs_at_hist_helper (m, &imp->imp_at.iat_net_latency); - -for (i =0 ; i <IMP_AT_MAX_PORTALS ; i++) { -if (imp->imp_at.iat_portal[i] ==0 ) -break ; - cur =at_get (&imp->imp_at.iat_service_estimate[i]); - worst = imp->imp_at.iat_service_estimate[i].at_worst_ever; - worstt = imp->imp_at.iat_service_estimate[i].at_worst_time; -s2dhms (&ts, now - worstt); -seq_printf (m,"portal %-2d : cur %3u worst %3u (at %lld, " -DHMS_FMT " ago) " , imp->imp_at.iat_portal[i], - cur, worst, (s64 )worstt,DHMS_VARS (&ts)); -lprocfs_at_hist_helper (m, &imp->imp_at.iat_service_estimate[i]); - } - -LPROCFS_CLIMP_EXIT (obd); -return 0 ; -} -EXPORT_SYMBOL (lprocfs_rd_timeouts);int lprocfs_rd_connect_flags (struct seq_file *m,void *data) {
Signature · 1 line
2.1.4
Quoted 11 lines · On Thursday 22 October 2015 14:50:18 Shraddha Barke wrote:
These patches remove the definitions of functions which are not used.
Shraddha Barke (2):
Staging: lustre: ptlrpc: Remove unused functions
Staging: lustre: obdclass: Remove unused functions.../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------- 2 files changed, 202 deletions(-)
How did you check that they are indeed unused? I suspect these two patches are wrong.
Arnd
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · On Thursday 22 October 2015 14:50:18 Shraddha Barke wrote:
These patches remove the definitions of functions which are not used.
Shraddha Barke (2):
Staging: lustre: ptlrpc: Remove unused functions
Staging: lustre: obdclass: Remove unused functions
Quoted 8 lines
Quoted 5 lines
.../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------- 2 files changed, 202 deletions(-)How did you check that they are indeed unused? I suspect these two patches are wrong.
I grepped for the uses of these functions. When I did make M=drivers/staging/lustre, I didn't get errors. What am I missing here?
Thanks,
Shraddha
Quoted 10 lines
Arnd
Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/5359017.vBRWqNddLo%40wuerfel. For more options, visit https://groups.google.com/d/optout.
Quoted 15 lines · On Thursday 22 October 2015 15:16:39 Shraddha Barke wrote:
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · On Thursday 22 October 2015 14:50:18 Shraddha Barke wrote:
These patches remove the definitions of functions which are not used.
Shraddha Barke (2):
Staging: lustre: ptlrpc: Remove unused functions
Staging: lustre: obdclass: Remove unused functions.../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------- 2 files changed, 202 deletions(-)
Quoted 5 lines
Quoted 2 lines
How did you check that they are indeed unused? I suspect these two patches are wrong.
I grepped for the uses of these functions. When I did make M=drivers/staging/lustre, I didn't get errors. What am I missing here?
I see now that you did not remove the declarations from the header files. Please remove those and try again. Alternatively, you should see link-time errors when you try to do 'make' without the listing directory.
Arnd
A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.11.1510221655060.12430@shraddha-370R4E-370R4V-370R5E-3570RE-370R5V
Quoted 40 lines · Shraddha Barke
Quoted 20 lines · Arnd Bergmann
Quoted 19 lines · On Thursday 22 October 2015 15:16:39 Shraddha Barke wrote:
Quoted 16 lines · Arnd Bergmann
Quoted 12 lines · On Thursday 22 October 2015 14:50:18 Shraddha Barke wrote:
These patches remove the definitions of functions which are not used.
Shraddha Barke (2):
Staging: lustre: ptlrpc: Remove unused functions
Staging: lustre: obdclass: Remove unused functions.../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------- 2 files changed, 202 deletions(-)How did you check that they are indeed unused? I suspect these two patches are wrong.
Quoted 6 lines
Quoted 2 lines
I grepped for the uses of these functions. When I did make M=drivers/staging/lustre, I didn't get errors. What am I missing here?
I see now that you did not remove the declarations from the header files. Please remove those and try again. Alternatively, you should see link-time errors when you try to do 'make' without the listing directory.
Yes, you are right. This patchset is incorrect. However I still don't understand why I get these errors when it seems like these functions are not used anywhere. confused
Thanks,
Shraddha
Quoted 3 lines
Arnd
Quoted 33 lines · Shraddha Barke
Quoted 29 lines · Shraddha Barke
Quoted 25 lines · Arnd Bergmann
Quoted 23 lines · On Thursday 22 October 2015 15:16:39 Shraddha Barke wrote:
Quoted 15 lines · Arnd Bergmann
Quoted 13 lines · On Thursday 22 October 2015 14:50:18 Shraddha Barke wrote:
These patches remove the definitions of functions which are not used.
Shraddha Barke (2):
Staging: lustre: ptlrpc: Remove unused functions
Staging: lustre: obdclass: Remove unused functions.../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------- 2 files changed, 202 deletions(-)Quoted 3 lines
How did you check that they are indeed unused? I suspect these two patches
are wrong.I grepped for the uses of these functions. When I did make M=drivers/staging/lustre, I didn't get errors. What am I missing here?
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
I see now that you did not remove the declarations from the header files. Please remove those and try again. Alternatively, you should see link-time errors when you try to do 'make' without the listing directory.
Yes, you are right. This patchset is incorrect. However I still don't understand why I get these errors when it seems like these functions are not used anywhere. confused
I didn't keep the previous messages, so I don't have the names of the functions handly, but one thing to look out for is that macros can be used to construct names with the ## operator. Another issue could be, depending on how you did the grep, that the function name is used as a variable, eg stored in some function pointer typed structure field, rather than being called directly.
julia
Quoted 39 lines · Julia Lawall
Quoted 37 lines · Shraddha Barke
Quoted 33 lines · Shraddha Barke
Quoted 28 lines · Arnd Bergmann
Quoted 17 lines · On Thursday 22 October 2015 15:16:39 Shraddha Barke wrote:
Quoted 15 lines · Arnd Bergmann
Quoted 13 lines · On Thursday 22 October 2015 14:50:18 Shraddha Barke wrote:
These patches remove the definitions of functions which are not used.
Shraddha Barke (2):
Staging: lustre: ptlrpc: Remove unused functions
Staging: lustre: obdclass: Remove unused functions.../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------- 2 files changed, 202 deletions(-)Quoted 6 lines
Quoted 3 lines
How did you check that they are indeed unused? I suspect these two patches
are wrong.I grepped for the uses of these functions. When I did make M=drivers/staging/lustre, I didn't get errors. What am I missing here?
I see now that you did not remove the declarations from the header files. Please remove those and try again. Alternatively, you should see link-time errors when you try to do 'make' without the listing directory.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Yes, you are right. This patchset is incorrect. However I still don't understand why I get these errors when it seems like these functions are not used anywhere. confused
I didn't keep the previous messages, so I don't have the names of the functions handly, but one thing to look out for is that macros can be used to construct names with the ## operator.
Yes I think this is what happened here. The grep returns all possible uses of the function.
Another issue could be,
Quoted 6 lines
depending on how you did the grep, that the function name is used as a variable, eg stored in some function pointer typed structure field, rather than being called directly.
julia
A message that is not in the archive (sent off-list or not yet received): 22058642.AcY4u3glHG@wuerfel
A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.11.1510221745390.12430@shraddha-370R4E-370R4V-370R5E-3570RE-370R5V
Quoted 79 lines · Shraddha Barke
Quoted 56 lines · Arnd Bergmann
Quoted 25 lines · On Thursday 22 October 2015 16:59:01 Shraddha Barke wrote:
Quoted 23 lines · Arnd Bergmann
Quoted 21 lines · On Thursday 22 October 2015 15:16:39 Shraddha Barke wrote:
Quoted 14 lines · Arnd Bergmann
Quoted 12 lines · On Thursday 22 October 2015 14:50:18 Shraddha Barke wrote:
These patches remove the definitions of functions which are not used.
Shraddha Barke (2):
Staging: lustre: ptlrpc: Remove unused functions
Staging: lustre: obdclass: Remove unused functions.../lustre/lustre/obdclass/lprocfs_status.c | 139 --------------------- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 63 ---------- 2 files changed, 202 deletions(-)Quoted 2 lines
How did you check that they are indeed unused? I suspect these two patches are wrong.
I grepped for the uses of these functions. When I did make M=drivers/staging/lustre, I didn't get errors. What am I missing here?
Quoted 7 lines
Quoted 3 lines
I see now that you did not remove the declarations from the header files. Please remove those and try again. Alternatively, you should see link-time errors when you try to do 'make' without the listing directory.
Yes, you are right. This patchset is incorrect. However I still don't understand why I get these errors when it seems like these functions are not used anywhere. confused
The problem here is that there are macros using string concatenation to create references to these functions in
drivers/staging/lustre/lustre/include/lprocfs_status.h:#define LPROC_SEQ_FOPS_WR_ONLY(name, type) \ static ssize_t name##_##type##_write(struct file *file, \ const char __user *buffer, size_t count, \ loff_t *off) \ { \ return lprocfs_wr_##type(file, buffer, count, off); \ } \ static int name##_##type##_open(struct inode *inode, struct file *file) \ { \ return single_open(file, NULL, inode->i_private); \ } \ static struct file_operations name##_##type##_fops = { \ .open = name##_##type##_open, \ .write = name##_##type##_write, \ .release = lprocfs_single_release, \ }Quoted 5 lines
I made the same mistake when I removed a lot of unused code from this file system, but I caught it during the compile-testing.
I usually try to avoid macros like this in my own code, or at least make references to other identifiers explicit.
Thanks! It is much clear to me now :)
It might be a good idea toQuoted 3 lines
try replacing the macros with calls to the normal APIs that we have in
include/linux/debugfs.hfor the same purpose, but I'm not sure if that is an overall win.I'll try to do this.
Shraddha
Quoted 3 lines
Arnd