staging/lustre: use 64-bit times for exp_last_request_time
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 3291083.GxjVIOEiUy@wuerfel
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 1956624.Zv9KJSmuQh@wuerfel
Drokin
PATCH 32/37 staging/lustre: use 64-bit times for exp_last_request_time
Quoted 42 lines · Arnd Bergmann
Quoted 41 lines · Oleg
Quoted 16 lines · Arnd Bergmann
Quoted 15 lines · Oleg
Quoted 5 lines · Arnd Bergmann
The last request time is stored as an 'unsigned long', which is good enough until 2106, but it is then converted to 'long' in some places, which overflows in 2038.
This changes the type to
time64_tto avoid those problems.Hm?
All this code is actually only making sense on server and is unused otherwise, so it's probably best to dropping_evictor_start,ping_evictor_main,exp_expired,class_disconnect_export_list(and two places where it's called from) functions andexp_last_request_timefield.
And with ping evictor gone, we should also dropptlrpc_update_export_timer.Quoted 6 lines
Quoted 3 lines
While clients do retain the request handling code (to process server-originated requests like lock callbacks), they are not going to evict the servers because the server have not talked to us in a while or anything of the sort.
I tried doing this, but could not figure out how to get rid of
class_disconnect_exports().It's only called from
class_cleanuplike this:/* The three references that should be remaining are the * obd_self_export and the attach and setup references. */ if (atomic_read(&obd->obd_refcount) > 3) { /* refcount - 3 might be the number of real exports (excluding self export). But class_incref is called by other things as well, so don't count on it. */ CDEBUG(D_IOCTL, "%s: forcing exports to disconnect: %d\n", obd->obd_name, atomic_read(&obd->obd_refcount) - 3); dump_exports(obd, 0); class_disconnect_exports(obd); }
Quoted 8 lines
Quoted 2 lines
This is only true on the servers so we can replace it with a corresponding LASSERT, I imagine.
Ok, I see. This wasn't clear as I really know nothing about what lustre actually does. Just for my information, can you clarify where the server code sits? Is that a fork of the same code base running in user space, or is there another set of kernel modules on top of the common ones that implements the server?
Lustre server (and out of tree client) live in http://git.whamcloud.com/fs/lustre-release.git/
Code in the staging tree is a snapshot from between 2.4 and 2.5 releases that undergoes cleanups in order to conform to kernel standards.
It's only client too, so all server-side parts are being removed as they are identified.
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
However, I started removing dead code and ended up with a huge patch that would not make it to mailing list servers and that I therefor pasted on http://pastebin.com/uncZQNh7 for reference.
Wow, this is a large patch indeed.
Some parts of it I was contemplating on my own like whole dt_object.[ch] removal with all the ties in llog code, though it was somewhat tricky as some bits in mgc seems to be using that somehow.I first recursively removed all functions that 'nm' showed as globally defined but never referenced from another file (except those that should be marked
Ah, neat trick.
Quoted 8 lines
Quoted 8 lines
I have not finished a detailed runthrough yet, but on the surface, why did you remove
suppress_pingsparameter 0 that is still valid on clients, to let them not ping servers. Alsoptlrpc_ping_import_soonand friends - all that code is actually needed.Only "ping evictor" is not needed on the client as it's only servers that are going to kick out clients that are silent for too long. Clients are still expected to send their "keep alive" pings in periodically (unless
suppress_pingsoption is enabled).
Quoted 6 lines
Quoted 2 lines
Hm?. I now see it is not fully implemented, that's why you are removing it as it's really not called from anywhere.
Right, I obviously cannot tell the difference between code that is not needed on the client or that has been orphaned in a previous cleanup and code that has just been added in order to soon be used.
This code is not "soon to be used", so it's ok to kill it now and we can spring it back to life when it actually becomes useful.
Quoted 5 lines
Quoted 3 lines
Anyway this does remove a lot of stuff that we don't really need in the client, I'll try to get it built and tested just to make sure it does not really break anything (unfortunately it does not seem to apply cleanly to the tip of staging-next tree).
Ok. I based the patches on top of my 37 patch series, and if you want I can upload a git branch somewhere to make rebasing easier.
That would be great.
Though in the end likely this huge patch would need to be split into smaller chunks. Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] removal and so on.
But for testing a current snapshot would be great, then I can run it through my testbed to see how it fares there.
Thanks!
Bye,
Oleg
PATCH 32/37 staging/lustre: use 64-bit times for exp_last_request_time
Quoted 14 lines · Oleg
Quoted 4 lines · Arnd Bergmann
Quoted 3 lines · Oleg
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Oleg
On Sep 23, 2015, at 3:13 PM, Arnd Bergmann wrote:
Quoted 8 lines
Quoted 2 lines
This is only true on the servers so we can replace it with a corresponding LASSERT, I imagine.
Ok, I see. This wasn't clear as I really know nothing about what lustre actually does. Just for my information, can you clarify where the server code sits? Is that a fork of the same code base running in user space, or is there another set of kernel modules on top of the common ones that implements the server?
Quoted 5 lines
Lustre server (and out of tree client) live in http://git.whamcloud.com/fs/lustre-release.git/
Code in the staging tree is a snapshot from between 2.4 and 2.5 releases that undergoes cleanups in order to conform to kernel standards.
It's only client too, so all server-side parts are being removed as they are identified.
Ok, I see.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
I have not finished a detailed runthrough yet, but on the surface, why did you remove
suppress_pingsparameter 0 that is still valid on clients, to let them not ping servers. Alsoptlrpc_ping_import_soonand friends - all that code is actually needed.Only "ping evictor" is not needed on the client as it's only servers that are going to kick out clients that are silent for too long. Clients are still expected to send their "keep alive" pings in periodically (unless
suppress_pingsoption is enabled).Hm?. I now see it is not fully implemented, that's why you are removing it as it's really not called from anywhere.
Quoted 6 lines
Quoted 3 lines
Right, I obviously cannot tell the difference between code that is not needed on the client or that has been orphaned in a previous cleanup and code that has just been added in order to soon be used.
This code is not "soon to be used", so it's ok to kill it now and we can spring it back to life when it actually becomes useful.
Makes sense.
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Anyway this does remove a lot of stuff that we don't really need in the client, I'll try to get it built and tested just to make sure it does not really break anything (unfortunately it does not seem to apply cleanly to the tip of staging-next tree).
Ok. I based the patches on top of my 37 patch series, and if you want I can upload a git branch somewhere to make rebasing easier.
Quoted 6 lines
That would be great.
Though in the end likely this huge patch would need to be split into smaller chunks. Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] removal and so on.
But for testing a current snapshot would be great, then I can run it through my testbed to see how it fares there.
Ok, I've pushed out the branch to
git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre
This contains the latest version of the y2038 series (with the warning fixed that Sudip Mukherjee found) but no other changes, and the big code removal on top.
ARnd
Drokin
PATCH 32/37 staging/lustre: use 64-bit times for exp_last_request_time
Quoted 13 lines · Arnd Bergmann
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Anyway this does remove a lot of stuff that we don't really need in the client, I'll try to get it built and tested just to make sure it does not really break anything (unfortunately it does not seem to apply cleanly to the tip of staging-next tree).
Ok. I based the patches on top of my 37 patch series, and if you want I can upload a git branch somewhere to make rebasing easier.
Quoted 6 lines
That would be great.
Though in the end likely this huge patch would need to be split into smaller chunks. Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] removal and so on.
But for testing a current snapshot would be great, then I can run it through my testbed to see how it fares there.
Quoted 7 lines
Ok, I've pushed out the branch to
git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre
This contains the latest version of the y2038 series (with the warning fixed that Sudip Mukherjee found) but no other changes, and the big code removal on top.
These do seem to be working fine in my testing.
I also noticed we can remove some more stuff in at least fid/ dir so I created some patches on top of your tree:
https://github.com/verygreen/linux/tree/fidcleanup
Also I've looked a bit into nm and I don't see a straight way of cross referencing which globally visible functions are not really used by anything.
Do you have a handy recipe for that?
Thanks.
Bye,
Oleg
Drokin
PATCH 32/37 staging/lustre: use 64-bit times for exp_last_request_time
Quoted 17 lines · Oleg
Quoted 15 lines · Arnd Bergmann
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Anyway this does remove a lot of stuff that we don't really need in the client, I'll try to get it built and tested just to make sure it does not really break anything (unfortunately it does not seem to apply cleanly to the tip of staging-next tree).
Ok. I based the patches on top of my 37 patch series, and if you want I can upload a git branch somewhere to make rebasing easier.
Quoted 6 lines
That would be great.
Though in the end likely this huge patch would need to be split into smaller chunks. Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] removal and so on.
But for testing a current snapshot would be great, then I can run it through my testbed to see how it fares there.Ok, I've pushed out the branch to
Quoted 8 lines
Quoted 5 lines
git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre
This contains the latest version of the y2038 series (with the warning fixed that Sudip Mukherjee found) but no other changes, and the big code removal on top.
These do seem to be working fine in my testing.
Ah, and I should mention that just as I suspected, the debug log decoding tool is very unhappy.
PATCH 32/37 staging/lustre: use 64-bit times for exp_last_request_time
Quoted 26 lines · Oleg
Quoted 24 lines · Oleg
Quoted 20 lines · Arnd Bergmann
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Anyway this does remove a lot of stuff that we don't really need in the client, I'll try to get it built and tested just to make sure it does not really break anything (unfortunately it does not seem to apply cleanly to the tip of staging-next tree).
Ok. I based the patches on top of my 37 patch series, and if you want I can upload a git branch somewhere to make rebasing easier.
Quoted 6 lines
That would be great.
Though in the end likely this huge patch would need to be split into smaller chunks. Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] removal and so on.
But for testing a current snapshot would be great, then I can run it through my testbed to see how it fares there.Ok, I've pushed out the branch to
git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre
This contains the latest version of the y2038 series (with the warning fixed that Sudip Mukherjee found) but no other changes, and the big code removal on top.
Quoted 4 lines
Quoted 1 line
These do seem to be working fine in my testing.
Ah, and I should mention that just as I suspected, the debug log decoding tool is very unhappy.
I have updated the branch now to reflect our discussions so far. Can you handle forwarding the patches to Greg from there, or complain if there are still problems with them?
I still had problems with removing ptlrpc_update_export_timer(), so I left a small patch for that, which you probably want to do differently, and while I split out the nontrivial parts of the large removal patch, most of it still is in one chunk that contains purely removals of whole lines.
Arnd
Drokin
PATCH 32/37 staging/lustre: use 64-bit times for exp_last_request_time
Quoted 27 lines · Arnd Bergmann
Quoted 26 lines · Oleg
Quoted 24 lines · Oleg
Quoted 20 lines · Arnd Bergmann
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Anyway this does remove a lot of stuff that we don't really need in the client, I'll try to get it built and tested just to make sure it does not really break anything (unfortunately it does not seem to apply cleanly to the tip of staging-next tree).
Ok. I based the patches on top of my 37 patch series, and if you want I can upload a git branch somewhere to make rebasing easier.
Quoted 6 lines
That would be great.
Though in the end likely this huge patch would need to be split into smaller chunks. Like if all unused llog code removal is done, that would allow subsequent dt_object.[ch] removal and so on.
But for testing a current snapshot would be great, then I can run it through my testbed to see how it fares there.Ok, I've pushed out the branch to
git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-lustre
This contains the latest version of the y2038 series (with the warning fixed that Sudip Mukherjee found) but no other changes, and the big code removal on top.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
These do seem to be working fine in my testing.
Ah, and I should mention that just as I suspected, the debug log decoding tool is very unhappy.
I have updated the branch now to reflect our discussions so far. Can you handle forwarding the patches to Greg from there, or complain if there are still problems with them?
Aha, sure.
Do you want me to send the y2038 patches too?
Quoted 4 lines
I still had problems with removing
ptlrpc_update_export_timer(), so I left a small patch for that, which you probably want to do differently, and while I split out the nontrivial parts of the large removal patch, most of it still is in one chunk that contains purely removals of whole lines.
Ok, I'll take care of this as well.
Thank you!
Bye,
Oleg
PATCH 32/37 staging/lustre: use 64-bit times for exp_last_request_time
Quoted 9 lines · Oleg
Quoted 4 lines · Arnd Bergmann
I have updated the branch now to reflect our discussions so far. Can you handle forwarding the patches to Greg from there, or complain if there are still problems with them?
Aha, sure.
Do you want me to send the y2038 patches too?
Yes, I meant both the y2038 patches and the code removal.
Quoted 8 lines
Quoted 4 lines
I still had problems with removing
ptlrpc_update_export_timer(), so I left a small patch for that, which you probably want to do differently, and while I split out the nontrivial parts of the large removal patch, most of it still is in one chunk that contains purely removals of whole lines.Ok, I'll take care of this as well.
Thank you!
Thanks!
Arnd
PATCH 32/37 staging/lustre: use 64-bit times for exp_last_request_time
In reply to DrokinQuoted 12 lines · Oleg
These do seem to be working fine in my testing.
I also noticed we can remove some more stuff in at least fid/ dir so I created some patches on top of your tree:
https://github.com/verygreen/linux/tree/fidcleanupAlso I've looked a bit into nm and I don't see a straight way of cross referencing which globally visible functions are not really used by anything.
Do you have a handy recipe for that?
I usually use ad-hoc shell commands. This time, my history has these commands:
find build/tmp/drivers/staging/lustre/ -name \*.o | grep -v built-in | xargs nm | grep -w U | cut -f 11- -d\ | sort -u > refs
find build/tmp/drivers/staging/lustre/lustre/obdclass/ -name \*.o | grep -v built-in | xargs nm | grep -w [A-TV-Z] | grep -v __ksymtab | grep -v __crc | cut -f 3 -d \ | sort -u > defs diff -u defs refs | grep ^- | cut -f 2 -d- | while read i ; do echo ==== $i ==== ; git grep -w $i ; done | less
I'm sure this could be done in a more robust and cleaner way, and probably has been done before. If someone has a good way of doing this generically, we could add that to the scripts/ directory and get get more people to analyse the staging drivers (or their own code elsewhere) this way.
Note that I only did this for symbols defined in obdclass and ptlrpc, there are plenty more in the other modules. Also, most of the findings are for symbols that should be marked 'static', because they have only users in the file that they are defined in. Doing that would lead to better code generation.
Two related things I'd do when cleaning up a code base are to check all the EXPORT_SYMBOL statements and remove the ones that are not used in another module, and to check for global identifiers that are missing a proper prefix and should be renamed (e.g. dirty_cnt, dump_lsm, lock_handle_ops, our_vma, pool_hash_operations, target_send_reply, at_max, dump_exports, ...).
Arnd