Re: [PATCH 06/14] DRBD: userspace_interface

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kyle Moffett
Date: Monday, April 13, 2009 - 7:33 pm

Ok, first of all you should probably run all this through checkpatch
and fix all the errors it reports and most of the warnings, then
provide a log of the output indicating any false warnings.  That will
help you fix a lot of codingstyle quirks that tend to annoy ordinary
reviewers when they are going over your code, which helps make them
much more productive.


On Fri, Apr 10, 2009 at 8:12 AM, Philipp Reisner
<philipp.reisner@linbit.com> wrote:

I think there's a standard macro for this?  On the other hand, it's
generally recommended that you avoid using C-level bitfields for
network-transport things... masking with explicit constants is
preferred.



CamelCase is discouraged for constants, codingstyle encourages ALL_CAPS.



The best documentation that the values of an enum should not be
rearranged is to explicitly assign all of the enum values.
Specifically it makes it a pain in the rear for somebody to try to
break binary compatibility, which is a good coding practice in
general.




CodingStyle: Drop the _t and just use "union drbd_state".



Yeah, this is kinda ugly... just use shift and mask like most other places do.



CodingStyle: Your #defines should be ALL_CAPS



CodingStyle: Your type names should be all_lower_case



Instead of cobbling together your own tracing code, why not use the
fancy tracing infrastructure that Ingo, et. al. have been getting
merged?  Look at the blktrace patches that have been going by on LKML
today for some examples.


This looks like it should perhaps be implemented by sending uevents on
your drbd device, instead of running a separate userland helper.
Specifically that way you don't trigger an exec for every single
event; uevents support a persistent daemon handling various tasks.



CodingStyle:  s/STATIC/static/g
Also remove that #define STATIC static macro and associated #ifdefs



Perhaps you should just export a raw 64-bit number of bytes to
userspace via sysfs/etc and let userspace decode it?



Spelling/clarity fix: change "enum determin_dev_size_enum" to "enum
determine_dev_size"



Please use the existing dev_warn()-style macros instead of writing
your own set.  We're trying to get rid of those superfluous macros all
over the place, not add more!



Again, this looks like an excellent candidate for the standardized
tracing macros.



If this is a real bug, please submit a patch to fix it as a prereq for
the drbd patch.  If not, please remove this comment.



Yet more custom macros... use standard stuff like BUG_ON() please?



Ewww....  Either those should be static inlines or you should just
declare some local variables and reference them instead.


Either fix this code or remove it.

Cheers,
Kyle Moffett
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 01/14] DRBD: major.h, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 02/14] DRBD: lru_cache, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 03/14] DRBD: activity_log, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 04/14] DRBD: bitmap, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 05/14] DRBD: request, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 06/14] DRBD: userspace_interface, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 07/14] DRBD: internal_data_structures, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 08/14] DRBD: main, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 09/14] DRBD: receiver, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 10/14] DRBD: proc, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 11/14] DRBD: worker, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 12/14] DRBD: variable_length_integer_encoding, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 13/14] DRBD: misc, Philipp Reisner, (Fri Apr 10, 5:12 am)
[PATCH 14/14] DRBD: final, Philipp Reisner, (Fri Apr 10, 5:12 am)
Re: [PATCH 02/14] DRBD: lru_cache, Bart Van Assche, (Fri Apr 10, 5:24 am)
Re: [PATCH 07/14] DRBD: internal_data_structures, Bart Van Assche, (Sat Apr 11, 12:18 am)
Re: [PATCH 06/14] DRBD: userspace_interface, Bart Van Assche, (Sun Apr 12, 9:23 am)
Re: [PATCH 07/14] DRBD: internal_data_structures, Bart Van Assche, (Sun Apr 12, 9:44 am)
Re: [PATCH 06/14] DRBD: userspace_interface, Kyle Moffett, (Mon Apr 13, 7:33 pm)
Re: [PATCH 02/14] DRBD: lru_cache, Nikanth Karthikesan, (Tue Apr 14, 4:54 am)
Re: [PATCH 07/14] DRBD: internal_data_structures, Philipp Reisner, (Tue Apr 14, 6:53 am)
Re: [PATCH 02/14] DRBD: lru_cache, Philipp Reisner, (Wed Apr 15, 8:29 am)
Re: [PATCH 05/14] DRBD: request, Bart Van Assche, (Thu Apr 16, 12:06 am)
Re: [PATCH 07/14] DRBD: internal_data_structures, Philipp Reisner, (Thu Apr 16, 6:35 am)
Re: [PATCH 05/14] DRBD: request, Philipp Reisner, (Thu Apr 16, 8:32 am)
Re: [PATCH 06/14] DRBD: userspace_interface, Philipp Reisner, (Fri Apr 17, 6:24 am)
Re: [PATCH 06/14] DRBD: userspace_interface, Philipp Reisner, (Wed Apr 22, 3:31 am)