From morrone2 at llnl.gov Thu Oct 1 00:32:26 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Wed, 30 Sep 2015 17:32:26 -0700 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> Message-ID: <560C7F1A.30004@llnl.gov> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: > I looked around to see where the helpers are used. It looks to me that they are always used in proc related functions. I agree with the issues you mentioned at the top of the email as well. Yes, but I meant to say we need to consider future use. Largely motivated by the effort to upstream the Lustre client into Linux, the /proc interfaces are slowly going away. So I was just suggesting that we should check that these functions will still be used by the new debugfs/sysfs/whatever interfaces in the future. Nothing really needed to consider though; they are generic enough to still be used well into the future. With that in mind, we should probably change the function names even further. Instead of naming the functions after the current primary callers, we should name them according to what they do. Perhaps something along the lines of: str_to_u64(). That is just good naming practice anyway. When you are reading code and you hit a call to a function named "helper", that doesn't give you much of a clue as to what it does. > It also appears that the multiplier is never negative, so making it an unsigned int seems like the right way to go. I also noticed that lprocfs_write_frac_helper calls are always followed by a check if the value produced is greater than 0 and if not an error is thrown. This implies the signed version may not be necessary (and that maybe the unsigned helper should error with strings representing negative numbers?). > > Also, I think both the unsigned and signed methods parse the numeric portion of the string in a very similar fashion. At the very least, they appear to attempt to do the same thing. That is the portion I was going to consolidate down. Yes, the _u64_ functions almost certainly started out as a cut-and-paste of the other functions. > You didn't comment on detecting overflow/underflow/wrapping. I still think those are a valid concern as well. I agree. It is completely reasonable to add those checks during the refactoring. > Giuseppe > ________________________________________ > From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Christopher J. Morrone [morrone2 at llnl.gov] > Sent: Tuesday, September 29, 2015 7:25 PM > To: lustre-devel at lists.lustre.org > Subject: Re: [lustre-devel] lprocfs Helper Issues > > I looked through the code a bit, and I think that the even bigger issues > are the lack of reasonable naming, lack of comments, and a puzzling > semantic inconsistency. > > Before working on any of the issues I mention below though, we should > probably make sure that these functions still have a purpose once /proc > goes away. They seem generic enough helpers that they will still be > used with the non-/proc methods, but it is worth checking. > > First, consider this pair of names: > > lprocfs_write_frac_helper > lprocfs_write_frac_u64_helper > > One might reasonably suspect that the major difference between these two > functions is that the latter deails with a u64, and the former does not. > But that is already pretty darn clear from the full function > prototype, and really the main difference is that > lprocfs_write_frac_u64_helper can parse a units character in the string. > Maybe the name should be lprocfs_write_frac_units_helper. > > Also, the semantics surrounding the multiplier are field are different. > For lprocfs_write_frac_helper the mult parameter is always enforced, > and there is code that replies on that. With > lprocfs_write_frac_u64_helper mult is merely a default, and the caller > can't rely on it being used. Two functions with similar names but > difference semantics (and not in the way implied by the name > difference), and no function comments...not a good idea. > > Next there is the naming difference between these: > > lprocfs_write_frac_u64_helper > lprocfs_write_u64_helper > > One might reasonably expect that when using the latter function one > loses the ability to handle fractional numbers. But no, actually it > just sets the multiplier to a default of 1. How does that naming make > any sense? > > I suppose that with lprocfs_write_helper that naming style almost makes > sense, because a multiplier of 1 will result in anything after the > decimal point being calculated out to 0. So the fractional part is, in > effect, ignored. But, strangely enough, fractions are still _accepted_ > by the function. > > This semantic distinction is important to consider. It means that you > can't just do a naive combination of the two functions into your > proposed lprocfs_write_frac_helper_internal() function. There are > callers of lprocfs_write_frac_helper that assume that the multiplier can > be only the one specified and would result in incorrect number if there > were user-specified units in the string. > > By the was, I'm not really in favor of duplicating the existing > functions with a hope to remove the old ones at some time in the future. > I think (despite current evidence to the contrary) that these > functions are not so difficult to review that we would need a transition > period. We would just need to audit every caller to make sure that any > semantic changes are handled. > > And frankly, there would appear to be code that _already_ gets this > wrong, so an audit is really needed already. For instance, > ll_max_readahead_mb_seq_write() tries to be too clever by assuming that > users can only provide an integer that represents number of MiB, and > then passes in a multiplier that will have it convert into number of > pages. But the since they used lprocfs_write_frac_u64_helper(), the > user can specify their own units, and then the number returned number > will be bytes instead of pages. Here are the callers that I found that > are doing it wrong: > > ll_max_readahead_mb_seq_write > ll_max_cached_mb_seq_write > proc_max_dirty_pages_in_mb > osc_cached_mb_seq_write > > 4 out of 5 are doing it wrong. Not a good track record. > > And getting back to the point, franctions and units are both accepted > and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in the > name is misleading at best. > > Why does lprocfs_write_frac_helper do its own handling of negatives and > then call the unsigned simple_strtoul function? Why not just use the > signed simple_strtol function? As far as I can tell the signed version > of the function has been in Linux as long as the unsigned version. > > Why is mult declared as a signed int? I think it should almost > certainly be unsigned. I think it might only be signed because the > function author reuses mult as a local variable to stored the negative > sign when parsed from the string. If so, that is a poor choice. The > function declaration is a contract with the caller. If it makes no > sense to pass in a negative multiplier, then the declaration should make > that clear by declaring it unsigned. > > Why do the unsigned versions of the helper functions allow and parse > negative numbers? I think that this gets to the heart of your > suggestion about special handling for -1. I think that knowing that -1 > has special meaning for something things is too specialized for the > helper function. I think we are better off letting the caller decided > what special handling to do and when. > > I would suggest that the main helper that does handling of > user-specified units should not be casting the number to an unsigned > value. Leave the casting to the caller, or perhaps provide a simple > wrapper to cast away the sign. I don't think we are going to miss that > one extra bit for positive numbers. > > So maybe we need the most generic function prototype be be something like: > > int lprocfs_write_helper(char *buffer, unsigned long count, __s64 *val, > unsigned int mult, bool units_allowed); > > The function comment would explain that if units are allowed, then the > multiplier is only a default and will be overridden by the > user-specificed unit. > > Chris > > On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >> Greetings, >> >> Recently, I've noticed that the lprocfs write frac int and u64 helpers >> have a few issues. The biggest issue is that neither function handles >> overflow/wrap. I also noticed very similar code that should be >> consolidated down and leveraged by both helpers. >> >> I was thinking of refactoring the functions in the fashion described below. >> >> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >> count, __u64 *val, int mult); >> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >> unsigned long count, __u64 *val, int mult); >> int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned >> long count, int *val, int mult); >> >> lprocfs_write_frac_helper_internal would handle parsing an unsigned long >> long from the kernel char buffer passed in. It will be responsible for >> detecting if a uint wrap occurs. >> >> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >> automatically return ULLONG_MAX. If any other string representing a >> negative number is passed in, an invalid value error code should be >> returned. If the multiplier is negative, that would also be treated as >> invalid. The units and multiplier logic can also be consolidated. It >> will use lprocfs_write_frac_helper_internal to handle the parsing. >> >> lprocfs_write_frac_helper_safe will leverage >> lprocfs_write_frac_helper_internal. If >> lprocfs_write_frac_helper_internal indicates a wrap occurred, then we >> also have an invalid integer. Checks for integer overflow happen after a >> successful call to the internal helper. This is similar to how the >> current lprocfs_write_frac_helper functions. >> >> It is also worth nothing, I plan to maintain the old helpers and their >> use can be gradually phased out once we are confident the refactored >> version is doing what it is supposed to. >> >> Also, unrelated to the above, quick question about lctl. Is there a >> particular reason why the setting to be changed when using lctl >> set_param is echoed back to the user? I think it can be misleading in >> cases where the value set is not necessarily what is being reflected to >> the user (i.e. -1 for max value). That could be confusing to a user and >> they should be using lctl get_param to confirm their value was set >> anyways. Also, it would follow convention that unless an error happens, >> nothing is printed to console. Any disagreements on silencing lctl >> set_param? >> >> Thanks, >> Giuseppe Di Natale >> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > . > From oleg.drokin at intel.com Thu Oct 1 03:21:04 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Thu, 1 Oct 2015 03:21:04 +0000 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <560C7F1A.30004@llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov> Message-ID: <1A2899D5-160B-4BC3-982D-DE6256F3D94B@intel.com> On Sep 30, 2015, at 8:32 PM, Christopher J. Morrone wrote: > On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >> I looked around to see where the helpers are used. It looks to me that they are always used in proc related functions. I agree with the issues you mentioned at the top of the email as well. > > Yes, but I meant to say we need to consider future use. Largely motivated by the effort to upstream the Lustre client into Linux, the /proc interfaces are slowly going away. So I was just suggesting that we should check that these functions will still be used by the new debugfs/sysfs/whatever interfaces in the future. Nothing really needed to consider though; they are generic enough to still be used well into the future. The thing with the upstream kernel is that effectively procfs was split into two parts. The parts that are 1 value per file are in sysfs, the rest is in ldiskfs and resuses huge chunks of old code (including the functions mentioned). This is not to say we cannot replace them, of course. But upstream they want us to explore other avenues for many of our stuff too, like perf code for performance/usage gathering. Bye, Oleg From green at linuxhacker.ru Thu Oct 1 04:12:11 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:11 -0400 Subject: [lustre-devel] [PATCH 01/32] staging/lustre/llite: Remove unused ll_get_default/max_cookiesize() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-2-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This was used for a function that's no longer important, but is no longer used anywhere. Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/llite/llite_internal.h | 2 -- drivers/staging/lustre/lustre/llite/llite_lib.c | 26 ---------------------- 2 files changed, 28 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index dcf7c6b..59fdbed 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -789,8 +789,6 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, int ll_obd_statfs(struct inode *inode, void *arg); int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize); int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize); -int ll_get_max_cookiesize(struct ll_sb_info *sbi, int *max_cookiesize); -int ll_get_default_cookiesize(struct ll_sb_info *sbi, int *default_cookiesize); int ll_process_config(struct lustre_cfg *lcfg); struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, struct inode *i1, struct inode *i2, diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index b6234b2..e1d8fb0 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -604,32 +604,6 @@ int ll_get_default_mdsize(struct ll_sb_info *sbi, int *lmmsize) return rc; } -int ll_get_max_cookiesize(struct ll_sb_info *sbi, int *lmmsize) -{ - int size, rc; - - size = sizeof(int); - rc = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_MAX_COOKIESIZE), - KEY_MAX_COOKIESIZE, &size, lmmsize, NULL); - if (rc) - CERROR("Get max cookiesize error rc %d\n", rc); - - return rc; -} - -int ll_get_default_cookiesize(struct ll_sb_info *sbi, int *lmmsize) -{ - int size, rc; - - size = sizeof(int); - rc = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_DEFAULT_COOKIESIZE), - KEY_DEFAULT_COOKIESIZE, &size, lmmsize, NULL); - if (rc) - CERROR("Get default cookiesize error rc %d\n", rc); - - return rc; -} - static void client_common_put_super(struct super_block *sb) { struct ll_sb_info *sbi = ll_s2sbi(sb); -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:16 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:16 -0400 Subject: [lustre-devel] [PATCH 06/32] staging/lustre/lov: Remove unused lov_lsm_decref() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-7-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Also lov_lsm_addref is only used in the file it is defined, so make it static Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/lov/lov_cl_internal.h | 3 --- drivers/staging/lustre/lustre/lov/lov_object.c | 13 +------------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index 314ce85..9a9156e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -637,9 +637,6 @@ struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio, const struct cl_page_slice *slice); -void lov_lsm_decref(struct lov_object *lov, struct lov_stripe_md *lsm); -struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov); - #define lov_foreach_target(lov, var) \ for (var = 0; var < lov_targets_nr(lov); ++var) diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 4d7cd92..e67df64 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -909,7 +909,7 @@ struct lu_object *lov_object_alloc(const struct lu_env *env, return obj; } -struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov) +static struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov) { struct lov_stripe_md *lsm = NULL; @@ -924,17 +924,6 @@ struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov) return lsm; } -void lov_lsm_decref(struct lov_object *lov, struct lov_stripe_md *lsm) -{ - if (lsm == NULL) - return; - - CDEBUG(D_INODE, "lsm %p decref %d by %p.\n", - lsm, atomic_read(&lsm->lsm_refc), current); - - lov_free_memmd(&lsm); -} - struct lov_stripe_md *lov_lsm_get(struct cl_object *clobj) { struct lu_object *luobj; -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:10 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:10 -0400 Subject: [lustre-devel] [PATCH 00/32] Lustre (mostly locking) unused code removal Message-ID: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This continues the quest for killing unused code in the Lustre client. Main focus in this set is on Lustre LDLM code - it kills both outright unused code and code that looks like it's used, but in fact also unused as various conditions that would lead to it would only happen on the server. Also LDLM is cleaned up to remove unneeded exported symbols and (almost) all locally used functions are now declared as static. Also a few patches to llite/lov to remove some unused functions there. Please consider. Oleg Drokin (32): staging/lustre/llite: Remove unused ll_get_default/max_cookiesize() staging/lustre: KEY_DEFAULT/MAX_COOKIESIZE key is unused, remove them staging/lustre: Remove ununused ll_ra_read_get() staging/lustre/llite: Remove unused ll_rmdir_entry() staging/lustre/lov: Remove unused lov_dump_lmm/pool() staging/lustre/lov: Remove unused lov_lsm_decref() staging/lustre/ldlm: Remove unused interval tree bits staging/lustre/ldlm: Remove unused ldlm_cancel_locks_for_exports() staging/lustre/ldlm: Remove ldlm_init/destroy_export() staging/lustre/ldlm: Remove unimplemented lock conversion traces. staging/lustre/ldlm: Get rid of lr_converting queue staging/lustre/ldlm: Remove unused ldlm_cli_enqueue_local() staging/lustre/ldlm: Remove unused ldlm_init/fini_flock_export staging/lustre/ldlm: Remove unused ldlm_enqueue_pack() staging/lustre/ldlm: Remove ldlm_errno2error() staging/lustre/ldlm: Remove ldlm_glimpse_ast() staging/lustre/ldlm: Remove ldlm_lock_fail_match() staging/lustre/ldlm: Remove ldlm_namespace_free() staging/lustre/ldlm: Remove unused ldlm_pool_get_clv() staging/lustre/ldlm: Remove unused ldlm_pool_set_slv() staging/lustre/ldlm: Remove ldlm_refresh/del_waiting_lock() staging/lustre/ldlm: Remove intent policies handler. staging/lustre/ldlm: Remove unused ldlm_reprocess_all*() staging/lustre/ldlm: Remove unused ldlm_resource_insert_lock_after() staging/lustre/ldlm: Remove unused ldlm_blocking_ast/_nocheck() staging/lustre: Remove ns_is_client() staging/lustre: Remove ns_is_server() staging/lustre/ldlm: Remove server side code from pool support. staging/lustre/ldlm: Remove unused exported symbols. staging/lustre/ldlm: Remove ldlm_namespace_inactive_list() staging/lustre/ldlm: Remove posix lock (flock) deadlock detection staging/lustre/ldlm: Make ldlm_add_ast_work_item() static .../staging/lustre/lustre/include/interval_tree.h | 36 -- drivers/staging/lustre/lustre/include/lustre_dlm.h | 103 +---- drivers/staging/lustre/lustre/include/obd.h | 2 - drivers/staging/lustre/lustre/ldlm/interval_tree.c | 271 -------------- drivers/staging/lustre/lustre/ldlm/l_lock.c | 7 +- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 22 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 269 +------------ drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 36 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 36 -- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 380 ++----------------- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 122 +----- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 416 ++------------------- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 338 +---------------- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 181 +++------ .../staging/lustre/lustre/llite/llite_internal.h | 4 - drivers/staging/lustre/lustre/llite/llite_lib.c | 26 -- drivers/staging/lustre/lustre/llite/namei.c | 28 -- drivers/staging/lustre/lustre/llite/rw.c | 24 -- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 - .../staging/lustre/lustre/lov/lov_cl_internal.h | 3 - drivers/staging/lustre/lustre/lov/lov_internal.h | 2 - drivers/staging/lustre/lustre/lov/lov_object.c | 13 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 20 - drivers/staging/lustre/lustre/lov/lov_pool.c | 22 -- drivers/staging/lustre/lustre/mdc/mdc_request.c | 20 - 25 files changed, 155 insertions(+), 2228 deletions(-) -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:13 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:13 -0400 Subject: [lustre-devel] [PATCH 03/32] staging/lustre: Remove ununused ll_ra_read_get() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-4-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Also ll_ra_read_get_locked that was only used by it. Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/llite/llite_internal.h | 1 - drivers/staging/lustre/lustre/llite/rw.c | 24 ---------------------- 2 files changed, 25 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 59fdbed..d6bdfed 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -657,7 +657,6 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi) void ll_ra_read_in(struct file *f, struct ll_ra_read *rar); void ll_ra_read_ex(struct file *f, struct ll_ra_read *rar); -struct ll_ra_read *ll_ra_read_get(struct file *f); /* llite/lproc_llite.c */ int ldebugfs_register_mountpoint(struct dentry *parent, diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 8c1bfd2..71be194 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -417,30 +417,6 @@ void ll_ra_read_ex(struct file *f, struct ll_ra_read *rar) spin_unlock(&ras->ras_lock); } -static struct ll_ra_read *ll_ra_read_get_locked(struct ll_readahead_state *ras) -{ - struct ll_ra_read *scan; - - list_for_each_entry(scan, &ras->ras_read_beads, lrr_linkage) { - if (scan->lrr_reader == current) - return scan; - } - return NULL; -} - -struct ll_ra_read *ll_ra_read_get(struct file *f) -{ - struct ll_readahead_state *ras; - struct ll_ra_read *bead; - - ras = ll_ras_get(f); - - spin_lock(&ras->ras_lock); - bead = ll_ra_read_get_locked(ras); - spin_unlock(&ras->ras_lock); - return bead; -} - static int cl_read_ahead_page(const struct lu_env *env, struct cl_io *io, struct cl_page_list *queue, struct cl_page *page, struct page *vmpage) -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:14 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:14 -0400 Subject: [lustre-devel] [PATCH 04/32] staging/lustre/llite: Remove unused ll_rmdir_entry() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-5-git-send-email-green@linuxhacker.ru> From: Oleg Drokin The ioctl for this function was removed, but the function was forgotten, so kill it now. Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/llite/llite_internal.h | 1 - drivers/staging/lustre/lustre/llite/namei.c | 28 ---------------------- 2 files changed, 29 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index d6bdfed..4c20b1e 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -687,7 +687,6 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, int ll_md_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *, void *data, int flag); struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de); -int ll_rmdir_entry(struct inode *dir, char *name, int namelen); /* llite/rw.c */ int ll_prepare_write(struct file *, struct page *, unsigned from, unsigned to); diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 2e663ea..a22e252 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -870,34 +870,6 @@ static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) *fid = *ll_inode2fid(d_inode(child)); } -/** - * Remove dir entry - **/ -int ll_rmdir_entry(struct inode *dir, char *name, int namelen) -{ - struct ptlrpc_request *request = NULL; - struct md_op_data *op_data; - int rc; - - CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n", - namelen, name, dir->i_ino, dir->i_generation, dir); - - op_data = ll_prep_md_op_data(NULL, dir, NULL, name, strlen(name), - S_IFDIR, LUSTRE_OPC_ANY, NULL); - if (IS_ERR(op_data)) - return PTR_ERR(op_data); - op_data->op_cli_flags |= CLI_RM_ENTRY; - rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); - ll_finish_md_op_data(op_data); - if (rc == 0) { - ll_update_times(request, dir); - ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR, 1); - } - - ptlrpc_req_finished(request); - return rc; -} - int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) { struct mdt_body *body; -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:17 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:17 -0400 Subject: [lustre-devel] [PATCH 07/32] staging/lustre/ldlm: Remove unused interval tree bits In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-8-git-send-email-green@linuxhacker.ru> From: Oleg Drokin On client side interval-tree code operations are pretty basic, so get rid of the code that is only used on the server to figure out how much to extend the locks and such. Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/include/interval_tree.h | 36 --- drivers/staging/lustre/lustre/ldlm/interval_tree.c | 271 --------------------- 2 files changed, 307 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/interval_tree.h b/drivers/staging/lustre/lustre/include/interval_tree.h index bf9027d..f6df3f3 100644 --- a/drivers/staging/lustre/lustre/include/interval_tree.h +++ b/drivers/staging/lustre/lustre/include/interval_tree.h @@ -67,11 +67,6 @@ static inline int interval_is_intree(struct interval_node *node) return node->in_intree == 1; } -static inline __u64 interval_low(struct interval_node *node) -{ - return node->in_extent.start; -} - static inline __u64 interval_high(struct interval_node *node) { return node->in_extent.end; @@ -86,39 +81,8 @@ static inline void interval_set(struct interval_node *node, node->in_max_high = end; } -/* Rules to write an interval callback. - * - the callback returns INTERVAL_ITER_STOP when it thinks the iteration - * should be stopped. It will then cause the iteration function to return - * immediately with return value INTERVAL_ITER_STOP. - * - callbacks for interval_iterate and interval_iterate_reverse: Every - * nodes in the tree will be set to @node before the callback being called - * - callback for interval_search: Only overlapped node will be set to @node - * before the callback being called. - */ -typedef enum interval_iter (*interval_callback_t)(struct interval_node *node, - void *args); - struct interval_node *interval_insert(struct interval_node *node, struct interval_node **root); void interval_erase(struct interval_node *node, struct interval_node **root); -/* Search the extents in the tree and call @func for each overlapped - * extents. */ -enum interval_iter interval_search(struct interval_node *root, - struct interval_node_extent *ex, - interval_callback_t func, void *data); - -/* Iterate every node in the tree - by reverse order or regular order. */ -enum interval_iter interval_iterate(struct interval_node *root, - interval_callback_t func, void *data); -enum interval_iter interval_iterate_reverse(struct interval_node *root, - interval_callback_t func, void *data); - -void interval_expand(struct interval_node *root, - struct interval_node_extent *ext, - struct interval_node_extent *limiter); -int interval_is_overlapped(struct interval_node *root, - struct interval_node_extent *ex); -struct interval_node *interval_find(struct interval_node *root, - struct interval_node_extent *ex); #endif diff --git a/drivers/staging/lustre/lustre/ldlm/interval_tree.c b/drivers/staging/lustre/lustre/ldlm/interval_tree.c index eab2bd6..3d2d85b 100644 --- a/drivers/staging/lustre/lustre/ldlm/interval_tree.c +++ b/drivers/staging/lustre/lustre/ldlm/interval_tree.c @@ -96,12 +96,6 @@ static inline int extent_equal(struct interval_node_extent *e1, return (e1->start == e2->start) && (e1->end == e2->end); } -static inline int extent_overlapped(struct interval_node_extent *e1, - struct interval_node_extent *e2) -{ - return (e1->start <= e2->end) && (e2->start <= e1->end); -} - static inline int node_compare(struct interval_node *n1, struct interval_node *n2) { @@ -119,19 +113,6 @@ static inline __u64 max_u64(__u64 x, __u64 y) return x > y ? x : y; } -static inline __u64 min_u64(__u64 x, __u64 y) -{ - return x < y ? x : y; -} - -#define interval_for_each(node, root) \ -for (node = interval_first(root); node != NULL; \ - node = interval_next(node)) - -#define interval_for_each_reverse(node, root) \ -for (node = interval_last(root); node != NULL; \ - node = interval_prev(node)) - static struct interval_node *interval_first(struct interval_node *node) { if (!node) @@ -141,15 +122,6 @@ static struct interval_node *interval_first(struct interval_node *node) return node; } -static struct interval_node *interval_last(struct interval_node *node) -{ - if (!node) - return NULL; - while (node->in_right) - node = node->in_right; - return node; -} - static struct interval_node *interval_next(struct interval_node *node) { if (!node) @@ -161,76 +133,6 @@ static struct interval_node *interval_next(struct interval_node *node) return node->in_parent; } -static struct interval_node *interval_prev(struct interval_node *node) -{ - if (!node) - return NULL; - - if (node->in_left) - return interval_last(node->in_left); - - while (node->in_parent && node_is_left_child(node)) - node = node->in_parent; - - return node->in_parent; -} - -enum interval_iter interval_iterate(struct interval_node *root, - interval_callback_t func, - void *data) -{ - struct interval_node *node; - enum interval_iter rc = INTERVAL_ITER_CONT; - - interval_for_each(node, root) { - rc = func(node, data); - if (rc == INTERVAL_ITER_STOP) - break; - } - - return rc; -} -EXPORT_SYMBOL(interval_iterate); - -enum interval_iter interval_iterate_reverse(struct interval_node *root, - interval_callback_t func, - void *data) -{ - struct interval_node *node; - enum interval_iter rc = INTERVAL_ITER_CONT; - - interval_for_each_reverse(node, root) { - rc = func(node, data); - if (rc == INTERVAL_ITER_STOP) - break; - } - - return rc; -} -EXPORT_SYMBOL(interval_iterate_reverse); - -/* try to find a node with same interval in the tree, - * if found, return the pointer to the node, otherwise return NULL*/ -struct interval_node *interval_find(struct interval_node *root, - struct interval_node_extent *ex) -{ - struct interval_node *walk = root; - int rc; - - while (walk) { - rc = extent_compare(ex, &walk->in_extent); - if (rc == 0) - break; - else if (rc < 0) - walk = walk->in_left; - else - walk = walk->in_right; - } - - return walk; -} -EXPORT_SYMBOL(interval_find); - static void __rotate_change_maxhigh(struct interval_node *node, struct interval_node *rotate) { @@ -576,176 +478,3 @@ color: interval_erase_color(child, parent, root); } EXPORT_SYMBOL(interval_erase); - -static inline int interval_may_overlap(struct interval_node *node, - struct interval_node_extent *ext) -{ - return (ext->start <= node->in_max_high && - ext->end >= interval_low(node)); -} - -/* - * This function finds all intervals that overlap interval ext, - * and calls func to handle resulted intervals one by one. - * in lustre, this function will find all conflicting locks in - * the granted queue and add these locks to the ast work list. - * - * { - * if (node == NULL) - * return 0; - * if (ext->end < interval_low(node)) { - * interval_search(node->in_left, ext, func, data); - * } else if (interval_may_overlap(node, ext)) { - * if (extent_overlapped(ext, &node->in_extent)) - * func(node, data); - * interval_search(node->in_left, ext, func, data); - * interval_search(node->in_right, ext, func, data); - * } - * return 0; - * } - * - */ -enum interval_iter interval_search(struct interval_node *node, - struct interval_node_extent *ext, - interval_callback_t func, - void *data) -{ - struct interval_node *parent; - enum interval_iter rc = INTERVAL_ITER_CONT; - - LASSERT(ext != NULL); - LASSERT(func != NULL); - - while (node) { - if (ext->end < interval_low(node)) { - if (node->in_left) { - node = node->in_left; - continue; - } - } else if (interval_may_overlap(node, ext)) { - if (extent_overlapped(ext, &node->in_extent)) { - rc = func(node, data); - if (rc == INTERVAL_ITER_STOP) - break; - } - - if (node->in_left) { - node = node->in_left; - continue; - } - if (node->in_right) { - node = node->in_right; - continue; - } - } - - parent = node->in_parent; - while (parent) { - if (node_is_left_child(node) && - parent->in_right) { - /* If we ever got the left, it means that the - * parent met ext->endin_right; - break; - } - node = parent; - parent = parent->in_parent; - } - if (parent == NULL || !interval_may_overlap(parent, ext)) - break; - } - - return rc; -} -EXPORT_SYMBOL(interval_search); - -static enum interval_iter interval_overlap_cb(struct interval_node *n, - void *args) -{ - *(int *)args = 1; - return INTERVAL_ITER_STOP; -} - -int interval_is_overlapped(struct interval_node *root, - struct interval_node_extent *ext) -{ - int has = 0; - (void)interval_search(root, ext, interval_overlap_cb, &has); - return has; -} -EXPORT_SYMBOL(interval_is_overlapped); - -/* Don't expand to low. Expanding downwards is expensive, and meaningless to - * some extents, because programs seldom do IO backward. - * - * The recursive algorithm of expanding low: - * expand_low { - * struct interval_node *tmp; - * static __u64 res = 0; - * - * if (root == NULL) - * return res; - * if (root->in_max_high < low) { - * res = max_u64(root->in_max_high + 1, res); - * return res; - * } else if (low < interval_low(root)) { - * interval_expand_low(root->in_left, low); - * return res; - * } - * - * if (interval_high(root) < low) - * res = max_u64(interval_high(root) + 1, res); - * interval_expand_low(root->in_left, low); - * interval_expand_low(root->in_right, low); - * - * return res; - * } - * - * It's much easy to eliminate the recursion, see interval_search for - * an example. -jay - */ -static inline __u64 interval_expand_low(struct interval_node *root, __u64 low) -{ - /* we only concern the empty tree right now. */ - if (root == NULL) - return 0; - return low; -} - -static inline __u64 interval_expand_high(struct interval_node *node, __u64 high) -{ - __u64 result = ~0; - - while (node != NULL) { - if (node->in_max_high < high) - break; - - if (interval_low(node) > high) { - result = interval_low(node) - 1; - node = node->in_left; - } else { - node = node->in_right; - } - } - - return result; -} - -/* expanding the extent based on @ext. */ -void interval_expand(struct interval_node *root, - struct interval_node_extent *ext, - struct interval_node_extent *limiter) -{ - /* The assertion of interval_is_overlapped is expensive because we may - * travel many nodes to find the overlapped node. */ - LASSERT(interval_is_overlapped(root, ext) == 0); - if (!limiter || limiter->start < ext->start) - ext->start = interval_expand_low(root, ext->start); - if (!limiter || limiter->end > ext->end) - ext->end = interval_expand_high(root, ext->end); - LASSERT(interval_is_overlapped(root, ext) == 0); -} -EXPORT_SYMBOL(interval_expand); -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:15 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:15 -0400 Subject: [lustre-devel] [PATCH 05/32] staging/lustre/lov: Remove unused lov_dump_lmm/pool() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-6-git-send-email-green@linuxhacker.ru> From: Oleg Drokin These generic switch functions appear to be unused as all the individual ones are called directly. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/lov/lov_internal.h | 2 -- drivers/staging/lustre/lustre/lov/lov_pack.c | 20 -------------------- drivers/staging/lustre/lustre/lov/lov_pool.c | 22 ---------------------- 3 files changed, 44 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index dde9656..0de39cc 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -220,7 +220,6 @@ int lov_free_memmd(struct lov_stripe_md **lsmp); void lov_dump_lmm_v1(int level, struct lov_mds_md_v1 *lmm); void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *lmm); void lov_dump_lmm_common(int level, void *lmmp); -void lov_dump_lmm(int level, void *lmm); /* lov_ea.c */ struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, int *size); @@ -248,7 +247,6 @@ int lov_pool_new(struct obd_device *obd, char *poolname); int lov_pool_del(struct obd_device *obd, char *poolname); int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname); int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname); -void lov_dump_pool(int level, struct pool_desc *pool); struct pool_desc *lov_find_pool(struct lov_obd *lov, char *poolname); int lov_check_index_in_pool(__u32 idx, struct pool_desc *pool); void lov_pool_putref(struct pool_desc *pool); diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 6b1c135..05651ac 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -100,26 +100,6 @@ void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *lmm) le16_to_cpu(lmm->lmm_stripe_count)); } -void lov_dump_lmm(int level, void *lmm) -{ - int magic; - - magic = le32_to_cpu(((struct lov_mds_md *)lmm)->lmm_magic); - switch (magic) { - case LOV_MAGIC_V1: - lov_dump_lmm_v1(level, (struct lov_mds_md_v1 *)lmm); - break; - case LOV_MAGIC_V3: - lov_dump_lmm_v3(level, (struct lov_mds_md_v3 *)lmm); - break; - default: - CDEBUG(level, "unrecognized lmm_magic %x, assuming %x\n", - magic, LOV_MAGIC_V1); - lov_dump_lmm_common(level, lmm); - break; - } -} - /* Pack LOV object metadata for disk storage. It is packed in LE byte * order and is opaque to the networking layer. * diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index c59b140..f996348 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -294,28 +294,6 @@ static struct file_operations pool_proc_operations = { .release = seq_release, }; -void lov_dump_pool(int level, struct pool_desc *pool) -{ - int i; - - lov_pool_getref(pool); - - CDEBUG(level, "pool "LOV_POOLNAMEF" has %d members\n", - pool->pool_name, pool->pool_obds.op_count); - down_read(&pool_tgt_rw_sem(pool)); - - for (i = 0; i < pool_tgt_count(pool) ; i++) { - if (!pool_tgt(pool, i) || !(pool_tgt(pool, i))->ltd_exp) - continue; - CDEBUG(level, "pool "LOV_POOLNAMEF"[%d] = %s\n", - pool->pool_name, i, - obd_uuid2str(&((pool_tgt(pool, i))->ltd_uuid))); - } - - up_read(&pool_tgt_rw_sem(pool)); - lov_pool_putref(pool); -} - #define LOV_POOL_INIT_COUNT 2 int lov_ost_pool_init(struct ost_pool *op, unsigned int count) { -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:18 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:18 -0400 Subject: [lustre-devel] [PATCH 08/32] staging/lustre/ldlm: Remove unused ldlm_cancel_locks_for_exports() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-9-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This is only used on the server in case a client gets disconnected. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 50 ---------------------- 2 files changed, 52 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index fa4b7c7..e870b3e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -164,8 +164,6 @@ void ldlm_lock_add_to_lru(struct ldlm_lock *lock); void ldlm_lock_touch_in_lru(struct ldlm_lock *lock); void ldlm_lock_destroy_nolock(struct ldlm_lock *lock); -void ldlm_cancel_locks_for_export(struct obd_export *export); - /* ldlm_lockd.c */ int ldlm_bl_to_thread_lock(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld, struct ldlm_lock *lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 12eb5ac..b257b89 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -2012,56 +2012,6 @@ struct export_cl_data { }; /** - * Iterator function for ldlm_cancel_locks_for_export. - * Cancels passed locks. - */ -int ldlm_cancel_locks_for_export_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd, - struct hlist_node *hnode, void *data) - -{ - struct export_cl_data *ecl = (struct export_cl_data *)data; - struct obd_export *exp = ecl->ecl_exp; - struct ldlm_lock *lock = cfs_hash_object(hs, hnode); - struct ldlm_resource *res; - - res = ldlm_resource_getref(lock->l_resource); - LDLM_LOCK_GET(lock); - - LDLM_DEBUG(lock, "export %p", exp); - ldlm_res_lvbo_update(res, NULL, 1); - ldlm_lock_cancel(lock); - ldlm_reprocess_all(res); - ldlm_resource_putref(res); - LDLM_LOCK_RELEASE(lock); - - ecl->ecl_loop++; - if ((ecl->ecl_loop & -ecl->ecl_loop) == ecl->ecl_loop) { - CDEBUG(D_INFO, - "Cancel lock %p for export %p (loop %d), still have %d locks left on hash table.\n", - lock, exp, ecl->ecl_loop, - atomic_read(&hs->hs_count)); - } - - return 0; -} - -/** - * Cancel all locks for given export. - * - * Typically called on client disconnection/eviction - */ -void ldlm_cancel_locks_for_export(struct obd_export *exp) -{ - struct export_cl_data ecl = { - .ecl_exp = exp, - .ecl_loop = 0, - }; - - cfs_hash_for_each_empty(exp->exp_lock_hash, - ldlm_cancel_locks_for_export_cb, &ecl); -} - -/** * Downgrade an exclusive lock. * * A fast variant of ldlm_lock_convert for conversion of exclusive -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:19 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:19 -0400 Subject: [lustre-devel] [PATCH 09/32] staging/lustre/ldlm: Remove ldlm_init/destroy_export() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-10-git-send-email-green@linuxhacker.ru> From: Oleg Drokin These functions are used on the server-only, so get rid of them. Also get rid of ldlm export hash operations and the struct. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 - drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 105 --------------------- 2 files changed, 107 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 1ac08e1..03eea32 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1114,8 +1114,6 @@ int ldlm_del_waiting_lock(struct ldlm_lock *lock); int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, int timeout); int ldlm_get_ref(void); void ldlm_put_ref(void); -int ldlm_init_export(struct obd_export *exp); -void ldlm_destroy_export(struct obd_export *exp); struct ldlm_lock *ldlm_request_lock(struct ptlrpc_request *req); /* ldlm_lock.c */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index a78c4a4..57f6128 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -887,111 +887,6 @@ void ldlm_put_ref(void) } EXPORT_SYMBOL(ldlm_put_ref); -/* - * Export handle<->lock hash operations. - */ -static unsigned -ldlm_export_lock_hash(struct cfs_hash *hs, const void *key, unsigned mask) -{ - return cfs_hash_u64_hash(((struct lustre_handle *)key)->cookie, mask); -} - -static void * -ldlm_export_lock_key(struct hlist_node *hnode) -{ - struct ldlm_lock *lock; - - lock = hlist_entry(hnode, struct ldlm_lock, l_exp_hash); - return &lock->l_remote_handle; -} - -static void -ldlm_export_lock_keycpy(struct hlist_node *hnode, void *key) -{ - struct ldlm_lock *lock; - - lock = hlist_entry(hnode, struct ldlm_lock, l_exp_hash); - lock->l_remote_handle = *(struct lustre_handle *)key; -} - -static int -ldlm_export_lock_keycmp(const void *key, struct hlist_node *hnode) -{ - return lustre_handle_equal(ldlm_export_lock_key(hnode), key); -} - -static void * -ldlm_export_lock_object(struct hlist_node *hnode) -{ - return hlist_entry(hnode, struct ldlm_lock, l_exp_hash); -} - -static void -ldlm_export_lock_get(struct cfs_hash *hs, struct hlist_node *hnode) -{ - struct ldlm_lock *lock; - - lock = hlist_entry(hnode, struct ldlm_lock, l_exp_hash); - LDLM_LOCK_GET(lock); -} - -static void -ldlm_export_lock_put(struct cfs_hash *hs, struct hlist_node *hnode) -{ - struct ldlm_lock *lock; - - lock = hlist_entry(hnode, struct ldlm_lock, l_exp_hash); - LDLM_LOCK_RELEASE(lock); -} - -static cfs_hash_ops_t ldlm_export_lock_ops = { - .hs_hash = ldlm_export_lock_hash, - .hs_key = ldlm_export_lock_key, - .hs_keycmp = ldlm_export_lock_keycmp, - .hs_keycpy = ldlm_export_lock_keycpy, - .hs_object = ldlm_export_lock_object, - .hs_get = ldlm_export_lock_get, - .hs_put = ldlm_export_lock_put, - .hs_put_locked = ldlm_export_lock_put, -}; - -int ldlm_init_export(struct obd_export *exp) -{ - int rc; - - exp->exp_lock_hash = - cfs_hash_create(obd_uuid2str(&exp->exp_client_uuid), - HASH_EXP_LOCK_CUR_BITS, - HASH_EXP_LOCK_MAX_BITS, - HASH_EXP_LOCK_BKT_BITS, 0, - CFS_HASH_MIN_THETA, CFS_HASH_MAX_THETA, - &ldlm_export_lock_ops, - CFS_HASH_DEFAULT | CFS_HASH_REHASH_KEY | - CFS_HASH_NBLK_CHANGE); - - if (!exp->exp_lock_hash) - return -ENOMEM; - - rc = ldlm_init_flock_export(exp); - if (rc) - goto err; - - return 0; -err: - ldlm_destroy_export(exp); - return rc; -} -EXPORT_SYMBOL(ldlm_init_export); - -void ldlm_destroy_export(struct obd_export *exp) -{ - cfs_hash_putref(exp->exp_lock_hash); - exp->exp_lock_hash = NULL; - - ldlm_destroy_flock_export(exp); -} -EXPORT_SYMBOL(ldlm_destroy_export); - extern unsigned int ldlm_cancel_unused_locks_before_replay; static ssize_t cancel_unused_locks_before_replay_show(struct kobject *kobj, -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:20 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:20 -0400 Subject: [lustre-devel] [PATCH 10/32] staging/lustre/ldlm: Remove unimplemented lock conversion traces. In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-11-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Lock conversion is not really implemented, so let's stop pretending here. This removes ldlm_lock_convert, ldlm_cli_lock_convert and ldlm_lock_downgrade. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 4 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 119 --------------------- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 101 ----------------- 3 files changed, 224 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 03eea32..bea526b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1228,9 +1228,6 @@ ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, struct lustre_handle *, int unref); ldlm_mode_t ldlm_revalidate_lock_handle(struct lustre_handle *lockh, __u64 *bits); -struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode, - __u32 *flags); -void ldlm_lock_downgrade(struct ldlm_lock *lock, int new_mode); void ldlm_lock_cancel(struct ldlm_lock *lock); void ldlm_reprocess_all(struct ldlm_resource *res); void ldlm_reprocess_all_ns(struct ldlm_namespace *ns); @@ -1332,7 +1329,6 @@ int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, struct lustre_handle *lockh); int ldlm_server_ast(struct lustre_handle *lockh, struct ldlm_lock_desc *new, void *data, __u32 data_len); -int ldlm_cli_convert(struct lustre_handle *, int new_mode, __u32 *flags); int ldlm_cli_update_pool(struct ptlrpc_request *req); int ldlm_cli_cancel(struct lustre_handle *lockh, ldlm_cancel_flags_t cancel_flags); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index b257b89..0597fec 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -2012,125 +2012,6 @@ struct export_cl_data { }; /** - * Downgrade an exclusive lock. - * - * A fast variant of ldlm_lock_convert for conversion of exclusive - * locks. The conversion is always successful. - * Used by Commit on Sharing (COS) code. - * - * \param lock A lock to convert - * \param new_mode new lock mode - */ -void ldlm_lock_downgrade(struct ldlm_lock *lock, int new_mode) -{ - LASSERT(lock->l_granted_mode & (LCK_PW | LCK_EX)); - LASSERT(new_mode == LCK_COS); - - lock_res_and_lock(lock); - ldlm_resource_unlink_lock(lock); - /* - * Remove the lock from pool as it will be added again in - * ldlm_grant_lock() called below. - */ - ldlm_pool_del(&ldlm_lock_to_ns(lock)->ns_pool, lock); - - lock->l_req_mode = new_mode; - ldlm_grant_lock(lock, NULL); - unlock_res_and_lock(lock); - ldlm_reprocess_all(lock->l_resource); -} -EXPORT_SYMBOL(ldlm_lock_downgrade); - -/** - * Attempt to convert already granted lock to a different mode. - * - * While lock conversion is not currently used, future client-side - * optimizations could take advantage of it to avoid discarding cached - * pages on a file. - */ -struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode, - __u32 *flags) -{ - LIST_HEAD(rpc_list); - struct ldlm_resource *res; - struct ldlm_namespace *ns; - int granted = 0; - struct ldlm_interval *node; - - /* Just return if mode is unchanged. */ - if (new_mode == lock->l_granted_mode) { - *flags |= LDLM_FL_BLOCK_GRANTED; - return lock->l_resource; - } - - /* I can't check the type of lock here because the bitlock of lock - * is not held here, so do the allocation blindly. -jay */ - OBD_SLAB_ALLOC_PTR_GFP(node, ldlm_interval_slab, GFP_NOFS); - if (node == NULL) - /* Actually, this causes EDEADLOCK to be returned */ - return NULL; - - LASSERTF((new_mode == LCK_PW && lock->l_granted_mode == LCK_PR), - "new_mode %u, granted %u\n", new_mode, lock->l_granted_mode); - - lock_res_and_lock(lock); - - res = lock->l_resource; - ns = ldlm_res_to_ns(res); - - lock->l_req_mode = new_mode; - if (res->lr_type == LDLM_PLAIN || res->lr_type == LDLM_IBITS) { - ldlm_resource_unlink_lock(lock); - } else { - ldlm_resource_unlink_lock(lock); - if (res->lr_type == LDLM_EXTENT) { - /* FIXME: ugly code, I have to attach the lock to a - * interval node again since perhaps it will be granted - * soon */ - INIT_LIST_HEAD(&node->li_group); - ldlm_interval_attach(node, lock); - node = NULL; - } - } - - /* - * Remove old lock from the pool before adding the lock with new - * mode below in ->policy() - */ - ldlm_pool_del(&ns->ns_pool, lock); - - /* If this is a local resource, put it on the appropriate list. */ - if (ns_is_client(ldlm_res_to_ns(res))) { - if (*flags & (LDLM_FL_BLOCK_CONV | LDLM_FL_BLOCK_GRANTED)) { - ldlm_resource_add_lock(res, &res->lr_converting, lock); - } else { - /* This should never happen, because of the way the - * server handles conversions. */ - LDLM_ERROR(lock, "Erroneous flags %x on local lock\n", - *flags); - LBUG(); - - ldlm_grant_lock(lock, &rpc_list); - granted = 1; - /* FIXME: completion handling not with lr_lock held ! */ - if (lock->l_completion_ast) - lock->l_completion_ast(lock, 0, NULL); - } - } else { - CERROR("This is client-side-only module, cannot handle LDLM_NAMESPACE_SERVER resource type lock.\n"); - LBUG(); - } - unlock_res_and_lock(lock); - - if (granted) - ldlm_run_ast_work(ns, &rpc_list, LDLM_WORK_CP_AST); - if (node) - OBD_SLAB_FREE(node, ldlm_interval_slab, sizeof(*node)); - return res; -} -EXPORT_SYMBOL(ldlm_lock_convert); - -/** * Print lock with lock handle \a lockh description into debug log. * * Used when printing all locks on a resource for debug purposes. diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index f6d61e5..5bd66c3 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -974,107 +974,6 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, } EXPORT_SYMBOL(ldlm_cli_enqueue); -static int ldlm_cli_convert_local(struct ldlm_lock *lock, int new_mode, - __u32 *flags) -{ - struct ldlm_resource *res; - int rc; - - if (ns_is_client(ldlm_lock_to_ns(lock))) { - CERROR("Trying to cancel local lock\n"); - LBUG(); - } - LDLM_DEBUG(lock, "client-side local convert"); - - res = ldlm_lock_convert(lock, new_mode, flags); - if (res) { - ldlm_reprocess_all(res); - rc = 0; - } else { - rc = LUSTRE_EDEADLK; - } - LDLM_DEBUG(lock, "client-side local convert handler END"); - LDLM_LOCK_PUT(lock); - return rc; -} - -/* FIXME: one of ldlm_cli_convert or the server side should reject attempted - * conversion of locks which are on the waiting or converting queue */ -/* Caller of this code is supposed to take care of lock readers/writers - accounting */ -int ldlm_cli_convert(struct lustre_handle *lockh, int new_mode, __u32 *flags) -{ - struct ldlm_request *body; - struct ldlm_reply *reply; - struct ldlm_lock *lock; - struct ldlm_resource *res; - struct ptlrpc_request *req; - int rc; - - lock = ldlm_handle2lock(lockh); - if (!lock) { - LBUG(); - return -EINVAL; - } - *flags = 0; - - if (lock->l_conn_export == NULL) - return ldlm_cli_convert_local(lock, new_mode, flags); - - LDLM_DEBUG(lock, "client-side convert"); - - req = ptlrpc_request_alloc_pack(class_exp2cliimp(lock->l_conn_export), - &RQF_LDLM_CONVERT, LUSTRE_DLM_VERSION, - LDLM_CONVERT); - if (req == NULL) { - LDLM_LOCK_PUT(lock); - return -ENOMEM; - } - - body = req_capsule_client_get(&req->rq_pill, &RMF_DLM_REQ); - body->lock_handle[0] = lock->l_remote_handle; - - body->lock_desc.l_req_mode = new_mode; - body->lock_flags = ldlm_flags_to_wire(*flags); - - - ptlrpc_request_set_replen(req); - rc = ptlrpc_queue_wait(req); - if (rc != ELDLM_OK) - goto out; - - reply = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP); - if (reply == NULL) { - rc = -EPROTO; - goto out; - } - - if (req->rq_status) { - rc = req->rq_status; - goto out; - } - - res = ldlm_lock_convert(lock, new_mode, &reply->lock_flags); - if (res != NULL) { - ldlm_reprocess_all(res); - /* Go to sleep until the lock is granted. */ - /* FIXME: or cancelled. */ - if (lock->l_completion_ast) { - rc = lock->l_completion_ast(lock, LDLM_FL_WAIT_NOREPROC, - NULL); - if (rc) - goto out; - } - } else { - rc = LUSTRE_EDEADLK; - } - out: - LDLM_LOCK_PUT(lock); - ptlrpc_req_finished(req); - return rc; -} -EXPORT_SYMBOL(ldlm_cli_convert); - /** * Cancel locks locally. * Returns: -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:12 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:12 -0400 Subject: [lustre-devel] [PATCH 02/32] staging/lustre: KEY_DEFAULT/MAX_COOKIESIZE key is unused, remove them In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-3-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Also remove the lmv and mdc infrastructure to query these keys. In fact this whole "unlink cookies" thing becomes irrelevant with newer servers, but since we still retain 2.[123] servers commpatibility, we cannot completely remove all traces of it yet. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/obd.h | 2 -- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 -- drivers/staging/lustre/lustre/mdc/mdc_request.c | 20 -------------------- 3 files changed, 24 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 314f5c7..5de9776 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -840,8 +840,6 @@ enum obd_cleanup_stage { #define KEY_LOV_IDX "lov_idx" #define KEY_MAX_EASIZE "max_easize" #define KEY_DEFAULT_EASIZE "default_easize" -#define KEY_MAX_COOKIESIZE "max_cookiesize" -#define KEY_DEFAULT_COOKIESIZE "default_cookiesize" #define KEY_MDS_CONN "mds_conn" #define KEY_MGSSEC "mgssec" #define KEY_NEXT_ID "next_id" diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 8f0ffa4..7e6a060 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2322,8 +2322,6 @@ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp, return -EINVAL; } else if (KEY_IS(KEY_MAX_EASIZE) || KEY_IS(KEY_DEFAULT_EASIZE) || - KEY_IS(KEY_MAX_COOKIESIZE) || - KEY_IS(KEY_DEFAULT_COOKIESIZE) || KEY_IS(KEY_CONN_DATA)) { rc = lmv_check_connect(obd); if (rc) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 8726176..dc234a7 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2124,26 +2124,6 @@ static int mdc_get_info(const struct lu_env *env, struct obd_export *exp, default_easize = val; *default_easize = exp->exp_obd->u.cli.cl_default_mds_easize; return 0; - } else if (KEY_IS(KEY_MAX_COOKIESIZE)) { - int mdsize, *max_cookiesize; - - if (*vallen != sizeof(int)) - return -EINVAL; - mdsize = *(int *)val; - if (mdsize > exp->exp_obd->u.cli.cl_max_mds_cookiesize) - exp->exp_obd->u.cli.cl_max_mds_cookiesize = mdsize; - max_cookiesize = val; - *max_cookiesize = exp->exp_obd->u.cli.cl_max_mds_cookiesize; - return 0; - } else if (KEY_IS(KEY_DEFAULT_COOKIESIZE)) { - int *default_cookiesize; - - if (*vallen != sizeof(int)) - return -EINVAL; - default_cookiesize = val; - *default_cookiesize = - exp->exp_obd->u.cli.cl_default_mds_cookiesize; - return 0; } else if (KEY_IS(KEY_CONN_DATA)) { struct obd_import *imp = class_exp2cliimp(exp); struct obd_connect_data *data = val; -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:26 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:26 -0400 Subject: [lustre-devel] [PATCH 16/32] staging/lustre/ldlm: Remove ldlm_glimpse_ast() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-17-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Only used on the server. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 28 ---------------------- 2 files changed, 29 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 432222b..8b2b092 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1282,7 +1282,6 @@ int ldlm_expired_completion_wait(void *data); int ldlm_blocking_ast_nocheck(struct ldlm_lock *lock); int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, void *data, int flag); -int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp); int ldlm_completion_ast_async(struct ldlm_lock *lock, __u64 flags, void *data); int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data); /** @} ldlm_local_ast */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index c73661c..a9159fd 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -358,34 +358,6 @@ int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, } EXPORT_SYMBOL(ldlm_blocking_ast); -/** - * ->l_glimpse_ast() for DLM extent locks acquired on the server-side. See - * comment in filter_intent_policy() on why you may need this. - */ -int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp) -{ - /* - * Returning -ELDLM_NO_LOCK_DATA actually works, but the reason for - * that is rather subtle: with OST-side locking, it may so happen that - * _all_ extent locks are held by the OST. If client wants to obtain - * current file size it calls ll{,u}_glimpse_size(), and (as locks are - * on the server), dummy glimpse callback fires and does - * nothing. Client still receives correct file size due to the - * following fragment in filter_intent_policy(): - * - * rc = l->l_glimpse_ast(l, NULL); // this will update the LVB - * if (rc != 0 && res->lr_namespace->ns_lvbo && - * res->lr_namespace->ns_lvbo->lvbo_update) { - * res->lr_namespace->ns_lvbo->lvbo_update(res, NULL, 0, 1); - * } - * - * that is, after glimpse_ast() fails, filter_lvbo_update() runs, and - * returns correct file size to the client. - */ - return -ELDLM_NO_LOCK_DATA; -} -EXPORT_SYMBOL(ldlm_glimpse_ast); - static void failed_lock_cleanup(struct ldlm_namespace *ns, struct ldlm_lock *lock, int mode) { -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:27 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:27 -0400 Subject: [lustre-devel] [PATCH 17/32] staging/lustre/ldlm: Remove ldlm_lock_fail_match() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-18-git-send-email-green@linuxhacker.ru> From: Oleg Drokin It's not used anywhere. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 8b2b092..cc5ad4c1 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1216,7 +1216,6 @@ int ldlm_lock_addref_try(struct lustre_handle *lockh, __u32 mode); void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode); void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode); void ldlm_lock_fail_match_locked(struct ldlm_lock *lock); -void ldlm_lock_fail_match(struct ldlm_lock *lock); void ldlm_lock_allow_match(struct ldlm_lock *lock); void ldlm_lock_allow_match_locked(struct ldlm_lock *lock); ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 7f9d3c1..536f97c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1158,14 +1158,6 @@ void ldlm_lock_fail_match_locked(struct ldlm_lock *lock) } EXPORT_SYMBOL(ldlm_lock_fail_match_locked); -void ldlm_lock_fail_match(struct ldlm_lock *lock) -{ - lock_res_and_lock(lock); - ldlm_lock_fail_match_locked(lock); - unlock_res_and_lock(lock); -} -EXPORT_SYMBOL(ldlm_lock_fail_match); - /** * Mark lock as "matchable" by OST. * -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:30 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:30 -0400 Subject: [lustre-devel] [PATCH 20/32] staging/lustre/ldlm: Remove unused ldlm_pool_set_slv() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-21-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 1b5f298..ec717eb 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1402,7 +1402,6 @@ int ldlm_pool_recalc(struct ldlm_pool *pl); __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl); __u64 ldlm_pool_get_slv(struct ldlm_pool *pl); __u32 ldlm_pool_get_limit(struct ldlm_pool *pl); -void ldlm_pool_set_slv(struct ldlm_pool *pl, __u64 slv); void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv); void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit); void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index cbe4b7b..94cdf5f 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1010,19 +1010,6 @@ __u64 ldlm_pool_get_slv(struct ldlm_pool *pl) EXPORT_SYMBOL(ldlm_pool_get_slv); /** - * Sets passed \a slv to \a pl. - * - * \pre ->pl_lock is not locked. - */ -void ldlm_pool_set_slv(struct ldlm_pool *pl, __u64 slv) -{ - spin_lock(&pl->pl_lock); - pl->pl_server_lock_volume = slv; - spin_unlock(&pl->pl_lock); -} -EXPORT_SYMBOL(ldlm_pool_set_slv); - -/** * Sets passed \a clv to \a pl. * * \pre ->pl_lock is not locked. -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:21 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:21 -0400 Subject: [lustre-devel] [PATCH 11/32] staging/lustre/ldlm: Get rid of lr_converting queue In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-12-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Now that we removed all the lock conversion functions, also get rid of the converson queue since nothing could ever get there anyway. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 -- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 10 +--------- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 9 --------- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 12 ------------ 4 files changed, 1 insertion(+), 32 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index bea526b..40377b2 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -883,8 +883,6 @@ struct ldlm_resource { * @{ */ /** List of locks in granted state */ struct list_head lr_granted; - /** List of locks waiting to change their granted mode (converted) */ - struct list_head lr_converting; /** * List of locks that could not be granted due to conflicts and * that are waiting for conflicts to go away */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 0597fec..7f9d3c1 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1260,12 +1260,6 @@ ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, rc = 0; goto out; } - lock = search_queue(&res->lr_converting, &mode, policy, old_lock, - flags, unref); - if (lock != NULL) { - rc = 1; - goto out; - } lock = search_queue(&res->lr_waiting, &mode, policy, old_lock, flags, unref); if (lock != NULL) { @@ -1634,9 +1628,7 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns, * FIXME (bug 268): Detect obvious lies by checking compatibility in * granted/converting queues. */ if (local) { - if (*flags & LDLM_FL_BLOCK_CONV) - ldlm_resource_add_lock(res, &res->lr_converting, lock); - else if (*flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED)) + if (*flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED)) ldlm_resource_add_lock(res, &res->lr_waiting, lock); else ldlm_grant_lock(lock, NULL); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 5bd66c3..760c745 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -1878,15 +1878,6 @@ int ldlm_resource_foreach(struct ldlm_resource *res, ldlm_iterator_t iter, } } - list_for_each_safe(tmp, next, &res->lr_converting) { - lock = list_entry(tmp, struct ldlm_lock, l_res_link); - - if (iter(lock, closure) == LDLM_ITER_STOP) { - rc = LDLM_ITER_STOP; - goto out; - } - } - list_for_each_safe(tmp, next, &res->lr_waiting) { lock = list_entry(tmp, struct ldlm_lock, l_res_link); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index cc212b9..dac2ec2 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -792,7 +792,6 @@ static int ldlm_resource_clean(struct cfs_hash *hs, struct cfs_hash_bd *bd, __u64 flags = *(__u64 *)arg; cleanup_resource(res, &res->lr_granted, flags); - cleanup_resource(res, &res->lr_converting, flags); cleanup_resource(res, &res->lr_waiting, flags); return 0; @@ -1059,7 +1058,6 @@ static struct ldlm_resource *ldlm_resource_new(void) return NULL; INIT_LIST_HEAD(&res->lr_granted); - INIT_LIST_HEAD(&res->lr_converting); INIT_LIST_HEAD(&res->lr_waiting); /* Initialize interval trees for each lock mode. */ @@ -1224,11 +1222,6 @@ static void __ldlm_resource_putref_final(struct cfs_hash_bd *bd, LBUG(); } - if (!list_empty(&res->lr_converting)) { - ldlm_resource_dump(D_ERROR, res); - LBUG(); - } - if (!list_empty(&res->lr_waiting)) { ldlm_resource_dump(D_ERROR, res); LBUG(); @@ -1451,11 +1444,6 @@ void ldlm_resource_dump(int level, struct ldlm_resource *res) } } } - if (!list_empty(&res->lr_converting)) { - CDEBUG(level, "Converting locks:\n"); - list_for_each_entry(lock, &res->lr_converting, l_res_link) - LDLM_DEBUG_LIMIT(level, lock, "###"); - } if (!list_empty(&res->lr_waiting)) { CDEBUG(level, "Waiting locks:\n"); list_for_each_entry(lock, &res->lr_waiting, l_res_link) -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:22 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:22 -0400 Subject: [lustre-devel] [PATCH 12/32] staging/lustre/ldlm: Remove unused ldlm_cli_enqueue_local() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-13-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This is only used on the server. Also while we are at it, remove unused prototypes for ldlm_server_ast and ldlm_handle_enqueue0() that are not defined anywhere Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 15 ----- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 68 ---------------------- 2 files changed, 83 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 40377b2..ce91ccc 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1308,25 +1308,10 @@ int ldlm_prep_elc_req(struct obd_export *exp, struct list_head *cancels, int count); struct ptlrpc_request *ldlm_enqueue_pack(struct obd_export *exp, int lvb_len); -int ldlm_handle_enqueue0(struct ldlm_namespace *ns, struct ptlrpc_request *req, - const struct ldlm_request *dlm_req, - const struct ldlm_callback_suite *cbs); int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, ldlm_type_t type, __u8 with_policy, ldlm_mode_t mode, __u64 *flags, void *lvb, __u32 lvb_len, struct lustre_handle *lockh, int rc); -int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, - const struct ldlm_res_id *res_id, - ldlm_type_t type, ldlm_policy_data_t *policy, - ldlm_mode_t mode, __u64 *flags, - ldlm_blocking_callback blocking, - ldlm_completion_callback completion, - ldlm_glimpse_callback glimpse, - void *data, __u32 lvb_len, enum lvb_type lvb_type, - const __u64 *client_cookie, - struct lustre_handle *lockh); -int ldlm_server_ast(struct lustre_handle *lockh, struct ldlm_lock_desc *new, - void *data, __u32 data_len); int ldlm_cli_update_pool(struct ptlrpc_request *req); int ldlm_cli_cancel(struct lustre_handle *lockh, ldlm_cancel_flags_t cancel_flags); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 760c745..9856133 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -386,74 +386,6 @@ int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp) } EXPORT_SYMBOL(ldlm_glimpse_ast); -/** - * Enqueue a local lock (typically on a server). - */ -int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, - const struct ldlm_res_id *res_id, - ldlm_type_t type, ldlm_policy_data_t *policy, - ldlm_mode_t mode, __u64 *flags, - ldlm_blocking_callback blocking, - ldlm_completion_callback completion, - ldlm_glimpse_callback glimpse, - void *data, __u32 lvb_len, enum lvb_type lvb_type, - const __u64 *client_cookie, - struct lustre_handle *lockh) -{ - struct ldlm_lock *lock; - int err; - const struct ldlm_callback_suite cbs = { .lcs_completion = completion, - .lcs_blocking = blocking, - .lcs_glimpse = glimpse, - }; - - LASSERT(!(*flags & LDLM_FL_REPLAY)); - if (unlikely(ns_is_client(ns))) { - CERROR("Trying to enqueue local lock in a shadow namespace\n"); - LBUG(); - } - - lock = ldlm_lock_create(ns, res_id, type, mode, &cbs, data, lvb_len, - lvb_type); - if (unlikely(!lock)) { - err = -ENOMEM; - goto out_nolock; - } - - ldlm_lock2handle(lock, lockh); - - /* NB: we don't have any lock now (lock_res_and_lock) - * because it's a new lock */ - ldlm_lock_addref_internal_nolock(lock, mode); - lock->l_flags |= LDLM_FL_LOCAL; - if (*flags & LDLM_FL_ATOMIC_CB) - lock->l_flags |= LDLM_FL_ATOMIC_CB; - - if (policy != NULL) - lock->l_policy_data = *policy; - if (client_cookie != NULL) - lock->l_client_cookie = *client_cookie; - if (type == LDLM_EXTENT) - lock->l_req_extent = policy->l_extent; - - err = ldlm_lock_enqueue(ns, &lock, policy, flags); - if (unlikely(err != ELDLM_OK)) - goto out; - - if (policy != NULL) - *policy = lock->l_policy_data; - - if (lock->l_completion_ast) - lock->l_completion_ast(lock, *flags, NULL); - - LDLM_DEBUG(lock, "client-side local enqueue handler, new lock created"); - out: - LDLM_LOCK_RELEASE(lock); - out_nolock: - return err; -} -EXPORT_SYMBOL(ldlm_cli_enqueue_local); - static void failed_lock_cleanup(struct ldlm_namespace *ns, struct ldlm_lock *lock, int mode) { -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:23 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:23 -0400 Subject: [lustre-devel] [PATCH 13/32] staging/lustre/ldlm: Remove unused ldlm_init/fini_flock_export In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-14-git-send-email-green@linuxhacker.ru> From: Oleg Drokin And all supporting export infrastructure. There's no use for it all on client. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 102 --------------------- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 - 2 files changed, 104 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index ab670fc..bb8ecc8 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -755,105 +755,3 @@ void ldlm_flock_policy_local_to_wire(const ldlm_policy_data_t *lpolicy, wpolicy->l_flock.lfw_pid = lpolicy->l_flock.pid; wpolicy->l_flock.lfw_owner = lpolicy->l_flock.owner; } - -/* - * Export handle<->flock hash operations. - */ -static unsigned -ldlm_export_flock_hash(struct cfs_hash *hs, const void *key, unsigned mask) -{ - return cfs_hash_u64_hash(*(__u64 *)key, mask); -} - -static void * -ldlm_export_flock_key(struct hlist_node *hnode) -{ - struct ldlm_lock *lock; - - lock = hlist_entry(hnode, struct ldlm_lock, l_exp_flock_hash); - return &lock->l_policy_data.l_flock.owner; -} - -static int -ldlm_export_flock_keycmp(const void *key, struct hlist_node *hnode) -{ - return !memcmp(ldlm_export_flock_key(hnode), key, sizeof(__u64)); -} - -static void * -ldlm_export_flock_object(struct hlist_node *hnode) -{ - return hlist_entry(hnode, struct ldlm_lock, l_exp_flock_hash); -} - -static void -ldlm_export_flock_get(struct cfs_hash *hs, struct hlist_node *hnode) -{ - struct ldlm_lock *lock; - struct ldlm_flock *flock; - - lock = hlist_entry(hnode, struct ldlm_lock, l_exp_flock_hash); - LDLM_LOCK_GET(lock); - - flock = &lock->l_policy_data.l_flock; - LASSERT(flock->blocking_export != NULL); - class_export_get(flock->blocking_export); - flock->blocking_refs++; -} - -static void -ldlm_export_flock_put(struct cfs_hash *hs, struct hlist_node *hnode) -{ - struct ldlm_lock *lock; - struct ldlm_flock *flock; - - lock = hlist_entry(hnode, struct ldlm_lock, l_exp_flock_hash); - LDLM_LOCK_RELEASE(lock); - - flock = &lock->l_policy_data.l_flock; - LASSERT(flock->blocking_export != NULL); - class_export_put(flock->blocking_export); - if (--flock->blocking_refs == 0) { - flock->blocking_owner = 0; - flock->blocking_export = NULL; - } -} - -static cfs_hash_ops_t ldlm_export_flock_ops = { - .hs_hash = ldlm_export_flock_hash, - .hs_key = ldlm_export_flock_key, - .hs_keycmp = ldlm_export_flock_keycmp, - .hs_object = ldlm_export_flock_object, - .hs_get = ldlm_export_flock_get, - .hs_put = ldlm_export_flock_put, - .hs_put_locked = ldlm_export_flock_put, -}; - -int ldlm_init_flock_export(struct obd_export *exp) -{ - if (strcmp(exp->exp_obd->obd_type->typ_name, LUSTRE_MDT_NAME) != 0) - return 0; - - exp->exp_flock_hash = - cfs_hash_create(obd_uuid2str(&exp->exp_client_uuid), - HASH_EXP_LOCK_CUR_BITS, - HASH_EXP_LOCK_MAX_BITS, - HASH_EXP_LOCK_BKT_BITS, 0, - CFS_HASH_MIN_THETA, CFS_HASH_MAX_THETA, - &ldlm_export_flock_ops, - CFS_HASH_DEFAULT | CFS_HASH_NBLK_CHANGE); - if (!exp->exp_flock_hash) - return -ENOMEM; - - return 0; -} -EXPORT_SYMBOL(ldlm_init_flock_export); - -void ldlm_destroy_flock_export(struct obd_export *exp) -{ - if (exp->exp_flock_hash) { - cfs_hash_putref(exp->exp_flock_hash); - exp->exp_flock_hash = NULL; - } -} -EXPORT_SYMBOL(ldlm_destroy_flock_export); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index e870b3e..1293f13 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -188,8 +188,6 @@ void ldlm_extent_unlink_lock(struct ldlm_lock *lock); int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, int first_enq, ldlm_error_t *err, struct list_head *work_list); -int ldlm_init_flock_export(struct obd_export *exp); -void ldlm_destroy_flock_export(struct obd_export *exp); /* l_lock.c */ void l_check_ns_lock(struct ldlm_namespace *ns); -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:29 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:29 -0400 Subject: [lustre-devel] [PATCH 19/32] staging/lustre/ldlm: Remove unused ldlm_pool_get_clv() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-20-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 4d81e73..1b5f298 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1401,7 +1401,6 @@ int ldlm_pool_setup(struct ldlm_pool *pl, int limit); int ldlm_pool_recalc(struct ldlm_pool *pl); __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl); __u64 ldlm_pool_get_slv(struct ldlm_pool *pl); -__u64 ldlm_pool_get_clv(struct ldlm_pool *pl); __u32 ldlm_pool_get_limit(struct ldlm_pool *pl); void ldlm_pool_set_slv(struct ldlm_pool *pl, __u64 slv); void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 1c9d67f..cbe4b7b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -1023,22 +1023,6 @@ void ldlm_pool_set_slv(struct ldlm_pool *pl, __u64 slv) EXPORT_SYMBOL(ldlm_pool_set_slv); /** - * Returns current \a pl CLV. - * - * \pre ->pl_lock is not locked. - */ -__u64 ldlm_pool_get_clv(struct ldlm_pool *pl) -{ - __u64 slv; - - spin_lock(&pl->pl_lock); - slv = pl->pl_client_lock_volume; - spin_unlock(&pl->pl_lock); - return slv; -} -EXPORT_SYMBOL(ldlm_pool_get_clv); - -/** * Sets passed \a clv to \a pl. * * \pre ->pl_lock is not locked. -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:24 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:24 -0400 Subject: [lustre-devel] [PATCH 14/32] staging/lustre/ldlm: Remove unused ldlm_enqueue_pack() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-15-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Not used anywhere Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 21 --------------------- 2 files changed, 22 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index ce91ccc..72c52ef 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1307,7 +1307,6 @@ int ldlm_prep_elc_req(struct obd_export *exp, int version, int opc, int canceloff, struct list_head *cancels, int count); -struct ptlrpc_request *ldlm_enqueue_pack(struct obd_export *exp, int lvb_len); int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, ldlm_type_t type, __u8 with_policy, ldlm_mode_t mode, __u64 *flags, void *lvb, __u32 lvb_len, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 9856133..c73661c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -742,27 +742,6 @@ int ldlm_prep_enqueue_req(struct obd_export *exp, struct ptlrpc_request *req, } EXPORT_SYMBOL(ldlm_prep_enqueue_req); -struct ptlrpc_request *ldlm_enqueue_pack(struct obd_export *exp, int lvb_len) -{ - struct ptlrpc_request *req; - int rc; - - req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_LDLM_ENQUEUE); - if (req == NULL) - return ERR_PTR(-ENOMEM); - - rc = ldlm_prep_enqueue_req(exp, req, NULL, 0); - if (rc) { - ptlrpc_request_free(req); - return ERR_PTR(rc); - } - - req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, lvb_len); - ptlrpc_request_set_replen(req); - return req; -} -EXPORT_SYMBOL(ldlm_enqueue_pack); - /** * Client-side lock enqueue. * -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:28 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:28 -0400 Subject: [lustre-devel] [PATCH 18/32] staging/lustre/ldlm: Remove ldlm_namespace_free() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-19-git-send-email-green@linuxhacker.ru> From: Oleg Drokin It was directly used only on the server. Client side part was split into smaller chunks to avoid deadlocks. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 -- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 27 ---------------------- 2 files changed, 29 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index cc5ad4c1..4d81e73 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1236,8 +1236,6 @@ ldlm_namespace_new(struct obd_device *obd, char *name, ldlm_side_t client, ldlm_appetite_t apt, ldlm_ns_type_t ns_type); int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags); -void ldlm_namespace_free(struct ldlm_namespace *ns, - struct obd_import *imp, int force); void ldlm_namespace_register(struct ldlm_namespace *ns, ldlm_side_t client); void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client); void ldlm_namespace_get(struct ldlm_namespace *ns); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index dac2ec2..cd65efe 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -948,33 +948,6 @@ void ldlm_namespace_free_post(struct ldlm_namespace *ns) ldlm_put_ref(); } -/** - * Cleanup the resource, and free namespace. - * bug 12864: - * Deadlock issue: - * proc1: destroy import - * class_disconnect_export(grab cl_sem) -> - * -> ldlm_namespace_free -> - * -> ldebugfs_remove(grab _lprocfs_lock). - * proc2: read proc info - * lprocfs_fops_read(grab _lprocfs_lock) -> - * -> osc_rd_active, etc(grab cl_sem). - * - * So that I have to split the ldlm_namespace_free into two parts - the first - * part ldlm_namespace_free_prior is used to cleanup the resource which is - * being used; the 2nd part ldlm_namespace_free_post is used to unregister the - * lprocfs entries, and then free memory. It will be called w/o cli->cl_sem - * held. - */ -void ldlm_namespace_free(struct ldlm_namespace *ns, - struct obd_import *imp, - int force) -{ - ldlm_namespace_free_prior(ns, imp, force); - ldlm_namespace_free_post(ns); -} -EXPORT_SYMBOL(ldlm_namespace_free); - void ldlm_namespace_get(struct ldlm_namespace *ns) { atomic_inc(&ns->ns_bref); -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:31 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:31 -0400 Subject: [lustre-devel] [PATCH 21/32] staging/lustre/ldlm: Remove ldlm_refresh/del_waiting_lock() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-22-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Nothing adds locks into waiting list on the client, so no point in retaining those. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 -- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 8 -------- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 13 ------------- 3 files changed, 23 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index ec717eb..5a72f22 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1108,8 +1108,6 @@ struct ldlm_callback_suite { }; /* ldlm_lockd.c */ -int ldlm_del_waiting_lock(struct ldlm_lock *lock); -int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, int timeout); int ldlm_get_ref(void); void ldlm_put_ref(void); struct ldlm_lock *ldlm_request_lock(struct ptlrpc_request *req); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 536f97c..133936e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1947,17 +1947,9 @@ void ldlm_lock_cancel(struct ldlm_lock *lock) LBUG(); } - if (lock->l_flags & LDLM_FL_WAITED) - ldlm_del_waiting_lock(lock); - /* Releases cancel callback. */ ldlm_cancel_callback(lock); - /* Yes, second time, just in case it was added again while we were - * running with no res lock in ldlm_cancel_callback */ - if (lock->l_flags & LDLM_FL_WAITED) - ldlm_del_waiting_lock(lock); - ldlm_resource_unlink_lock(lock); ldlm_lock_destroy_nolock(lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index 57f6128..045e3c6 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -111,19 +111,6 @@ struct ldlm_bl_work_item { int blwi_mem_pressure; }; - -int ldlm_del_waiting_lock(struct ldlm_lock *lock) -{ - return 0; -} - -int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, int timeout) -{ - return 0; -} - - - /** * Callback handler for receiving incoming blocking ASTs. * -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:25 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:25 -0400 Subject: [lustre-devel] [PATCH 15/32] staging/lustre/ldlm: Remove ldlm_errno2error() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-16-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This particular incarnation is only used on the server. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 3 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 36 ---------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 72c52ef..432222b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1161,8 +1161,7 @@ static inline int ldlm_res_lvbo_update(struct ldlm_resource *res, } int ldlm_error2errno(ldlm_error_t error); -ldlm_error_t ldlm_errno2error(int err_no); /* don't call it `errno': this - * confuses user-space. */ + #if LUSTRE_TRACKS_LOCK_EXP_REFS void ldlm_dump_export_locks(struct obd_export *exp); #endif diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 584c4e6..b840200 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -814,42 +814,6 @@ int ldlm_error2errno(ldlm_error_t error) } EXPORT_SYMBOL(ldlm_error2errno); -/** - * Dual to ldlm_error2errno(): maps errno values back to ldlm_error_t. - */ -ldlm_error_t ldlm_errno2error(int err_no) -{ - int error; - - switch (err_no) { - case 0: - error = ELDLM_OK; - break; - case -ESTALE: - error = ELDLM_LOCK_CHANGED; - break; - case -ENAVAIL: - error = ELDLM_LOCK_ABORTED; - break; - case -ESRCH: - error = ELDLM_LOCK_REPLACED; - break; - case -ENOENT: - error = ELDLM_NO_LOCK_DATA; - break; - case -EEXIST: - error = ELDLM_NAMESPACE_EXISTS; - break; - case -EBADF: - error = ELDLM_BAD_NAMESPACE; - break; - default: - error = err_no; - } - return error; -} -EXPORT_SYMBOL(ldlm_errno2error); - #if LUSTRE_TRACKS_LOCK_EXP_REFS void ldlm_dump_export_locks(struct obd_export *exp) { -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:33 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:33 -0400 Subject: [lustre-devel] [PATCH 23/32] staging/lustre/ldlm: Remove unused ldlm_reprocess_all*() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-24-git-send-email-green@linuxhacker.ru> From: Oleg Drokin They are only used on the server. Also remove helper functions and cleanup callsites. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 - drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 48 ---------------------- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 4 -- 4 files changed, 55 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index c0b2c61..9608373 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1215,8 +1215,6 @@ ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, ldlm_mode_t ldlm_revalidate_lock_handle(struct lustre_handle *lockh, __u64 *bits); void ldlm_lock_cancel(struct ldlm_lock *lock); -void ldlm_reprocess_all(struct ldlm_resource *res); -void ldlm_reprocess_all_ns(struct ldlm_namespace *ns); void ldlm_lock_dump_handle(int level, struct lustre_handle *); void ldlm_unlink_lock_skiplist(struct ldlm_lock *req); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index bb8ecc8..14e6782 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -523,7 +523,6 @@ reprocess: /* At this point we're granting the lock request. */ req->l_granted_mode = req->l_req_mode; - /* Add req to the granted queue before calling ldlm_reprocess_all(). */ if (!added) { list_del_init(&req->l_res_link); /* insert new lock before ownlocks in list. */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 5a07669..e586d33 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1786,54 +1786,6 @@ out: return rc; } -static int reprocess_one_queue(struct ldlm_resource *res, void *closure) -{ - ldlm_reprocess_all(res); - return LDLM_ITER_CONTINUE; -} - -static int ldlm_reprocess_res(struct cfs_hash *hs, struct cfs_hash_bd *bd, - struct hlist_node *hnode, void *arg) -{ - struct ldlm_resource *res = cfs_hash_object(hs, hnode); - int rc; - - rc = reprocess_one_queue(res, arg); - - return rc == LDLM_ITER_STOP; -} - -/** - * Iterate through all resources on a namespace attempting to grant waiting - * locks. - */ -void ldlm_reprocess_all_ns(struct ldlm_namespace *ns) -{ - if (ns != NULL) { - cfs_hash_for_each_nolock(ns->ns_rs_hash, - ldlm_reprocess_res, NULL); - } -} -EXPORT_SYMBOL(ldlm_reprocess_all_ns); - -/** - * Try to grant all waiting locks on a resource. - * - * Calls ldlm_reprocess_queue on converting and waiting queues. - * - * Typically called after some resource locks are cancelled to see - * if anything could be granted as a result of the cancellation. - */ -void ldlm_reprocess_all(struct ldlm_resource *res) -{ - LIST_HEAD(rpc_list); - - if (!ns_is_client(ldlm_res_to_ns(res))) { - CERROR("This is client-side-only module, cannot handle LDLM_NAMESPACE_SERVER resource type lock.\n"); - LBUG(); - } -} - /** * Helper function to call blocking AST for LDLM lock \a lock in a * "cancelling" mode. diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index a9159fd..15e1980 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -188,7 +188,6 @@ int ldlm_completion_ast_async(struct ldlm_lock *lock, __u64 flags, void *data) } LDLM_DEBUG(lock, "client-side enqueue returned a blocked lock, going forward"); - ldlm_reprocess_all(lock->l_resource); return 0; } EXPORT_SYMBOL(ldlm_completion_ast_async); @@ -892,9 +891,6 @@ static __u64 ldlm_cli_cancel_local(struct ldlm_lock *lock) LDLM_ERROR(lock, "Trying to cancel local lock"); LBUG(); } - LDLM_DEBUG(lock, "server-side local cancel"); - ldlm_lock_cancel(lock); - ldlm_reprocess_all(lock->l_resource); } return rc; -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:37 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:37 -0400 Subject: [lustre-devel] [PATCH 27/32] staging/lustre: Remove ns_is_server() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-28-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Since the code we have is Lustre-client only, this function always returns 0, so drop it and amend all the callsites to drop dead code. One of the places also sets LDLM_FL_NS_SRV to indicate a lock is in a server namespace. This too cannot happen in this code, so drop all such checks as well. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 13 ------------- drivers/staging/lustre/lustre/ldlm/l_lock.c | 7 ++----- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 14 -------------- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 16 ++-------------- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 1e40203..49b5a07 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -465,19 +465,6 @@ struct ldlm_namespace { }; /** - * Returns 1 if namespace \a ns is a server namespace. - */ -static inline int ns_is_server(struct ldlm_namespace *ns) -{ - LASSERT(ns != NULL); - LASSERT(!(ns->ns_client & ~(LDLM_NAMESPACE_CLIENT | - LDLM_NAMESPACE_SERVER))); - LASSERT(ns->ns_client == LDLM_NAMESPACE_CLIENT || - ns->ns_client == LDLM_NAMESPACE_SERVER); - return ns->ns_client == LDLM_NAMESPACE_SERVER; -} - -/** * Returns 1 if namespace \a ns supports early lock cancel (ELC). */ static inline int ns_connect_cancelset(struct ldlm_namespace *ns) diff --git a/drivers/staging/lustre/lustre/ldlm/l_lock.c b/drivers/staging/lustre/lustre/ldlm/l_lock.c index cd8ab40..e5d1344 100644 --- a/drivers/staging/lustre/lustre/ldlm/l_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/l_lock.c @@ -50,9 +50,7 @@ */ struct ldlm_resource *lock_res_and_lock(struct ldlm_lock *lock) { - /* on server-side resource of lock doesn't change */ - if ((lock->l_flags & LDLM_FL_NS_SRV) == 0) - spin_lock(&lock->l_lock); + spin_lock(&lock->l_lock); lock_res(lock->l_resource); @@ -70,7 +68,6 @@ void unlock_res_and_lock(struct ldlm_lock *lock) lock->l_flags &= ~LDLM_FL_RES_LOCKED; unlock_res(lock->l_resource); - if ((lock->l_flags & LDLM_FL_NS_SRV) == 0) - spin_unlock(&lock->l_lock); + spin_unlock(&lock->l_lock); } EXPORT_SYMBOL(unlock_res_and_lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 6d5e7af..827e5df 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -237,11 +237,6 @@ int ldlm_lock_remove_from_lru(struct ldlm_lock *lock) struct ldlm_namespace *ns = ldlm_lock_to_ns(lock); int rc; - if (lock->l_flags & LDLM_FL_NS_SRV) { - LASSERT(list_empty(&lock->l_lru)); - return 0; - } - spin_lock(&ns->ns_lock); rc = ldlm_lock_remove_from_lru_nolock(lock); spin_unlock(&ns->ns_lock); @@ -286,11 +281,6 @@ void ldlm_lock_touch_in_lru(struct ldlm_lock *lock) { struct ldlm_namespace *ns = ldlm_lock_to_ns(lock); - if (lock->l_flags & LDLM_FL_NS_SRV) { - LASSERT(list_empty(&lock->l_lru)); - return; - } - spin_lock(&ns->ns_lock); if (!list_empty(&lock->l_lru)) { ldlm_lock_remove_from_lru_nolock(lock); @@ -799,8 +789,6 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) (lock->l_flags & LDLM_FL_CBPENDING)) { /* If we received a blocked AST and this was the last reference, * run the callback. */ - if ((lock->l_flags & LDLM_FL_NS_SRV) && lock->l_export) - CERROR("FL_CBPENDING set on non-local lock--just a warning\n"); LDLM_DEBUG(lock, "final decref done on cbpending lock"); @@ -1486,8 +1474,6 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, lock->l_req_mode = mode; lock->l_ast_data = data; lock->l_pid = current_pid(); - if (ns_is_server(ns)) - lock->l_flags |= LDLM_FL_NS_SRV; if (cbs) { lock->l_blocking_ast = cbs->lcs_blocking; lock->l_completion_ast = cbs->lcs_completion; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 94cdf5f..dac1b6f 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -656,8 +656,8 @@ EXPORT_SYMBOL(ldlm_pool_setup); static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) { - int granted, grant_rate, cancel_rate, grant_step; - int grant_speed, grant_plan, lvf; + int granted, grant_rate, cancel_rate; + int grant_speed, lvf; struct ldlm_pool *pl = m->private; __u64 slv, clv; __u32 limit; @@ -666,13 +666,11 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) slv = pl->pl_server_lock_volume; clv = pl->pl_client_lock_volume; limit = ldlm_pool_get_limit(pl); - grant_plan = pl->pl_grant_plan; granted = atomic_read(&pl->pl_granted); grant_rate = atomic_read(&pl->pl_grant_rate); cancel_rate = atomic_read(&pl->pl_cancel_rate); grant_speed = grant_rate - cancel_rate; lvf = atomic_read(&pl->pl_lock_volume_factor); - grant_step = ldlm_pool_t2gsp(pl->pl_recalc_period); spin_unlock(&pl->pl_lock); seq_printf(m, "LDLM pool state (%s):\n" @@ -681,11 +679,6 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) " LVF: %d\n", pl->pl_name, slv, clv, lvf); - if (ns_is_server(ldlm_pl2ns(pl))) { - seq_printf(m, " GSP: %d%%\n" - " GP: %d\n", - grant_step, grant_plan); - } seq_printf(m, " GR: %d\n CR: %d\n GS: %d\n" " G: %d\n L: %d\n", grant_rate, cancel_rate, grant_speed, @@ -966,8 +959,6 @@ void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock) * enqueue/cancel rpc. Also we do not want to run out of stack * with too long call paths. */ - if (ns_is_server(ldlm_pl2ns(pl))) - ldlm_pool_recalc(pl); } EXPORT_SYMBOL(ldlm_pool_add); @@ -987,9 +978,6 @@ void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock) atomic_inc(&pl->pl_cancel_rate); lprocfs_counter_incr(pl->pl_stats, LDLM_POOL_CANCEL_STAT); - - if (ns_is_server(ldlm_pl2ns(pl))) - ldlm_pool_recalc(pl); } EXPORT_SYMBOL(ldlm_pool_del); -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:39 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:39 -0400 Subject: [lustre-devel] [PATCH 29/32] staging/lustre/ldlm: Remove unused exported symbols. In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-30-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This rather large patch prunes all unused EXPORT_SYMBOLS and marks functions only used locally as static lustre ldlm module. The only two remaining nonstatic functions that should be static now are: ldlm_cancel_lru_local ldlm_resource_putref_locked But some bigger code shuffling around is needed to achieve that, so it's left for a future patch. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 26 ------- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 22 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 6 +- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 21 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 30 ++++---- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 43 +++++------- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 28 ++++---- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 82 +++++++++++----------- 9 files changed, 111 insertions(+), 151 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 3cca07e..dfc49e1 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -60,9 +60,6 @@ struct obd_ops; struct obd_device; -extern struct kset *ldlm_ns_kset; -extern struct kset *ldlm_svc_kset; - #define OBD_LDLM_DEVICENAME "ldlm" #define LDLM_DEFAULT_LRU_SIZE (100 * num_online_cpus()) @@ -561,9 +558,6 @@ typedef union { struct ldlm_inodebits l_inodebits; } ldlm_policy_data_t; -void ldlm_convert_policy_to_wire(ldlm_type_t type, - const ldlm_policy_data_t *lpolicy, - ldlm_wire_policy_data_t *wpolicy); void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type, const ldlm_wire_policy_data_t *wpolicy, ldlm_policy_data_t *lpolicy); @@ -980,7 +974,6 @@ struct ldlm_enqueue_info { extern struct obd_ops ldlm_obd_ops; extern char *ldlm_lockname[]; -extern char *ldlm_typename[]; char *ldlm_it2str(int it); /** @@ -1051,10 +1044,6 @@ typedef int (*ldlm_res_iterator_t)(struct ldlm_resource *, void *); * LDLM provides for a way to iterate through every lock on a resource or * namespace or every resource in a namespace. * @{ */ -int ldlm_resource_foreach(struct ldlm_resource *res, ldlm_iterator_t iter, - void *closure); -void ldlm_namespace_foreach(struct ldlm_namespace *ns, ldlm_iterator_t iter, - void *closure); int ldlm_resource_iterate(struct ldlm_namespace *, const struct ldlm_res_id *, ldlm_iterator_t iter, void *data); /** @} ldlm_iterator */ @@ -1172,7 +1161,6 @@ do { \ struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock); void ldlm_lock_put(struct ldlm_lock *lock); -void ldlm_lock_destroy(struct ldlm_lock *lock); void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc); void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode); int ldlm_lock_addref_try(struct lustre_handle *lockh, __u32 mode); @@ -1197,8 +1185,6 @@ ldlm_namespace_new(struct obd_device *obd, char *name, ldlm_side_t client, ldlm_appetite_t apt, ldlm_ns_type_t ns_type); int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags); -void ldlm_namespace_register(struct ldlm_namespace *ns, ldlm_side_t client); -void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client); void ldlm_namespace_get(struct ldlm_namespace *ns); void ldlm_namespace_put(struct ldlm_namespace *ns); int ldlm_debugfs_setup(void); @@ -1209,7 +1195,6 @@ struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, const struct ldlm_res_id *, ldlm_type_t type, int create); -struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res); int ldlm_resource_putref(struct ldlm_resource *res); void ldlm_resource_add_lock(struct ldlm_resource *res, struct list_head *head, @@ -1231,7 +1216,6 @@ int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *, } while (0) /* ldlm_request.c */ -int ldlm_expired_completion_wait(void *data); /** \defgroup ldlm_local_ast Default AST handlers for local locks * These AST handlers are typically used for server-side local locks and are * also used by client-side lock handlers to perform minimum level base @@ -1275,8 +1259,6 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns, ldlm_mode_t mode, ldlm_cancel_flags_t flags, void *opaque); -int ldlm_cli_cancel_req(struct obd_export *exp, struct list_head *head, - int count, ldlm_cancel_flags_t flags); int ldlm_cancel_resource_local(struct ldlm_resource *res, struct list_head *cancels, ldlm_policy_data_t *policy, @@ -1351,15 +1333,7 @@ void ldlm_pools_fini(void); int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, int idx, ldlm_side_t client); -int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, - gfp_t gfp_mask); void ldlm_pool_fini(struct ldlm_pool *pl); -int ldlm_pool_recalc(struct ldlm_pool *pl); -__u32 ldlm_pool_get_lvf(struct ldlm_pool *pl); -__u64 ldlm_pool_get_slv(struct ldlm_pool *pl); -__u32 ldlm_pool_get_limit(struct ldlm_pool *pl); -void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv); -void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit); void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock); void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock); /** @} */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index fd9b059..05bc4f3 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -97,6 +97,17 @@ __u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms) EXPORT_SYMBOL(ldlm_extent_shift_kms); struct kmem_cache *ldlm_interval_slab; + +/* interval tree, for LDLM_EXTENT. */ +static void ldlm_interval_attach(struct ldlm_interval *n, struct ldlm_lock *l) +{ + LASSERT(!l->l_tree_node); + LASSERT(l->l_resource->lr_type == LDLM_EXTENT); + + list_add_tail(&l->l_sl_policy, &n->li_group); + l->l_tree_node = n; +} + struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock) { struct ldlm_interval *node; @@ -120,17 +131,6 @@ void ldlm_interval_free(struct ldlm_interval *node) } } -/* interval tree, for LDLM_EXTENT. */ -void ldlm_interval_attach(struct ldlm_interval *n, - struct ldlm_lock *l) -{ - LASSERT(l->l_tree_node == NULL); - LASSERT(l->l_resource->lr_type == LDLM_EXTENT); - - list_add_tail(&l->l_sl_policy, &n->li_group); - l->l_tree_node = n; -} - struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l) { struct ldlm_interval *n = l->l_tree_node; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index 7241c34..57b4edb 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -239,9 +239,9 @@ static void ldlm_flock_cancel_on_deadlock(struct ldlm_lock *lock, * - blocking ASTs have not been sent yet, so list of conflicting locks * would be collected and ASTs sent. */ -int -ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, int first_enq, - ldlm_error_t *err, struct list_head *work_list) +static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, + int first_enq, ldlm_error_t *err, + struct list_head *work_list) { struct ldlm_resource *res = req->l_resource; struct ldlm_namespace *ns = ldlm_res_to_ns(res); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 56805d0..e63a1c9 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -109,10 +109,9 @@ enum { int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr, ldlm_cancel_flags_t sync, int flags); int ldlm_cancel_lru_local(struct ldlm_namespace *ns, - struct list_head *cancels, int count, int max, - ldlm_cancel_flags_t cancel_flags, int flags); + struct list_head *cancels, int count, int max, + ldlm_cancel_flags_t cancel_flags, int flags); extern int ldlm_enqueue_min; -int ldlm_get_enq_timeout(struct ldlm_lock *lock); /* ldlm_resource.c */ int ldlm_resource_putref_locked(struct ldlm_resource *res); @@ -154,12 +153,8 @@ void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, struct list_head *work_list); int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list, enum ldlm_desc_ast_t ast_type); -int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq); int ldlm_lock_remove_from_lru(struct ldlm_lock *lock); int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock); -void ldlm_lock_add_to_lru_nolock(struct ldlm_lock *lock); -void ldlm_lock_add_to_lru(struct ldlm_lock *lock); -void ldlm_lock_touch_in_lru(struct ldlm_lock *lock); void ldlm_lock_destroy_nolock(struct ldlm_lock *lock); /* ldlm_lockd.c */ @@ -174,6 +169,7 @@ void ldlm_handle_bl_callback(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld, struct ldlm_lock *lock); extern struct kmem_cache *ldlm_resource_slab; +extern struct kset *ldlm_ns_kset; /* ldlm_lockd.c & ldlm_lock.c */ extern struct kmem_cache *ldlm_lock_slab; @@ -182,11 +178,6 @@ extern struct kmem_cache *ldlm_lock_slab; void ldlm_extent_add_lock(struct ldlm_resource *res, struct ldlm_lock *lock); void ldlm_extent_unlink_lock(struct ldlm_lock *lock); -/* ldlm_flock.c */ -int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, - int first_enq, ldlm_error_t *err, - struct list_head *work_list); - /* l_lock.c */ void l_check_ns_lock(struct ldlm_namespace *ns); void l_check_no_ns_lock(struct ldlm_namespace *ns); @@ -201,9 +192,13 @@ struct ldlm_state { struct ldlm_bl_pool *ldlm_bl_pool; }; +/* ldlm_pool.c */ +__u64 ldlm_pool_get_slv(struct ldlm_pool *pl); +void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv); +__u32 ldlm_pool_get_lvf(struct ldlm_pool *pl); + /* interval tree, for LDLM_EXTENT. */ extern struct kmem_cache *ldlm_interval_slab; /* slab cache for ldlm_interval */ -void ldlm_interval_attach(struct ldlm_interval *n, struct ldlm_lock *l); struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l); struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock); void ldlm_interval_free(struct ldlm_interval *node); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 827e5df..0ba1ac3 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -60,13 +60,12 @@ char *ldlm_lockname[] = { }; EXPORT_SYMBOL(ldlm_lockname); -char *ldlm_typename[] = { +static char *ldlm_typename[] = { [LDLM_PLAIN] = "PLN", [LDLM_EXTENT] = "EXT", [LDLM_FLOCK] = "FLK", [LDLM_IBITS] = "IBT", }; -EXPORT_SYMBOL(ldlm_typename); static ldlm_policy_wire_to_local_t ldlm_policy_wire18_to_local[] = { [LDLM_PLAIN - LDLM_MIN_TYPE] = ldlm_plain_policy_wire_to_local, @@ -92,9 +91,9 @@ static ldlm_policy_local_to_wire_t ldlm_policy_local_to_wire[] = { /** * Converts lock policy from local format to on the wire lock_desc format */ -void ldlm_convert_policy_to_wire(ldlm_type_t type, - const ldlm_policy_data_t *lpolicy, - ldlm_wire_policy_data_t *wpolicy) +static void ldlm_convert_policy_to_wire(ldlm_type_t type, + const ldlm_policy_data_t *lpolicy, + ldlm_wire_policy_data_t *wpolicy) { ldlm_policy_local_to_wire_t convert; @@ -246,7 +245,7 @@ int ldlm_lock_remove_from_lru(struct ldlm_lock *lock) /** * Adds LDLM lock \a lock to namespace LRU. Assumes LRU is already locked. */ -void ldlm_lock_add_to_lru_nolock(struct ldlm_lock *lock) +static void ldlm_lock_add_to_lru_nolock(struct ldlm_lock *lock) { struct ldlm_namespace *ns = ldlm_lock_to_ns(lock); @@ -264,7 +263,7 @@ void ldlm_lock_add_to_lru_nolock(struct ldlm_lock *lock) * Adds LDLM lock \a lock to namespace LRU. Obtains necessary LRU locks * first. */ -void ldlm_lock_add_to_lru(struct ldlm_lock *lock) +static void ldlm_lock_add_to_lru(struct ldlm_lock *lock) { struct ldlm_namespace *ns = ldlm_lock_to_ns(lock); @@ -277,7 +276,7 @@ void ldlm_lock_add_to_lru(struct ldlm_lock *lock) * Moves LDLM lock \a lock that is already in namespace LRU to the tail of * the LRU. Performs necessary LRU locking */ -void ldlm_lock_touch_in_lru(struct ldlm_lock *lock) +static void ldlm_lock_touch_in_lru(struct ldlm_lock *lock) { struct ldlm_namespace *ns = ldlm_lock_to_ns(lock); @@ -308,7 +307,7 @@ void ldlm_lock_touch_in_lru(struct ldlm_lock *lock) * ldlm_lock_destroy, you can never drop your final references on this lock. * Because it's not in the hash table anymore. -phil */ -int ldlm_lock_destroy_internal(struct ldlm_lock *lock) +static int ldlm_lock_destroy_internal(struct ldlm_lock *lock) { if (lock->l_readers || lock->l_writers) { LDLM_ERROR(lock, "lock still has references"); @@ -355,7 +354,7 @@ int ldlm_lock_destroy_internal(struct ldlm_lock *lock) /** * Destroys a LDLM lock \a lock. Performs necessary locking first. */ -void ldlm_lock_destroy(struct ldlm_lock *lock) +static void ldlm_lock_destroy(struct ldlm_lock *lock) { int first; @@ -397,7 +396,7 @@ static void lock_handle_free(void *lock, int size) OBD_SLAB_FREE(lock, ldlm_lock_slab, size); } -struct portals_handle_ops lock_handle_ops = { +static struct portals_handle_ops lock_handle_ops = { .hop_addref = lock_handle_addref, .hop_free = lock_handle_free, }; @@ -606,8 +605,8 @@ EXPORT_SYMBOL(ldlm_lock2desc); * * Only add if we have not sent a blocking AST to the lock yet. */ -void ldlm_add_bl_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, - struct list_head *work_list) +static void ldlm_add_bl_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, + struct list_head *work_list) { if ((lock->l_flags & LDLM_FL_AST_SENT) == 0) { LDLM_DEBUG(lock, "lock incompatible; sending blocking AST."); @@ -627,7 +626,8 @@ void ldlm_add_bl_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, /** * Add a lock to list of just granted locks to send completion AST to. */ -void ldlm_add_cp_work_item(struct ldlm_lock *lock, struct list_head *work_list) +static void ldlm_add_cp_work_item(struct ldlm_lock *lock, + struct list_head *work_list) { if ((lock->l_flags & LDLM_FL_CP_REQD) == 0) { lock->l_flags |= LDLM_FL_CP_REQD; @@ -1673,7 +1673,7 @@ ldlm_work_revoke_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) /** * Process a call to glimpse AST callback for a lock in ast_work list */ -int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) +static int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) { struct ldlm_cb_set_arg *arg = opaq; struct ldlm_glimpse_work *gl_work; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index 045e3c6..152bdaa 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -58,9 +58,9 @@ MODULE_PARM_DESC(ldlm_cpts, "CPU partitions ldlm threads should run on"); static struct mutex ldlm_ref_mutex; static int ldlm_refcount; -struct kobject *ldlm_kobj; +static struct kobject *ldlm_kobj; struct kset *ldlm_ns_kset; -struct kset *ldlm_svc_kset; +static struct kset *ldlm_svc_kset; struct ldlm_cb_async_args { struct ldlm_cb_set_arg *ca_set_arg; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 78d1baf..a4ee591 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -214,6 +214,22 @@ static inline int ldlm_pool_t2gsp(unsigned int t) } /** + * Returns current \a pl limit. + */ +static __u32 ldlm_pool_get_limit(struct ldlm_pool *pl) +{ + return atomic_read(&pl->pl_limit); +} + +/** + * Sets passed \a limit to \a pl. + */ +static void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit) +{ + atomic_set(&pl->pl_limit, limit); +} + +/** * Recalculates next stats on passed \a pl. * * \pre ->pl_lock is locked. @@ -358,7 +374,7 @@ static const struct ldlm_pool_ops ldlm_cli_pool_ops = { * Pool recalc wrapper. Will call either client or server pool recalc callback * depending what pool \a pl is used. */ -int ldlm_pool_recalc(struct ldlm_pool *pl) +static int ldlm_pool_recalc(struct ldlm_pool *pl) { u32 recalc_interval_sec; int count; @@ -407,8 +423,7 @@ int ldlm_pool_recalc(struct ldlm_pool *pl) * depending what pool pl is used. When nr == 0, just return the number of * freeable locks. Otherwise, return the number of canceled locks. */ -int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, - gfp_t gfp_mask) +static int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, gfp_t gfp_mask) { int cancel = 0; @@ -427,7 +442,6 @@ int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, } return cancel; } -EXPORT_SYMBOL(ldlm_pool_shrink); static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) { @@ -763,7 +777,6 @@ __u64 ldlm_pool_get_slv(struct ldlm_pool *pl) spin_unlock(&pl->pl_lock); return slv; } -EXPORT_SYMBOL(ldlm_pool_get_slv); /** * Sets passed \a clv to \a pl. @@ -776,25 +789,6 @@ void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv) pl->pl_client_lock_volume = clv; spin_unlock(&pl->pl_lock); } -EXPORT_SYMBOL(ldlm_pool_set_clv); - -/** - * Returns current \a pl limit. - */ -__u32 ldlm_pool_get_limit(struct ldlm_pool *pl) -{ - return atomic_read(&pl->pl_limit); -} -EXPORT_SYMBOL(ldlm_pool_get_limit); - -/** - * Sets passed \a limit to \a pl. - */ -void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit) -{ - atomic_set(&pl->pl_limit, limit); -} -EXPORT_SYMBOL(ldlm_pool_set_limit); /** * Returns current LVF from \a pl. @@ -803,7 +797,6 @@ __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl) { return atomic_read(&pl->pl_lock_volume_factor); } -EXPORT_SYMBOL(ldlm_pool_get_lvf); static int ldlm_pool_granted(struct ldlm_pool *pl) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 04f4144..250cc37 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -87,7 +87,7 @@ struct ldlm_async_args { struct lustre_handle lock_handle; }; -int ldlm_expired_completion_wait(void *data) +static int ldlm_expired_completion_wait(void *data) { struct lock_wait_data *lwd = data; struct ldlm_lock *lock = lwd->lwd_lock; @@ -126,11 +126,10 @@ int ldlm_expired_completion_wait(void *data) return 0; } -EXPORT_SYMBOL(ldlm_expired_completion_wait); /* We use the same basis for both server side and client side functions from a single node. */ -int ldlm_get_enq_timeout(struct ldlm_lock *lock) +static int ldlm_get_enq_timeout(struct ldlm_lock *lock) { int timeout = at_get(ldlm_lock_to_ns_at(lock)); @@ -142,7 +141,6 @@ int ldlm_get_enq_timeout(struct ldlm_lock *lock) timeout = min_t(int, at_max, timeout + (timeout >> 1)); /* 150% */ return max(timeout, ldlm_enqueue_min); } -EXPORT_SYMBOL(ldlm_get_enq_timeout); /** * Helper function for ldlm_completion_ast(), updating timings when lock is @@ -861,8 +859,9 @@ static void ldlm_cancel_pack(struct ptlrpc_request *req, /** * Prepare and send a batched cancel RPC. It will include \a count lock * handles of locks given in \a cancels list. */ -int ldlm_cli_cancel_req(struct obd_export *exp, struct list_head *cancels, - int count, ldlm_cancel_flags_t flags) +static int ldlm_cli_cancel_req(struct obd_export *exp, + struct list_head *cancels, + int count, ldlm_cancel_flags_t flags) { struct ptlrpc_request *req = NULL; struct obd_import *imp; @@ -944,7 +943,6 @@ int ldlm_cli_cancel_req(struct obd_export *exp, struct list_head *cancels, out: return sent ? sent : rc; } -EXPORT_SYMBOL(ldlm_cli_cancel_req); static inline struct ldlm_pool *ldlm_imp2pl(struct obd_import *imp) { @@ -1425,9 +1423,9 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, return added; } -int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels, - int count, int max, ldlm_cancel_flags_t cancel_flags, - int flags) +int ldlm_cancel_lru_local(struct ldlm_namespace *ns, + struct list_head *cancels, int count, int max, + ldlm_cancel_flags_t cancel_flags, int flags) { int added; @@ -1664,8 +1662,8 @@ EXPORT_SYMBOL(ldlm_cli_cancel_unused); /* Lock iterators. */ -int ldlm_resource_foreach(struct ldlm_resource *res, ldlm_iterator_t iter, - void *closure) +static int ldlm_resource_foreach(struct ldlm_resource *res, + ldlm_iterator_t iter, void *closure) { struct list_head *tmp, *next; struct ldlm_lock *lock; @@ -1696,7 +1694,6 @@ int ldlm_resource_foreach(struct ldlm_resource *res, ldlm_iterator_t iter, unlock_res(res); return rc; } -EXPORT_SYMBOL(ldlm_resource_foreach); struct iter_helper_data { ldlm_iterator_t iter; @@ -1720,8 +1717,8 @@ static int ldlm_res_iter_helper(struct cfs_hash *hs, struct cfs_hash_bd *bd, LDLM_ITER_STOP; } -void ldlm_namespace_foreach(struct ldlm_namespace *ns, - ldlm_iterator_t iter, void *closure) +static void ldlm_namespace_foreach(struct ldlm_namespace *ns, + ldlm_iterator_t iter, void *closure) { struct iter_helper_data helper = { @@ -1733,7 +1730,6 @@ void ldlm_namespace_foreach(struct ldlm_namespace *ns, ldlm_res_iter_helper, &helper); } -EXPORT_SYMBOL(ldlm_namespace_foreach); /* non-blocking function to manipulate a lock whose cb_data is being put away. * return 0: find no resource diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 402fe60..de1b443 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -67,7 +67,7 @@ struct dentry *ldlm_svc_debugfs_dir; /* during debug dump certain amount of granted locks for one resource to avoid * DDOS. */ -unsigned int ldlm_dump_granted_max = 256; +static unsigned int ldlm_dump_granted_max = 256; static ssize_t lprocfs_wr_dump_ns(struct file *file, const char __user *buffer, @@ -383,13 +383,13 @@ static void ldlm_namespace_debugfs_unregister(struct ldlm_namespace *ns) lprocfs_free_stats(&ns->ns_stats); } -void ldlm_namespace_sysfs_unregister(struct ldlm_namespace *ns) +static void ldlm_namespace_sysfs_unregister(struct ldlm_namespace *ns) { kobject_put(&ns->ns_kobj); wait_for_completion(&ns->ns_kobj_unregister); } -int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns) +static int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns) { int err; @@ -428,6 +428,16 @@ static int ldlm_namespace_debugfs_register(struct ldlm_namespace *ns) } #undef MAX_STRING_SIZE +static struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res) +{ + LASSERT(res); + LASSERT(res != LP_POISON); + atomic_inc(&res->lr_refcount); + CDEBUG(D_INFO, "getref res: %p count: %d\n", res, + atomic_read(&res->lr_refcount)); + return res; +} + static unsigned ldlm_res_hop_hash(struct cfs_hash *hs, const void *key, unsigned mask) { @@ -519,7 +529,7 @@ static void ldlm_res_hop_put(struct cfs_hash *hs, struct hlist_node *hnode) ldlm_resource_putref(res); } -cfs_hash_ops_t ldlm_ns_hash_ops = { +static cfs_hash_ops_t ldlm_ns_hash_ops = { .hs_hash = ldlm_res_hop_hash, .hs_key = ldlm_res_hop_key, .hs_keycmp = ldlm_res_hop_keycmp, @@ -530,7 +540,7 @@ cfs_hash_ops_t ldlm_ns_hash_ops = { .hs_put = ldlm_res_hop_put }; -cfs_hash_ops_t ldlm_ns_fid_hash_ops = { +static cfs_hash_ops_t ldlm_ns_fid_hash_ops = { .hs_hash = ldlm_res_hop_fid_hash, .hs_key = ldlm_res_hop_key, .hs_keycmp = ldlm_res_hop_keycmp, @@ -551,7 +561,7 @@ struct ldlm_ns_hash_def { cfs_hash_ops_t *nsd_hops; }; -struct ldlm_ns_hash_def ldlm_ns_hash_defs[] = { +static struct ldlm_ns_hash_def ldlm_ns_hash_defs[] = { { .nsd_type = LDLM_NS_TYPE_MDC, .nsd_bkt_bits = 11, @@ -593,6 +603,17 @@ struct ldlm_ns_hash_def ldlm_ns_hash_defs[] = { }, }; +/** Register \a ns in the list of namespaces */ +static void ldlm_namespace_register(struct ldlm_namespace *ns, + ldlm_side_t client) +{ + mutex_lock(ldlm_namespace_lock(client)); + LASSERT(list_empty(&ns->ns_list_chain)); + list_add(&ns->ns_list_chain, ldlm_namespace_inactive_list(client)); + ldlm_namespace_nr_inc(client); + mutex_unlock(ldlm_namespace_lock(client)); +} + /** * Create and initialize new empty namespace. */ @@ -912,6 +933,20 @@ void ldlm_namespace_free_prior(struct ldlm_namespace *ns, } } +/** Unregister \a ns from the list of namespaces. */ +static void ldlm_namespace_unregister(struct ldlm_namespace *ns, + ldlm_side_t client) +{ + mutex_lock(ldlm_namespace_lock(client)); + LASSERT(!list_empty(&ns->ns_list_chain)); + /* Some asserts and possibly other parts of the code are still + * using list_empty(&ns->ns_list_chain). This is why it is + * important to use list_del_init() here. */ + list_del_init(&ns->ns_list_chain); + ldlm_namespace_nr_dec(client); + mutex_unlock(ldlm_namespace_lock(client)); +} + /** * Performs freeing memory structures related to \a ns. This is only done * when ldlm_namespce_free_prior() successfully removed all resources @@ -947,7 +982,7 @@ void ldlm_namespace_get(struct ldlm_namespace *ns) EXPORT_SYMBOL(ldlm_namespace_get); /* This is only for callers that care about refcount */ -int ldlm_namespace_get_return(struct ldlm_namespace *ns) +static int ldlm_namespace_get_return(struct ldlm_namespace *ns) { return atomic_inc_return(&ns->ns_bref); } @@ -961,29 +996,6 @@ void ldlm_namespace_put(struct ldlm_namespace *ns) } EXPORT_SYMBOL(ldlm_namespace_put); -/** Register \a ns in the list of namespaces */ -void ldlm_namespace_register(struct ldlm_namespace *ns, ldlm_side_t client) -{ - mutex_lock(ldlm_namespace_lock(client)); - LASSERT(list_empty(&ns->ns_list_chain)); - list_add(&ns->ns_list_chain, ldlm_namespace_inactive_list(client)); - ldlm_namespace_nr_inc(client); - mutex_unlock(ldlm_namespace_lock(client)); -} - -/** Unregister \a ns from the list of namespaces. */ -void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client) -{ - mutex_lock(ldlm_namespace_lock(client)); - LASSERT(!list_empty(&ns->ns_list_chain)); - /* Some asserts and possibly other parts of the code are still - * using list_empty(&ns->ns_list_chain). This is why it is - * important to use list_del_init() here. */ - list_del_init(&ns->ns_list_chain); - ldlm_namespace_nr_dec(client); - mutex_unlock(ldlm_namespace_lock(client)); -} - /** Should be called with ldlm_namespace_lock(client) taken. */ void ldlm_namespace_move_to_active_locked(struct ldlm_namespace *ns, ldlm_side_t client) @@ -1167,16 +1179,6 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, } EXPORT_SYMBOL(ldlm_resource_get); -struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res) -{ - LASSERT(res != NULL); - LASSERT(res != LP_POISON); - atomic_inc(&res->lr_refcount); - CDEBUG(D_INFO, "getref res: %p count: %d\n", res, - atomic_read(&res->lr_refcount)); - return res; -} - static void __ldlm_resource_putref_final(struct cfs_hash_bd *bd, struct ldlm_resource *res) { -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:36 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:36 -0400 Subject: [lustre-devel] [PATCH 26/32] staging/lustre: Remove ns_is_client() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-27-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Since staging tree code is just the client, ns_is_client is always true, so change all callers as such and drop all the dead code for when it's false. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 13 ---------- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 28 +++------------------ drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 5 +--- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 9 +++---- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 29 ++++++++-------------- 5 files changed, 17 insertions(+), 67 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 360c7f7..1e40203 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -465,19 +465,6 @@ struct ldlm_namespace { }; /** - * Returns 1 if namespace \a ns is a client namespace. - */ -static inline int ns_is_client(struct ldlm_namespace *ns) -{ - LASSERT(ns != NULL); - LASSERT(!(ns->ns_client & ~(LDLM_NAMESPACE_CLIENT | - LDLM_NAMESPACE_SERVER))); - LASSERT(ns->ns_client == LDLM_NAMESPACE_CLIENT || - ns->ns_client == LDLM_NAMESPACE_SERVER); - return ns->ns_client == LDLM_NAMESPACE_CLIENT; -} - -/** * Returns 1 if namespace \a ns is a server namespace. */ static inline int ns_is_server(struct ldlm_namespace *ns) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index 14e6782..7241c34 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -63,9 +63,6 @@ #include #include "ldlm_internal.h" -int ldlm_flock_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, - void *data, int flag); - /** * list_for_remaining_safe - iterate over the remaining entries in a list * and safeguard against removal of a list entry. @@ -254,7 +251,6 @@ ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, int first_enq, struct ldlm_lock *new = req; struct ldlm_lock *new2 = NULL; ldlm_mode_t mode = req->l_req_mode; - int local = ns_is_client(ns); int added = (mode == LCK_NL); int overlaps = 0; int splitted = 0; @@ -269,14 +265,9 @@ ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags, int first_enq, *err = ELDLM_OK; - if (local) { - /* No blocking ASTs are sent to the clients for - * Posix file & record locks */ - req->l_blocking_ast = NULL; - } else { - /* Called on the server for lock cancels. */ - req->l_blocking_ast = ldlm_flock_blocking_ast; - } + /* No blocking ASTs are sent to the clients for + * Posix file & record locks */ + req->l_blocking_ast = NULL; reprocess: if ((*flags == LDLM_FL_WAIT_NOREPROC) || (mode == LCK_NL)) { @@ -708,19 +699,6 @@ granted: } EXPORT_SYMBOL(ldlm_flock_completion_ast); -int ldlm_flock_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, - void *data, int flag) -{ - LASSERT(lock); - LASSERT(flag == LDLM_CB_CANCELING); - - /* take lock off the deadlock detection hash list. */ - lock_res_and_lock(lock); - ldlm_flock_blocking_unlink(lock); - unlock_res_and_lock(lock); - return 0; -} - void ldlm_flock_policy_wire18_to_local(const ldlm_wire_policy_data_t *wpolicy, ldlm_policy_data_t *lpolicy) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index e586d33..6d5e7af 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -480,8 +480,6 @@ int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock, struct ldlm_resource *newres; int type; - LASSERT(ns_is_client(ns)); - lock_res_and_lock(lock); if (memcmp(new_resid, &lock->l_resource->lr_name, sizeof(lock->l_resource->lr_name)) == 0) { @@ -816,8 +814,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) if ((lock->l_flags & LDLM_FL_ATOMIC_CB) || ldlm_bl_to_thread_lock(ns, NULL, lock) != 0) ldlm_handle_bl_callback(ns, NULL, lock); - } else if (ns_is_client(ns) && - !lock->l_readers && !lock->l_writers && + } else if (!lock->l_readers && !lock->l_writers && !(lock->l_flags & LDLM_FL_NO_LRU) && !(lock->l_flags & LDLM_FL_BL_AST)) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 2d28fc2..04f4144 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -266,8 +266,7 @@ noreproc: spin_unlock(&imp->imp_lock); } - if (ns_is_client(ldlm_lock_to_ns(lock)) && - OBD_FAIL_CHECK_RESET(OBD_FAIL_LDLM_INTR_CP_AST, + if (OBD_FAIL_CHECK_RESET(OBD_FAIL_LDLM_INTR_CP_AST, OBD_FAIL_LDLM_CP_BL_RACE | OBD_FAIL_ONCE)) { lock->l_flags |= LDLM_FL_FAIL_LOC; rc = -EINTR; @@ -817,10 +816,8 @@ static __u64 ldlm_cli_cancel_local(struct ldlm_lock *lock) } ldlm_lock_cancel(lock); } else { - if (ns_is_client(ldlm_lock_to_ns(lock))) { - LDLM_ERROR(lock, "Trying to cancel local lock"); - LBUG(); - } + LDLM_ERROR(lock, "Trying to cancel local lock"); + LBUG(); } return rc; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 9906372..402fe60 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -718,11 +718,12 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, __u64 flags) { struct list_head *tmp; - int rc = 0, client = ns_is_client(ldlm_res_to_ns(res)); + int rc = 0; bool local_only = !!(flags & LDLM_FL_LOCAL_ONLY); do { struct ldlm_lock *lock = NULL; + struct lustre_handle lockh; /* First, we look for non-cleaned-yet lock * all cleaned locks are marked by CLEANED flag. */ @@ -767,20 +768,11 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, continue; } - if (client) { - struct lustre_handle lockh; - - unlock_res(res); - ldlm_lock2handle(lock, &lockh); - rc = ldlm_cli_cancel(&lockh, LCF_ASYNC); - if (rc) - CERROR("ldlm_cli_cancel: %d\n", rc); - } else { - ldlm_resource_unlink_lock(lock); - unlock_res(res); - LDLM_DEBUG(lock, "Freeing a lock still held by a client node"); - ldlm_lock_destroy(lock); - } + unlock_res(res); + ldlm_lock2handle(lock, &lockh); + rc = ldlm_cli_cancel(&lockh, LCF_ASYNC); + if (rc) + CERROR("ldlm_cli_cancel: %d\n", rc); LDLM_LOCK_RELEASE(lock); } while (1); } @@ -1165,7 +1157,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, * namespace. If so, and this is a client namespace, we need to move * the namespace into the active namespaces list to be patrolled by * the ldlm_poold. */ - if (ns_is_client(ns) && ns_refcount == 1) { + if (ns_refcount == 1) { mutex_lock(ldlm_namespace_lock(LDLM_NAMESPACE_CLIENT)); ldlm_namespace_move_to_active_locked(ns, LDLM_NAMESPACE_CLIENT); mutex_unlock(ldlm_namespace_lock(LDLM_NAMESPACE_CLIENT)); @@ -1346,9 +1338,8 @@ void ldlm_namespace_dump(int level, struct ldlm_namespace *ns) if (!((libcfs_debug | D_ERROR) & level)) return; - CDEBUG(level, "--- Namespace: %s (rc: %d, side: %s)\n", - ldlm_ns_name(ns), atomic_read(&ns->ns_bref), - ns_is_client(ns) ? "client" : "server"); + CDEBUG(level, "--- Namespace: %s (rc: %d, side: client)\n", + ldlm_ns_name(ns), atomic_read(&ns->ns_bref)); if (time_before(cfs_time_current(), ns->ns_next_dump)) return; -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:40 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:40 -0400 Subject: [lustre-devel] [PATCH 30/32] staging/lustre/ldlm: Remove ldlm_namespace_inactive_list() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-31-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Since there are no server namespaces, just replace it with ldlm_cli_inactive_namespace_list pointer. Also make ldlm_cli_inactive_namespace_list static as it's only used in ldlm_resource.c Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 7 ------- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 7 +++---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index e63a1c9..6cf3f9f 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -42,7 +42,6 @@ extern struct mutex ldlm_srv_namespace_lock; extern struct list_head ldlm_srv_namespace_list; extern struct mutex ldlm_cli_namespace_lock; extern struct list_head ldlm_cli_active_namespace_list; -extern struct list_head ldlm_cli_inactive_namespace_list; static inline int ldlm_namespace_nr_read(ldlm_side_t client) { @@ -72,12 +71,6 @@ static inline struct list_head *ldlm_namespace_list(ldlm_side_t client) &ldlm_srv_namespace_list : &ldlm_cli_active_namespace_list; } -static inline struct list_head *ldlm_namespace_inactive_list(ldlm_side_t client) -{ - return client == LDLM_NAMESPACE_SERVER ? - &ldlm_srv_namespace_list : &ldlm_cli_inactive_namespace_list; -} - static inline struct mutex *ldlm_namespace_lock(ldlm_side_t client) { return client == LDLM_NAMESPACE_SERVER ? diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index de1b443..9152423 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -59,7 +59,7 @@ struct mutex ldlm_cli_namespace_lock; * inactive list */ LIST_HEAD(ldlm_cli_active_namespace_list); /* Client namespaces that don't have any locks in them */ -LIST_HEAD(ldlm_cli_inactive_namespace_list); +static LIST_HEAD(ldlm_cli_inactive_namespace_list); static struct dentry *ldlm_debugfs_dir; static struct dentry *ldlm_ns_debugfs_dir; @@ -609,7 +609,7 @@ static void ldlm_namespace_register(struct ldlm_namespace *ns, { mutex_lock(ldlm_namespace_lock(client)); LASSERT(list_empty(&ns->ns_list_chain)); - list_add(&ns->ns_list_chain, ldlm_namespace_inactive_list(client)); + list_add(&ns->ns_list_chain, &ldlm_cli_inactive_namespace_list); ldlm_namespace_nr_inc(client); mutex_unlock(ldlm_namespace_lock(client)); } @@ -1011,8 +1011,7 @@ void ldlm_namespace_move_to_inactive_locked(struct ldlm_namespace *ns, { LASSERT(!list_empty(&ns->ns_list_chain)); LASSERT(mutex_is_locked(ldlm_namespace_lock(client))); - list_move_tail(&ns->ns_list_chain, - ldlm_namespace_inactive_list(client)); + list_move_tail(&ns->ns_list_chain, &ldlm_cli_inactive_namespace_list); } /** Should be called with ldlm_namespace_lock(client) taken. */ -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:42 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:42 -0400 Subject: [lustre-devel] [PATCH 32/32] staging/lustre/ldlm: Make ldlm_add_ast_work_item() static In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-33-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Now that ldlm_flock code no longer uses it. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 -- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 6cf3f9f..db3c9b7 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -142,8 +142,6 @@ void ldlm_lock_addref_internal(struct ldlm_lock *, __u32 mode); void ldlm_lock_addref_internal_nolock(struct ldlm_lock *, __u32 mode); void ldlm_lock_decref_internal(struct ldlm_lock *, __u32 mode); void ldlm_lock_decref_internal_nolock(struct ldlm_lock *, __u32 mode); -void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, - struct list_head *work_list); int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list, enum ldlm_desc_ast_t ast_type); int ldlm_lock_remove_from_lru(struct ldlm_lock *lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 0ba1ac3..f39375c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -644,8 +644,9 @@ static void ldlm_add_cp_work_item(struct ldlm_lock *lock, * adding function. * Must be called with lr_lock held. */ -void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, - struct list_head *work_list) +static void ldlm_add_ast_work_item(struct ldlm_lock *lock, + struct ldlm_lock *new, + struct list_head *work_list) { check_res_locked(lock->l_resource); if (new) -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:32 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:32 -0400 Subject: [lustre-devel] [PATCH 22/32] staging/lustre/ldlm: Remove intent policies handler. In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-23-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This includes ldlm_register_intent(), ns_policy field in the namespace and all of it's users, as this could only happen on the server. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 8 -- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 85 ++++------------------ 2 files changed, 13 insertions(+), 80 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 5a72f22..c0b2c61 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -271,10 +271,6 @@ struct ldlm_pool { struct completion pl_kobj_unregister; }; -typedef int (*ldlm_res_policy)(struct ldlm_namespace *, struct ldlm_lock **, - void *req_cookie, ldlm_mode_t mode, __u64 flags, - void *data); - typedef int (*ldlm_cancel_for_recovery)(struct ldlm_lock *lock); /** @@ -427,9 +423,6 @@ struct ldlm_namespace { */ unsigned long ns_next_dump; - /** "policy" function that does actual lock conflict determination */ - ldlm_res_policy ns_policy; - /** * LVB operations for this namespace. * \see struct ldlm_valblock_ops @@ -1113,7 +1106,6 @@ void ldlm_put_ref(void); struct ldlm_lock *ldlm_request_lock(struct ptlrpc_request *req); /* ldlm_lock.c */ -void ldlm_register_intent(struct ldlm_namespace *ns, ldlm_res_policy arg); void ldlm_lock2handle(const struct ldlm_lock *lock, struct lustre_handle *lockh); struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, __u64 flags); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 133936e..5a07669 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -151,13 +151,6 @@ char *ldlm_it2str(int it) } EXPORT_SYMBOL(ldlm_it2str); - -void ldlm_register_intent(struct ldlm_namespace *ns, ldlm_res_policy arg) -{ - ns->ns_policy = arg; -} -EXPORT_SYMBOL(ldlm_register_intent); - /* * REFCOUNTED LOCK OBJECTS */ @@ -1532,13 +1525,11 @@ out: /** * Enqueue (request) a lock. + * On the client this is called from ldlm_cli_enqueue_fini + * after we already got an initial reply from the server with some status. * * Does not block. As a result of enqueue the lock would be put * into granted or waiting list. - * - * If namespace has intent policy sent and the lock has LDLM_FL_HAS_INTENT flag - * set, skip all the enqueueing and delegate lock processing to intent policy - * function. */ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns, struct ldlm_lock **lockp, @@ -1546,43 +1537,12 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns, { struct ldlm_lock *lock = *lockp; struct ldlm_resource *res = lock->l_resource; - int local = ns_is_client(ldlm_res_to_ns(res)); ldlm_error_t rc = ELDLM_OK; - struct ldlm_interval *node = NULL; lock->l_last_activity = ktime_get_real_seconds(); - /* policies are not executed on the client or during replay */ - if ((*flags & (LDLM_FL_HAS_INTENT|LDLM_FL_REPLAY)) == LDLM_FL_HAS_INTENT - && !local && ns->ns_policy) { - rc = ns->ns_policy(ns, lockp, cookie, lock->l_req_mode, *flags, - NULL); - if (rc == ELDLM_LOCK_REPLACED) { - /* The lock that was returned has already been granted, - * and placed into lockp. If it's not the same as the - * one we passed in, then destroy the old one and our - * work here is done. */ - if (lock != *lockp) { - ldlm_lock_destroy(lock); - LDLM_LOCK_RELEASE(lock); - } - *flags |= LDLM_FL_LOCK_CHANGED; - return 0; - } else if (rc != ELDLM_OK || - (rc == ELDLM_OK && (*flags & LDLM_FL_INTENT_ONLY))) { - ldlm_lock_destroy(lock); - return rc; - } - } - - /* For a replaying lock, it might be already in granted list. So - * unlinking the lock will cause the interval node to be freed, we - * have to allocate the interval node early otherwise we can't regrant - * this lock in the future. - jay */ - if (!local && (*flags & LDLM_FL_REPLAY) && res->lr_type == LDLM_EXTENT) - OBD_SLAB_ALLOC_PTR_GFP(node, ldlm_interval_slab, GFP_NOFS); lock_res_and_lock(lock); - if (local && lock->l_req_mode == lock->l_granted_mode) { + if (lock->l_req_mode == lock->l_granted_mode) { /* The server returned a blocked lock, but it was granted * before we got a chance to actually enqueue it. We don't * need to do anything else. */ @@ -1592,48 +1552,29 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns, } ldlm_resource_unlink_lock(lock); - if (res->lr_type == LDLM_EXTENT && lock->l_tree_node == NULL) { - if (node == NULL) { - ldlm_lock_destroy_nolock(lock); - rc = -ENOMEM; - goto out; - } - INIT_LIST_HEAD(&node->li_group); - ldlm_interval_attach(node, lock); - node = NULL; - } + /* Cannot happen unless on the server */ + if (res->lr_type == LDLM_EXTENT && !lock->l_tree_node) + LBUG(); /* Some flags from the enqueue want to make it into the AST, via the * lock's l_flags. */ lock->l_flags |= *flags & LDLM_FL_AST_DISCARD_DATA; - /* This distinction between local lock trees is very important; a client + /* + * This distinction between local lock trees is very important; a client * namespace only has information about locks taken by that client, and * thus doesn't have enough information to decide for itself if it can * be granted (below). In this case, we do exactly what the server * tells us to do, as dictated by the 'flags'. - * - * We do exactly the same thing during recovery, when the server is - * more or less trusting the clients not to lie. - * - * FIXME (bug 268): Detect obvious lies by checking compatibility in - * granted/converting queues. */ - if (local) { - if (*flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED)) - ldlm_resource_add_lock(res, &res->lr_waiting, lock); - else - ldlm_grant_lock(lock, NULL); - goto out; - } else { - CERROR("This is client-side-only module, cannot handle LDLM_NAMESPACE_SERVER resource type lock.\n"); - LBUG(); - } + */ + if (*flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED)) + ldlm_resource_add_lock(res, &res->lr_waiting, lock); + else + ldlm_grant_lock(lock, NULL); out: unlock_res_and_lock(lock); - if (node) - OBD_SLAB_FREE(node, ldlm_interval_slab, sizeof(*node)); return rc; } -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:34 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:34 -0400 Subject: [lustre-devel] [PATCH 24/32] staging/lustre/ldlm: Remove unused ldlm_resource_insert_lock_after() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-25-git-send-email-green@linuxhacker.ru> From: Oleg Drokin It was only used on the server. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 -- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 26 ---------------------- 2 files changed, 28 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 1293f13..56805d0 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -116,8 +116,6 @@ int ldlm_get_enq_timeout(struct ldlm_lock *lock); /* ldlm_resource.c */ int ldlm_resource_putref_locked(struct ldlm_resource *res); -void ldlm_resource_insert_lock_after(struct ldlm_lock *original, - struct ldlm_lock *new); void ldlm_namespace_free_prior(struct ldlm_namespace *ns, struct obd_import *imp, int force); void ldlm_namespace_free_post(struct ldlm_namespace *ns); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index cd65efe..9906372 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -1281,32 +1281,6 @@ void ldlm_resource_add_lock(struct ldlm_resource *res, struct list_head *head, list_add_tail(&lock->l_res_link, head); } -/** - * Insert a lock into resource after specified lock. - * - * Obtain resource description from the lock we are inserting after. - */ -void ldlm_resource_insert_lock_after(struct ldlm_lock *original, - struct ldlm_lock *new) -{ - struct ldlm_resource *res = original->l_resource; - - check_res_locked(res); - - ldlm_resource_dump(D_INFO, res); - LDLM_DEBUG(new, "About to insert this lock after %p:\n", original); - - if (new->l_flags & LDLM_FL_DESTROYED) { - CDEBUG(D_OTHER, "Lock destroyed, not adding to resource\n"); - goto out; - } - - LASSERT(list_empty(&new->l_res_link)); - - list_add(&new->l_res_link, &original->l_res_link); - out:; -} - void ldlm_resource_unlink_lock(struct ldlm_lock *lock) { int type = lock->l_resource->lr_type; -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:35 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:35 -0400 Subject: [lustre-devel] [PATCH 25/32] staging/lustre/ldlm: Remove unused ldlm_blocking_ast/_nocheck() In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-26-git-send-email-green@linuxhacker.ru> From: Oleg Drokin All users are gone, and they were used on the server anyway. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 3 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 70 ---------------------- 2 files changed, 73 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 9608373..360c7f7 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1264,9 +1264,6 @@ int ldlm_expired_completion_wait(void *data); * also used by client-side lock handlers to perform minimum level base * processing. * @{ */ -int ldlm_blocking_ast_nocheck(struct ldlm_lock *lock); -int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, - void *data, int flag); int ldlm_completion_ast_async(struct ldlm_lock *lock, __u64 flags, void *data); int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data); /** @} ldlm_local_ast */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 15e1980..2d28fc2 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -287,76 +287,6 @@ noreproc: } EXPORT_SYMBOL(ldlm_completion_ast); -/** - * A helper to build a blocking AST function - * - * Perform a common operation for blocking ASTs: - * deferred lock cancellation. - * - * \param lock the lock blocking or canceling AST was called on - * \retval 0 - * \see mdt_blocking_ast - * \see ldlm_blocking_ast - */ -int ldlm_blocking_ast_nocheck(struct ldlm_lock *lock) -{ - int do_ast; - - lock->l_flags |= LDLM_FL_CBPENDING; - do_ast = !lock->l_readers && !lock->l_writers; - unlock_res_and_lock(lock); - - if (do_ast) { - struct lustre_handle lockh; - int rc; - - LDLM_DEBUG(lock, "already unused, calling ldlm_cli_cancel"); - ldlm_lock2handle(lock, &lockh); - rc = ldlm_cli_cancel(&lockh, LCF_ASYNC); - if (rc < 0) - CERROR("ldlm_cli_cancel: %d\n", rc); - } else { - LDLM_DEBUG(lock, "Lock still has references, will be cancelled later"); - } - return 0; -} -EXPORT_SYMBOL(ldlm_blocking_ast_nocheck); - -/** - * Server blocking AST - * - * ->l_blocking_ast() callback for LDLM locks acquired by server-side - * OBDs. - * - * \param lock the lock which blocks a request or cancelling lock - * \param desc unused - * \param data unused - * \param flag indicates whether this cancelling or blocking callback - * \retval 0 - * \see ldlm_blocking_ast_nocheck - */ -int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, - void *data, int flag) -{ - if (flag == LDLM_CB_CANCELING) { - /* Don't need to do anything here. */ - return 0; - } - - lock_res_and_lock(lock); - /* Get this: if ldlm_blocking_ast is racing with intent_policy, such - * that ldlm_blocking_ast is called just before intent_policy method - * takes the lr_lock, then by the time we get the lock, we might not - * be the correct blocking function anymore. So check, and return - * early, if so. */ - if (lock->l_blocking_ast != ldlm_blocking_ast) { - unlock_res_and_lock(lock); - return 0; - } - return ldlm_blocking_ast_nocheck(lock); -} -EXPORT_SYMBOL(ldlm_blocking_ast); - static void failed_lock_cleanup(struct ldlm_namespace *ns, struct ldlm_lock *lock, int mode) { -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:38 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:38 -0400 Subject: [lustre-devel] [PATCH 28/32] staging/lustre/ldlm: Remove server side code from pool support. In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-29-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Server-side scanning is not really used in the client code, so it's ok to drop it. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 3 - drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 348 +-------------------- 2 files changed, 13 insertions(+), 338 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 49b5a07..3cca07e 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -213,7 +213,6 @@ struct ldlm_pool_ops { /** Cancel at least \a nr locks from pool \a pl */ int (*po_shrink)(struct ldlm_pool *pl, int nr, gfp_t gfp_mask); - int (*po_setup)(struct ldlm_pool *pl, int limit); }; /** One second for pools thread check interval. Each pool has own period. */ @@ -1347,7 +1346,6 @@ void unlock_res_and_lock(struct ldlm_lock *lock); * There are not used outside of ldlm. * @{ */ -int ldlm_pools_recalc(ldlm_side_t client); int ldlm_pools_init(void); void ldlm_pools_fini(void); @@ -1356,7 +1354,6 @@ int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, gfp_t gfp_mask); void ldlm_pool_fini(struct ldlm_pool *pl); -int ldlm_pool_setup(struct ldlm_pool *pl, int limit); int ldlm_pool_recalc(struct ldlm_pool *pl); __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl); __u64 ldlm_pool_get_slv(struct ldlm_pool *pl); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index dac1b6f..78d1baf 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -214,70 +214,6 @@ static inline int ldlm_pool_t2gsp(unsigned int t) } /** - * Recalculates next grant limit on passed \a pl. - * - * \pre ->pl_lock is locked. - */ -static void ldlm_pool_recalc_grant_plan(struct ldlm_pool *pl) -{ - int granted, grant_step, limit; - - limit = ldlm_pool_get_limit(pl); - granted = atomic_read(&pl->pl_granted); - - grant_step = ldlm_pool_t2gsp(pl->pl_recalc_period); - grant_step = ((limit - granted) * grant_step) / 100; - pl->pl_grant_plan = granted + grant_step; - limit = (limit * 5) >> 2; - if (pl->pl_grant_plan > limit) - pl->pl_grant_plan = limit; -} - -/** - * Recalculates next SLV on passed \a pl. - * - * \pre ->pl_lock is locked. - */ -static void ldlm_pool_recalc_slv(struct ldlm_pool *pl) -{ - int granted; - int grant_plan; - int round_up; - __u64 slv; - __u64 slv_factor; - __u64 grant_usage; - __u32 limit; - - slv = pl->pl_server_lock_volume; - grant_plan = pl->pl_grant_plan; - limit = ldlm_pool_get_limit(pl); - granted = atomic_read(&pl->pl_granted); - round_up = granted < limit; - - grant_usage = max_t(int, limit - (granted - grant_plan), 1); - - /* - * Find out SLV change factor which is the ratio of grant usage - * from limit. SLV changes as fast as the ratio of grant plan - * consumption. The more locks from grant plan are not consumed - * by clients in last interval (idle time), the faster grows - * SLV. And the opposite, the more grant plan is over-consumed - * (load time) the faster drops SLV. - */ - slv_factor = grant_usage << LDLM_POOL_SLV_SHIFT; - do_div(slv_factor, limit); - slv = slv * slv_factor; - slv = dru(slv, LDLM_POOL_SLV_SHIFT, round_up); - - if (slv > ldlm_pool_slv_max(limit)) - slv = ldlm_pool_slv_max(limit); - else if (slv < ldlm_pool_slv_min(limit)) - slv = ldlm_pool_slv_min(limit); - - pl->pl_server_lock_volume = slv; -} - -/** * Recalculates next stats on passed \a pl. * * \pre ->pl_lock is locked. @@ -303,147 +239,6 @@ static void ldlm_pool_recalc_stats(struct ldlm_pool *pl) } /** - * Sets current SLV into obd accessible via ldlm_pl2ns(pl)->ns_obd. - */ -static void ldlm_srv_pool_push_slv(struct ldlm_pool *pl) -{ - struct obd_device *obd; - - /* - * Set new SLV in obd field for using it later without accessing the - * pool. This is required to avoid race between sending reply to client - * with new SLV and cleanup server stack in which we can't guarantee - * that namespace is still alive. We know only that obd is alive as - * long as valid export is alive. - */ - obd = ldlm_pl2ns(pl)->ns_obd; - LASSERT(obd != NULL); - write_lock(&obd->obd_pool_lock); - obd->obd_pool_slv = pl->pl_server_lock_volume; - write_unlock(&obd->obd_pool_lock); -} - -/** - * Recalculates all pool fields on passed \a pl. - * - * \pre ->pl_lock is not locked. - */ -static int ldlm_srv_pool_recalc(struct ldlm_pool *pl) -{ - time64_t recalc_interval_sec; - - recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time; - if (recalc_interval_sec < pl->pl_recalc_period) - return 0; - - spin_lock(&pl->pl_lock); - recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time; - if (recalc_interval_sec < pl->pl_recalc_period) { - spin_unlock(&pl->pl_lock); - return 0; - } - /* - * Recalc SLV after last period. This should be done - * _before_ recalculating new grant plan. - */ - ldlm_pool_recalc_slv(pl); - - /* - * Make sure that pool informed obd of last SLV changes. - */ - ldlm_srv_pool_push_slv(pl); - - /* - * Update grant_plan for new period. - */ - ldlm_pool_recalc_grant_plan(pl); - - pl->pl_recalc_time = ktime_get_real_seconds(); - lprocfs_counter_add(pl->pl_stats, LDLM_POOL_TIMING_STAT, - recalc_interval_sec); - spin_unlock(&pl->pl_lock); - return 0; -} - -/** - * This function is used on server side as main entry point for memory - * pressure handling. It decreases SLV on \a pl according to passed - * \a nr and \a gfp_mask. - * - * Our goal here is to decrease SLV such a way that clients hold \a nr - * locks smaller in next 10h. - */ -static int ldlm_srv_pool_shrink(struct ldlm_pool *pl, - int nr, gfp_t gfp_mask) -{ - __u32 limit; - - /* - * VM is asking how many entries may be potentially freed. - */ - if (nr == 0) - return atomic_read(&pl->pl_granted); - - /* - * Client already canceled locks but server is already in shrinker - * and can't cancel anything. Let's catch this race. - */ - if (atomic_read(&pl->pl_granted) == 0) - return 0; - - spin_lock(&pl->pl_lock); - - /* - * We want shrinker to possibly cause cancellation of @nr locks from - * clients or grant approximately @nr locks smaller next intervals. - * - * This is why we decreased SLV by @nr. This effect will only be as - * long as one re-calc interval (1s these days) and this should be - * enough to pass this decreased SLV to all clients. On next recalc - * interval pool will either increase SLV if locks load is not high - * or will keep on same level or even decrease again, thus, shrinker - * decreased SLV will affect next recalc intervals and this way will - * make locking load lower. - */ - if (nr < pl->pl_server_lock_volume) { - pl->pl_server_lock_volume = pl->pl_server_lock_volume - nr; - } else { - limit = ldlm_pool_get_limit(pl); - pl->pl_server_lock_volume = ldlm_pool_slv_min(limit); - } - - /* - * Make sure that pool informed obd of last SLV changes. - */ - ldlm_srv_pool_push_slv(pl); - spin_unlock(&pl->pl_lock); - - /* - * We did not really free any memory here so far, it only will be - * freed later may be, so that we return 0 to not confuse VM. - */ - return 0; -} - -/** - * Setup server side pool \a pl with passed \a limit. - */ -static int ldlm_srv_pool_setup(struct ldlm_pool *pl, int limit) -{ - struct obd_device *obd; - - obd = ldlm_pl2ns(pl)->ns_obd; - LASSERT(obd != NULL && obd != LP_POISON); - LASSERT(obd->obd_type != LP_POISON); - write_lock(&obd->obd_pool_lock); - obd->obd_pool_limit = limit; - write_unlock(&obd->obd_pool_lock); - - ldlm_pool_set_limit(pl, limit); - return 0; -} - -/** * Sets SLV and Limit from ldlm_pl2ns(pl)->ns_obd tp passed \a pl. */ static void ldlm_cli_pool_pop_slv(struct ldlm_pool *pl) @@ -554,12 +349,6 @@ static int ldlm_cli_pool_shrink(struct ldlm_pool *pl, return ldlm_cancel_lru(ns, nr, LCF_ASYNC, LDLM_CANCEL_SHRINK); } -static const struct ldlm_pool_ops ldlm_srv_pool_ops = { - .po_recalc = ldlm_srv_pool_recalc, - .po_shrink = ldlm_srv_pool_shrink, - .po_setup = ldlm_srv_pool_setup -}; - static const struct ldlm_pool_ops ldlm_cli_pool_ops = { .po_recalc = ldlm_cli_pool_recalc, .po_shrink = ldlm_cli_pool_shrink @@ -640,20 +429,6 @@ int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, } EXPORT_SYMBOL(ldlm_pool_shrink); -/** - * Pool setup wrapper. Will call either client or server pool recalc callback - * depending what pool \a pl is used. - * - * Sets passed \a limit into pool \a pl. - */ -int ldlm_pool_setup(struct ldlm_pool *pl, int limit) -{ - if (pl->pl_ops->po_setup != NULL) - return pl->pl_ops->po_setup(pl, limit); - return 0; -} -EXPORT_SYMBOL(ldlm_pool_setup); - static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) { int granted, grant_rate, cancel_rate; @@ -896,17 +671,10 @@ int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, snprintf(pl->pl_name, sizeof(pl->pl_name), "ldlm-pool-%s-%d", ldlm_ns_name(ns), idx); - if (client == LDLM_NAMESPACE_SERVER) { - pl->pl_ops = &ldlm_srv_pool_ops; - ldlm_pool_set_limit(pl, LDLM_POOL_HOST_L); - pl->pl_recalc_period = LDLM_POOL_SRV_DEF_RECALC_PERIOD; - pl->pl_server_lock_volume = ldlm_pool_slv_max(LDLM_POOL_HOST_L); - } else { - ldlm_pool_set_limit(pl, 1); - pl->pl_server_lock_volume = 0; - pl->pl_ops = &ldlm_cli_pool_ops; - pl->pl_recalc_period = LDLM_POOL_CLI_DEF_RECALC_PERIOD; - } + ldlm_pool_set_limit(pl, 1); + pl->pl_server_lock_volume = 0; + pl->pl_ops = &ldlm_cli_pool_ops; + pl->pl_recalc_period = LDLM_POOL_CLI_DEF_RECALC_PERIOD; pl->pl_client_lock_volume = 0; rc = ldlm_pool_debugfs_init(pl); if (rc) @@ -1148,20 +916,7 @@ static unsigned long ldlm_pools_scan(ldlm_side_t client, int nr, gfp_t gfp_mask) * we only decrease the SLV in server pools shrinker, return * SHRINK_STOP to kernel to avoid needless loop. LU-1128 */ - return (client == LDLM_NAMESPACE_SERVER) ? SHRINK_STOP : freed; -} - -static unsigned long ldlm_pools_srv_count(struct shrinker *s, - struct shrink_control *sc) -{ - return ldlm_pools_count(LDLM_NAMESPACE_SERVER, sc->gfp_mask); -} - -static unsigned long ldlm_pools_srv_scan(struct shrinker *s, - struct shrink_control *sc) -{ - return ldlm_pools_scan(LDLM_NAMESPACE_SERVER, sc->nr_to_scan, - sc->gfp_mask); + return freed; } static unsigned long ldlm_pools_cli_count(struct shrinker *s, @@ -1177,82 +932,14 @@ static unsigned long ldlm_pools_cli_scan(struct shrinker *s, sc->gfp_mask); } -int ldlm_pools_recalc(ldlm_side_t client) +static int ldlm_pools_recalc(ldlm_side_t client) { - __u32 nr_l = 0, nr_p = 0, l; struct ldlm_namespace *ns; struct ldlm_namespace *ns_old = NULL; - int nr, equal = 0; + int nr; int time = 50; /* seconds of sleep if no active namespaces */ /* - * No need to setup pool limit for client pools. - */ - if (client == LDLM_NAMESPACE_SERVER) { - /* - * Check all modest namespaces first. - */ - mutex_lock(ldlm_namespace_lock(client)); - list_for_each_entry(ns, ldlm_namespace_list(client), - ns_list_chain) { - if (ns->ns_appetite != LDLM_NAMESPACE_MODEST) - continue; - - l = ldlm_pool_granted(&ns->ns_pool); - if (l == 0) - l = 1; - - /* - * Set the modest pools limit equal to their avg granted - * locks + ~6%. - */ - l += dru(l, LDLM_POOLS_MODEST_MARGIN_SHIFT, 0); - ldlm_pool_setup(&ns->ns_pool, l); - nr_l += l; - nr_p++; - } - - /* - * Make sure that modest namespaces did not eat more that 2/3 - * of limit. - */ - if (nr_l >= 2 * (LDLM_POOL_HOST_L / 3)) { - CWARN("\"Modest\" pools eat out 2/3 of server locks limit (%d of %lu). This means that you have too many clients for this amount of server RAM. Upgrade server!\n", - nr_l, LDLM_POOL_HOST_L); - equal = 1; - } - - /* - * The rest is given to greedy namespaces. - */ - list_for_each_entry(ns, ldlm_namespace_list(client), - ns_list_chain) { - if (!equal && ns->ns_appetite != LDLM_NAMESPACE_GREEDY) - continue; - - if (equal) { - /* - * In the case 2/3 locks are eaten out by - * modest pools, we re-setup equal limit - * for _all_ pools. - */ - l = LDLM_POOL_HOST_L / - ldlm_namespace_nr_read(client); - } else { - /* - * All the rest of greedy pools will have - * all locks in equal parts. - */ - l = (LDLM_POOL_HOST_L - nr_l) / - (ldlm_namespace_nr_read(client) - - nr_p); - } - ldlm_pool_setup(&ns->ns_pool, l); - } - mutex_unlock(ldlm_namespace_lock(client)); - } - - /* * Recalc at least ldlm_namespace_nr_read(client) namespaces. */ for (nr = ldlm_namespace_nr_read(client); nr > 0; nr--) { @@ -1330,7 +1017,7 @@ EXPORT_SYMBOL(ldlm_pools_recalc); static int ldlm_pools_thread_main(void *arg) { struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg; - int s_time, c_time; + int c_time; thread_set_flags(thread, SVC_RUNNING); wake_up(&thread->t_ctl_waitq); @@ -1344,14 +1031,13 @@ static int ldlm_pools_thread_main(void *arg) /* * Recal all pools on this tick. */ - s_time = ldlm_pools_recalc(LDLM_NAMESPACE_SERVER); c_time = ldlm_pools_recalc(LDLM_NAMESPACE_CLIENT); /* * Wait until the next check time, or until we're * stopped. */ - lwi = LWI_TIMEOUT(cfs_time_seconds(min(s_time, c_time)), + lwi = LWI_TIMEOUT(cfs_time_seconds(c_time), NULL, NULL); l_wait_event(thread->t_ctl_waitq, thread_is_stopping(thread) || @@ -1418,12 +1104,6 @@ static void ldlm_pools_thread_stop(void) ldlm_pools_thread = NULL; } -static struct shrinker ldlm_pools_srv_shrinker = { - .count_objects = ldlm_pools_srv_count, - .scan_objects = ldlm_pools_srv_scan, - .seeks = DEFAULT_SEEKS, -}; - static struct shrinker ldlm_pools_cli_shrinker = { .count_objects = ldlm_pools_cli_count, .scan_objects = ldlm_pools_cli_scan, @@ -1435,20 +1115,18 @@ int ldlm_pools_init(void) int rc; rc = ldlm_pools_thread_start(); - if (rc == 0) { - register_shrinker(&ldlm_pools_srv_shrinker); + if (rc == 0) register_shrinker(&ldlm_pools_cli_shrinker); - } + return rc; } EXPORT_SYMBOL(ldlm_pools_init); void ldlm_pools_fini(void) { - if (ldlm_pools_thread) { - unregister_shrinker(&ldlm_pools_srv_shrinker); + if (ldlm_pools_thread) unregister_shrinker(&ldlm_pools_cli_shrinker); - } + ldlm_pools_thread_stop(); } EXPORT_SYMBOL(ldlm_pools_fini); -- 2.1.0 From green at linuxhacker.ru Thu Oct 1 04:12:41 2015 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Thu, 1 Oct 2015 00:12:41 -0400 Subject: [lustre-devel] [PATCH 31/32] staging/lustre/ldlm: Remove posix lock (flock) deadlock detection In-Reply-To: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> References: <1443672762-982936-1-git-send-email-green@linuxhacker.ru> Message-ID: <1443672762-982936-32-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This is server-side code that cannot work on the client (vfs would do this check on the local node). Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 132 ------------------------ 1 file changed, 132 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index 57b4edb..0c46a06 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -91,40 +91,6 @@ ldlm_flocks_overlap(struct ldlm_lock *lock, struct ldlm_lock *new) lock->l_policy_data.l_flock.start)); } -static inline void ldlm_flock_blocking_link(struct ldlm_lock *req, - struct ldlm_lock *lock) -{ - /* For server only */ - if (req->l_export == NULL) - return; - - LASSERT(hlist_unhashed(&req->l_exp_flock_hash)); - - req->l_policy_data.l_flock.blocking_owner = - lock->l_policy_data.l_flock.owner; - req->l_policy_data.l_flock.blocking_export = - lock->l_export; - req->l_policy_data.l_flock.blocking_refs = 0; - - cfs_hash_add(req->l_export->exp_flock_hash, - &req->l_policy_data.l_flock.owner, - &req->l_exp_flock_hash); -} - -static inline void ldlm_flock_blocking_unlink(struct ldlm_lock *req) -{ - /* For server only */ - if (req->l_export == NULL) - return; - - check_res_locked(req->l_resource); - if (req->l_export->exp_flock_hash != NULL && - !hlist_unhashed(&req->l_exp_flock_hash)) - cfs_hash_del(req->l_export->exp_flock_hash, - &req->l_policy_data.l_flock.owner, - &req->l_exp_flock_hash); -} - static inline void ldlm_flock_destroy(struct ldlm_lock *lock, ldlm_mode_t mode, __u64 flags) { @@ -149,79 +115,6 @@ ldlm_flock_destroy(struct ldlm_lock *lock, ldlm_mode_t mode, __u64 flags) } /** - * POSIX locks deadlock detection code. - * - * Given a new lock \a req and an existing lock \a bl_lock it conflicts - * with, we need to iterate through all blocked POSIX locks for this - * export and see if there is a deadlock condition arising. (i.e. when - * one client holds a lock on something and want a lock on something - * else and at the same time another client has the opposite situation). - */ -static int -ldlm_flock_deadlock(struct ldlm_lock *req, struct ldlm_lock *bl_lock) -{ - struct obd_export *req_exp = req->l_export; - struct obd_export *bl_exp = bl_lock->l_export; - __u64 req_owner = req->l_policy_data.l_flock.owner; - __u64 bl_owner = bl_lock->l_policy_data.l_flock.owner; - - /* For server only */ - if (req_exp == NULL) - return 0; - - class_export_get(bl_exp); - while (1) { - struct obd_export *bl_exp_new; - struct ldlm_lock *lock = NULL; - struct ldlm_flock *flock; - - if (bl_exp->exp_flock_hash != NULL) - lock = cfs_hash_lookup(bl_exp->exp_flock_hash, - &bl_owner); - if (lock == NULL) - break; - - LASSERT(req != lock); - flock = &lock->l_policy_data.l_flock; - LASSERT(flock->owner == bl_owner); - bl_owner = flock->blocking_owner; - bl_exp_new = class_export_get(flock->blocking_export); - class_export_put(bl_exp); - - cfs_hash_put(bl_exp->exp_flock_hash, &lock->l_exp_flock_hash); - bl_exp = bl_exp_new; - - if (bl_owner == req_owner && bl_exp == req_exp) { - class_export_put(bl_exp); - return 1; - } - } - class_export_put(bl_exp); - - return 0; -} - -static void ldlm_flock_cancel_on_deadlock(struct ldlm_lock *lock, - struct list_head *work_list) -{ - CDEBUG(D_INFO, "reprocess deadlock req=%p\n", lock); - - if ((exp_connect_flags(lock->l_export) & - OBD_CONNECT_FLOCK_DEAD) == 0) { - CERROR( - "deadlock found, but client doesn't support flock canceliation\n"); - } else { - LASSERT(lock->l_completion_ast); - LASSERT((lock->l_flags & LDLM_FL_AST_SENT) == 0); - lock->l_flags |= LDLM_FL_AST_SENT | LDLM_FL_CANCEL_ON_BLOCK | - LDLM_FL_FLOCK_DEADLOCK; - ldlm_flock_blocking_unlink(lock); - ldlm_resource_unlink_lock(lock); - ldlm_add_ast_work_item(lock, NULL, work_list); - } -} - -/** * Process a granting attempt for flock lock. * Must be called under ns lock held. * @@ -307,11 +200,6 @@ reprocess: if (!first_enq) { reprocess_failed = 1; - if (ldlm_flock_deadlock(req, lock)) { - ldlm_flock_cancel_on_deadlock(req, - work_list); - return LDLM_ITER_CONTINUE; - } continue; } @@ -334,17 +222,6 @@ reprocess: return LDLM_ITER_STOP; } - /* add lock to blocking list before deadlock - * check to prevent race */ - ldlm_flock_blocking_link(req, lock); - - if (ldlm_flock_deadlock(req, lock)) { - ldlm_flock_blocking_unlink(req); - ldlm_flock_destroy(req, mode, *flags); - *err = -EDEADLK; - return LDLM_ITER_STOP; - } - ldlm_resource_add_lock(res, &res->lr_waiting, req); *flags |= LDLM_FL_BLOCK_GRANTED; return LDLM_ITER_STOP; @@ -360,10 +237,6 @@ reprocess: return LDLM_ITER_STOP; } - /* In case we had slept on this lock request take it off of the - * deadlock detection hash list. */ - ldlm_flock_blocking_unlink(req); - /* Scan the locks owned by this process that overlap this request. * We may have to merge or split existing locks. */ @@ -551,9 +424,7 @@ ldlm_flock_interrupted_wait(void *data) lock = ((struct ldlm_flock_wait_data *)data)->fwd_lock; - /* take lock off the deadlock detection hash list. */ lock_res_and_lock(lock); - ldlm_flock_blocking_unlink(lock); /* client side - set flag to prevent lock from being put on LRU list */ lock->l_flags |= LDLM_FL_CBPENDING; @@ -660,9 +531,6 @@ granted: lock_res_and_lock(lock); - /* take lock off the deadlock detection hash list. */ - ldlm_flock_blocking_unlink(lock); - /* ldlm_lock_enqueue() has already placed lock on the granted list. */ list_del_init(&lock->l_res_link); -- 2.1.0 From olaf at sgi.com Thu Oct 1 14:31:56 2015 From: olaf at sgi.com (Olaf Weber) Date: Thu, 1 Oct 2015 16:31:56 +0200 Subject: [lustre-devel] Channel Bonding Debug Information In-Reply-To: References: Message-ID: <560D43DC.2080600@sgi.com> On 28-09-15 21:30, Amir Shehata wrote: > Hello, > > As a followup on the discussion in the LAD developer summit, regarding > ensuring that there is enough debug information provided as part of the > Channel Bonding solution, I'm sending this email to ask for ideas on what > type of debug information you would like to see. > > thanks > amir Hi Amir, My random and disorganized thoughts. Significant state changes and anything unexpected should of course be logged. In addition I'd like interfaces that allow me to efficiently get the status/stats of a specific network interface or a specific peer, as opposed to only being able to get the information for all interfaces or peers and then having to filter. That may imply an ioctl type interface instead of or in addition to debugfs or sysfs (or procfs). For the local interfaces, stats include TX/RX counters, credits, interface state, and some measure of how busy the interface is. The latter can be derived by watching the TX/RX counters over time, but it would be nice to have it calculated. A variant on the "File Heat" idea presented at LAD might work for this. (Think decaying sum over recent activity.) When interfaces are associated with CPTs, the CPT number -- especially important if the kernel automatically associates an interface with a CPT. For the peers, a way to obtain the list of peers, and then to obtain the interfaces for each peer. Stats per peer interface include TX/RX counters and credits, perceived health, and maybe "heat". For a peer itself possibly totals, and peer health as perceived by the current node. A note on calculating heat: the full list of peer interfaces becomes large (on the servers of a large cluster) and you don't want to walk it without needing to. If you store a timestamp for the last use, then heat can be calculated when the TX/RX counters are updated or read, which is when the relevant datastructure is being accessed anyway. For local interfaces the list is likely small enough that this kind of approach isn't worth it. Moreover the list of local interfaces might be regularly walked to check on health etc. Olaf -- Olaf Weber SGI Phone: +31(0)30-6696796 Veldzigt 2b Fax: +31(0)30-6696799 Sr Software Engineer 3454 PW de Meern Vnet: 955-6796 Storage Software The Netherlands Email: olaf at sgi.com From aurelien.degremont at cea.fr Fri Oct 2 15:03:44 2015 From: aurelien.degremont at cea.fr (DEGREMONT Aurelien) Date: Fri, 2 Oct 2015 17:03:44 +0200 Subject: [lustre-devel] Channel Bonding Debug Information In-Reply-To: References: Message-ID: <560E9CD0.5010407@cea.fr> Hi As discussed at last Developer Summit, my concern is about transparent interface switching, without upper layer knowing it. I'm not talking about a lot of interface details, others already talked about that. I thinking about error messages and admins which are not Lustre experts. This is a typically timeout error message you can get on a Lustre client. You can see a lustre target (here MDT0000) and a NID, especially an IP address. [4863147.960698] Lustre: 25163:0:(client.c:1939:ptlrpc_expire_one_request()) @@@ Request sent has timed out for slow reply: [sent 1443794470/real 1443794470] req at ffff880612a00c00 x1509752994606324/t0(0) o38->lustre-MDT0000-mdc-ffff88062dea2000 at 10.2.10.13@o2ib:12/10 lens 400/544 e 0 to 1 dl 1443794476 ref 1 fl Rpc:XN/0/ffffffff rc 0/-1 If this error is due to LNET taking another link, either on client side or server side and this link is sick/flacky/buggy, ... *this should not be silent*! Ideally this NID should be updated in this error message to reflect the route change. I do not have a strong opinion on the way this error should be reported, but I just wanted the case where : the network error is reported only in debug message and this error message is displayed as-is, without any idea that LNET did some magic stuff that failed. Aurélien Le 28/09/2015 21:30, Amir Shehata a écrit : > Hello, > > As a followup on the discussion in the LAD developer summit, regarding > ensuring that there is enough debug information provided as part of > the Channel Bonding solution, I'm sending this email to ask for ideas > on what type of debug information you would like to see. > > thanks > amir > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From arnd at arndb.de Fri Oct 2 21:59:32 2015 From: arnd at arndb.de (Arnd Bergmann) Date: Fri, 02 Oct 2015 23:59:32 +0200 Subject: [lustre-devel] [PATCH] staging/lustre: Make nrs_policy_get_info_locked() static In-Reply-To: References: Message-ID: <20303308.pm05kd7Vsy@wuerfel> On Friday 02 October 2015 23:54:26 Rocco Folino wrote: > This patch fixes the warning generated by sparse: "symbol 'nrs_policy_get_info_locked' was not > declared. Should it be static?" by declaring the function static. > > Signed-off-by: Rocco Folino > Reviewed-by: Arnd Bergmann This probably triggered a sparse warning after the unused declaration was removed in my "staging/lustre: remove lots of dead code". From arnd at arndb.de Fri Oct 2 22:13:33 2015 From: arnd at arndb.de (Arnd Bergmann) Date: Sat, 03 Oct 2015 00:13:33 +0200 Subject: [lustre-devel] [PATCH] staging/lustre: Make nrs_policy_get_info_locked() static In-Reply-To: <201510030633.j7jTVT5b%fengguang.wu@intel.com> References: <201510030633.j7jTVT5b%fengguang.wu@intel.com> Message-ID: <5223334.NTtjKnhML6@wuerfel> On Saturday 03 October 2015 06:10:12 kbuild test robot wrote: > >> drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:456:13: error: static declaration of 'nrs_policy_get_info_locked' follows non-static declaration > static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, > ^ > In file included from drivers/staging/lustre/lustre/ptlrpc/../include/lustre_lib.h:64:0, > from drivers/staging/lustre/lustre/ptlrpc/../include/obd.h:52, > from drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:40: > drivers/staging/lustre/lustre/ptlrpc/../include/lustre_net.h:1542:6: note: previous declaration of 'nrs_policy_get_info_locked' was here > void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, > ^ > fwiw, the patch should be fine on staging-testing, just not on mainline at the moment. Arnd From morrone2 at llnl.gov Sat Oct 3 00:26:52 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Fri, 02 Oct 2015 17:26:52 -0700 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <1A2899D5-160B-4BC3-982D-DE6256F3D94B@intel.com> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov> <1A2899D5-160B-4BC3-982D-DE6256F3D94B@intel.com> Message-ID: <560F20CC.3020102@llnl.gov> On 09/30/2015 08:21 PM, Drokin, Oleg wrote: > > On Sep 30, 2015, at 8:32 PM, Christopher J. Morrone wrote: > >> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >>> I looked around to see where the helpers are used. It looks to me that they are always used in proc related functions. I agree with the issues you mentioned at the top of the email as well. >> >> Yes, but I meant to say we need to consider future use. Largely motivated by the effort to upstream the Lustre client into Linux, the /proc interfaces are slowly going away. So I was just suggesting that we should check that these functions will still be used by the new debugfs/sysfs/whatever interfaces in the future. Nothing really needed to consider though; they are generic enough to still be used well into the future. > > The thing with the upstream kernel is that effectively procfs was split into two parts. The parts that are 1 value per file are in sysfs, the rest is in ldiskfs and resuses huge chunks > of old code (including the functions mentioned). > This is not to say we cannot replace them, of course. > But upstream they want us to explore other avenues for many of our stuff too, like perf code for performance/usage gathering. > > Bye, > Oleg Yes, and ultimately they might be opposed to even doing this much parsing of user strings in kernel space. I can see an argument for sys files only taking simple integers, and leaving it to lustre libraries and command line tools to all niceties like specifying a number with units. But in the sort term, cleaning up these functions is only a good thing, I think. Chris From morrone2 at llnl.gov Sat Oct 3 00:29:40 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Fri, 02 Oct 2015 17:29:40 -0700 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <560C7F1A.30004@llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov> Message-ID: <560F2174.2040003@llnl.gov> It also occurs to me that we shouldn't really have a an integer multiplier parameter in the function definition. There should just be a simple "char default_units" parameter. The caller can specify which character is the default, and then there is no possibility of the multiplier being misused the way it currently is. Chris On 09/30/2015 05:32 PM, Christopher J. Morrone wrote: > On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >> I looked around to see where the helpers are used. It looks to me that >> they are always used in proc related functions. I agree with the >> issues you mentioned at the top of the email as well. > > Yes, but I meant to say we need to consider future use. Largely > motivated by the effort to upstream the Lustre client into Linux, the > /proc interfaces are slowly going away. So I was just suggesting that > we should check that these functions will still be used by the new > debugfs/sysfs/whatever interfaces in the future. Nothing really needed > to consider though; they are generic enough to still be used well into > the future. > > With that in mind, we should probably change the function names even > further. Instead of naming the functions after the current primary > callers, we should name them according to what they do. Perhaps > something along the lines of: str_to_u64(). > > That is just good naming practice anyway. When you are reading code and > you hit a call to a function named "helper", that doesn't give you much > of a clue as to what it does. > >> It also appears that the multiplier is never negative, so making it an >> unsigned int seems like the right way to go. I also noticed that >> lprocfs_write_frac_helper calls are always followed by a check if the >> value produced is greater than 0 and if not an error is thrown. This >> implies the signed version may not be necessary (and that maybe the >> unsigned helper should error with strings representing negative >> numbers?). >> >> Also, I think both the unsigned and signed methods parse the numeric >> portion of the string in a very similar fashion. At the very least, >> they appear to attempt to do the same thing. That is the portion I was >> going to consolidate down. > > Yes, the _u64_ functions almost certainly started out as a cut-and-paste > of the other functions. > >> You didn't comment on detecting overflow/underflow/wrapping. I still >> think those are a valid concern as well. > > I agree. It is completely reasonable to add those checks during the > refactoring. > >> Giuseppe >> ________________________________________ >> From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf >> of Christopher J. Morrone [morrone2 at llnl.gov] >> Sent: Tuesday, September 29, 2015 7:25 PM >> To: lustre-devel at lists.lustre.org >> Subject: Re: [lustre-devel] lprocfs Helper Issues >> >> I looked through the code a bit, and I think that the even bigger issues >> are the lack of reasonable naming, lack of comments, and a puzzling >> semantic inconsistency. >> >> Before working on any of the issues I mention below though, we should >> probably make sure that these functions still have a purpose once /proc >> goes away. They seem generic enough helpers that they will still be >> used with the non-/proc methods, but it is worth checking. >> >> First, consider this pair of names: >> >> lprocfs_write_frac_helper >> lprocfs_write_frac_u64_helper >> >> One might reasonably suspect that the major difference between these two >> functions is that the latter deails with a u64, and the former does not. >> But that is already pretty darn clear from the full function >> prototype, and really the main difference is that >> lprocfs_write_frac_u64_helper can parse a units character in the string. >> Maybe the name should be lprocfs_write_frac_units_helper. >> >> Also, the semantics surrounding the multiplier are field are different. >> For lprocfs_write_frac_helper the mult parameter is always enforced, >> and there is code that replies on that. With >> lprocfs_write_frac_u64_helper mult is merely a default, and the caller >> can't rely on it being used. Two functions with similar names but >> difference semantics (and not in the way implied by the name >> difference), and no function comments...not a good idea. >> >> Next there is the naming difference between these: >> >> lprocfs_write_frac_u64_helper >> lprocfs_write_u64_helper >> >> One might reasonably expect that when using the latter function one >> loses the ability to handle fractional numbers. But no, actually it >> just sets the multiplier to a default of 1. How does that naming make >> any sense? >> >> I suppose that with lprocfs_write_helper that naming style almost makes >> sense, because a multiplier of 1 will result in anything after the >> decimal point being calculated out to 0. So the fractional part is, in >> effect, ignored. But, strangely enough, fractions are still _accepted_ >> by the function. >> >> This semantic distinction is important to consider. It means that you >> can't just do a naive combination of the two functions into your >> proposed lprocfs_write_frac_helper_internal() function. There are >> callers of lprocfs_write_frac_helper that assume that the multiplier can >> be only the one specified and would result in incorrect number if there >> were user-specified units in the string. >> >> By the was, I'm not really in favor of duplicating the existing >> functions with a hope to remove the old ones at some time in the future. >> I think (despite current evidence to the contrary) that these >> functions are not so difficult to review that we would need a transition >> period. We would just need to audit every caller to make sure that any >> semantic changes are handled. >> >> And frankly, there would appear to be code that _already_ gets this >> wrong, so an audit is really needed already. For instance, >> ll_max_readahead_mb_seq_write() tries to be too clever by assuming that >> users can only provide an integer that represents number of MiB, and >> then passes in a multiplier that will have it convert into number of >> pages. But the since they used lprocfs_write_frac_u64_helper(), the >> user can specify their own units, and then the number returned number >> will be bytes instead of pages. Here are the callers that I found that >> are doing it wrong: >> >> ll_max_readahead_mb_seq_write >> ll_max_cached_mb_seq_write >> proc_max_dirty_pages_in_mb >> osc_cached_mb_seq_write >> >> 4 out of 5 are doing it wrong. Not a good track record. >> >> And getting back to the point, franctions and units are both accepted >> and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in the >> name is misleading at best. >> >> Why does lprocfs_write_frac_helper do its own handling of negatives and >> then call the unsigned simple_strtoul function? Why not just use the >> signed simple_strtol function? As far as I can tell the signed version >> of the function has been in Linux as long as the unsigned version. >> >> Why is mult declared as a signed int? I think it should almost >> certainly be unsigned. I think it might only be signed because the >> function author reuses mult as a local variable to stored the negative >> sign when parsed from the string. If so, that is a poor choice. The >> function declaration is a contract with the caller. If it makes no >> sense to pass in a negative multiplier, then the declaration should make >> that clear by declaring it unsigned. >> >> Why do the unsigned versions of the helper functions allow and parse >> negative numbers? I think that this gets to the heart of your >> suggestion about special handling for -1. I think that knowing that -1 >> has special meaning for something things is too specialized for the >> helper function. I think we are better off letting the caller decided >> what special handling to do and when. >> >> I would suggest that the main helper that does handling of >> user-specified units should not be casting the number to an unsigned >> value. Leave the casting to the caller, or perhaps provide a simple >> wrapper to cast away the sign. I don't think we are going to miss that >> one extra bit for positive numbers. >> >> So maybe we need the most generic function prototype be be something >> like: >> >> int lprocfs_write_helper(char *buffer, unsigned long count, __s64 *val, >> unsigned int mult, bool units_allowed); >> >> The function comment would explain that if units are allowed, then the >> multiplier is only a default and will be overridden by the >> user-specificed unit. >> >> Chris >> >> On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >>> Greetings, >>> >>> Recently, I've noticed that the lprocfs write frac int and u64 helpers >>> have a few issues. The biggest issue is that neither function handles >>> overflow/wrap. I also noticed very similar code that should be >>> consolidated down and leveraged by both helpers. >>> >>> I was thinking of refactoring the functions in the fashion described >>> below. >>> >>> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >>> count, __u64 *val, int mult); >>> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >>> unsigned long count, __u64 *val, int mult); >>> int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned >>> long count, int *val, int mult); >>> >>> lprocfs_write_frac_helper_internal would handle parsing an unsigned long >>> long from the kernel char buffer passed in. It will be responsible for >>> detecting if a uint wrap occurs. >>> >>> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >>> automatically return ULLONG_MAX. If any other string representing a >>> negative number is passed in, an invalid value error code should be >>> returned. If the multiplier is negative, that would also be treated as >>> invalid. The units and multiplier logic can also be consolidated. It >>> will use lprocfs_write_frac_helper_internal to handle the parsing. >>> >>> lprocfs_write_frac_helper_safe will leverage >>> lprocfs_write_frac_helper_internal. If >>> lprocfs_write_frac_helper_internal indicates a wrap occurred, then we >>> also have an invalid integer. Checks for integer overflow happen after a >>> successful call to the internal helper. This is similar to how the >>> current lprocfs_write_frac_helper functions. >>> >>> It is also worth nothing, I plan to maintain the old helpers and their >>> use can be gradually phased out once we are confident the refactored >>> version is doing what it is supposed to. >>> >>> Also, unrelated to the above, quick question about lctl. Is there a >>> particular reason why the setting to be changed when using lctl >>> set_param is echoed back to the user? I think it can be misleading in >>> cases where the value set is not necessarily what is being reflected to >>> the user (i.e. -1 for max value). That could be confusing to a user and >>> they should be using lctl get_param to confirm their value was set >>> anyways. Also, it would follow convention that unless an error happens, >>> nothing is printed to console. Any disagreements on silencing lctl >>> set_param? >>> >>> Thanks, >>> Giuseppe Di Natale >>> >>> >>> _______________________________________________ >>> lustre-devel mailing list >>> lustre-devel at lists.lustre.org >>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >> . >> > > . > From oleg.drokin at intel.com Sat Oct 3 00:29:52 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Sat, 3 Oct 2015 00:29:52 +0000 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <560F20CC.3020102@llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov> <1A2899D5-160B-4BC3-982D-DE6256F3D94B@intel.com> <560F20CC.3020102@llnl.gov> Message-ID: <3E6360C9-C6EA-4649-A9CF-F82A4CB0A241@intel.com> On Oct 2, 2015, at 8:26 PM, Christopher J. Morrone wrote: > On 09/30/2015 08:21 PM, Drokin, Oleg wrote: >> >> On Sep 30, 2015, at 8:32 PM, Christopher J. Morrone wrote: >> >>> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >>>> I looked around to see where the helpers are used. It looks to me that they are always used in proc related functions. I agree with the issues you mentioned at the top of the email as well. >>> >>> Yes, but I meant to say we need to consider future use. Largely motivated by the effort to upstream the Lustre client into Linux, the /proc interfaces are slowly going away. So I was just suggesting that we should check that these functions will still be used by the new debugfs/sysfs/whatever interfaces in the future. Nothing really needed to consider though; they are generic enough to still be used well into the future. >> >> The thing with the upstream kernel is that effectively procfs was split into two parts. The parts that are 1 value per file are in sysfs, the rest is in ldiskfs and resuses huge chunks >> of old code (including the functions mentioned). >> This is not to say we cannot replace them, of course. >> But upstream they want us to explore other avenues for many of our stuff too, like perf code for performance/usage gathering. > > Yes, and ultimately they might be opposed to even doing this much parsing of user strings in kernel space. I can see an argument for sys files only taking simple integers, and leaving it to lustre libraries and command line tools to all niceties like specifying a number with units. The universal agreement that I heard so far is "you can do whatever you want in debugfs as long as your code works with debugfs disabled". > But in the sort term, cleaning up these functions is only a good thing, I think. Indeed. Bye, Oleg From andreas.dilger at intel.com Sat Oct 3 09:54:39 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Sat, 3 Oct 2015 09:54:39 +0000 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <560F2174.2040003@llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov>,<560F2174.2040003@llnl.gov> Message-ID: What if the default unit is in pages? I don't think there is a common suffix for pages. Cheers, Andreas > On Oct 2, 2015, at 18:29, Christopher J. Morrone wrote: > > It also occurs to me that we shouldn't really have a an integer multiplier parameter in the function definition. There should just be a simple "char default_units" parameter. The caller can specify which character is the default, and then there is no possibility of the multiplier being misused the way it currently is. > > Chris > >> On 09/30/2015 05:32 PM, Christopher J. Morrone wrote: >>> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >>> I looked around to see where the helpers are used. It looks to me that >>> they are always used in proc related functions. I agree with the >>> issues you mentioned at the top of the email as well. >> >> Yes, but I meant to say we need to consider future use. Largely >> motivated by the effort to upstream the Lustre client into Linux, the >> /proc interfaces are slowly going away. So I was just suggesting that >> we should check that these functions will still be used by the new >> debugfs/sysfs/whatever interfaces in the future. Nothing really needed >> to consider though; they are generic enough to still be used well into >> the future. >> >> With that in mind, we should probably change the function names even >> further. Instead of naming the functions after the current primary >> callers, we should name them according to what they do. Perhaps >> something along the lines of: str_to_u64(). >> >> That is just good naming practice anyway. When you are reading code and >> you hit a call to a function named "helper", that doesn't give you much >> of a clue as to what it does. >> >>> It also appears that the multiplier is never negative, so making it an >>> unsigned int seems like the right way to go. I also noticed that >>> lprocfs_write_frac_helper calls are always followed by a check if the >>> value produced is greater than 0 and if not an error is thrown. This >>> implies the signed version may not be necessary (and that maybe the >>> unsigned helper should error with strings representing negative >>> numbers?). >>> >>> Also, I think both the unsigned and signed methods parse the numeric >>> portion of the string in a very similar fashion. At the very least, >>> they appear to attempt to do the same thing. That is the portion I was >>> going to consolidate down. >> >> Yes, the _u64_ functions almost certainly started out as a cut-and-paste >> of the other functions. >> >>> You didn't comment on detecting overflow/underflow/wrapping. I still >>> think those are a valid concern as well. >> >> I agree. It is completely reasonable to add those checks during the >> refactoring. >> >>> Giuseppe >>> ________________________________________ >>> From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf >>> of Christopher J. Morrone [morrone2 at llnl.gov] >>> Sent: Tuesday, September 29, 2015 7:25 PM >>> To: lustre-devel at lists.lustre.org >>> Subject: Re: [lustre-devel] lprocfs Helper Issues >>> >>> I looked through the code a bit, and I think that the even bigger issues >>> are the lack of reasonable naming, lack of comments, and a puzzling >>> semantic inconsistency. >>> >>> Before working on any of the issues I mention below though, we should >>> probably make sure that these functions still have a purpose once /proc >>> goes away. They seem generic enough helpers that they will still be >>> used with the non-/proc methods, but it is worth checking. >>> >>> First, consider this pair of names: >>> >>> lprocfs_write_frac_helper >>> lprocfs_write_frac_u64_helper >>> >>> One might reasonably suspect that the major difference between these two >>> functions is that the latter deails with a u64, and the former does not. >>> But that is already pretty darn clear from the full function >>> prototype, and really the main difference is that >>> lprocfs_write_frac_u64_helper can parse a units character in the string. >>> Maybe the name should be lprocfs_write_frac_units_helper. >>> >>> Also, the semantics surrounding the multiplier are field are different. >>> For lprocfs_write_frac_helper the mult parameter is always enforced, >>> and there is code that replies on that. With >>> lprocfs_write_frac_u64_helper mult is merely a default, and the caller >>> can't rely on it being used. Two functions with similar names but >>> difference semantics (and not in the way implied by the name >>> difference), and no function comments...not a good idea. >>> >>> Next there is the naming difference between these: >>> >>> lprocfs_write_frac_u64_helper >>> lprocfs_write_u64_helper >>> >>> One might reasonably expect that when using the latter function one >>> loses the ability to handle fractional numbers. But no, actually it >>> just sets the multiplier to a default of 1. How does that naming make >>> any sense? >>> >>> I suppose that with lprocfs_write_helper that naming style almost makes >>> sense, because a multiplier of 1 will result in anything after the >>> decimal point being calculated out to 0. So the fractional part is, in >>> effect, ignored. But, strangely enough, fractions are still _accepted_ >>> by the function. >>> >>> This semantic distinction is important to consider. It means that you >>> can't just do a naive combination of the two functions into your >>> proposed lprocfs_write_frac_helper_internal() function. There are >>> callers of lprocfs_write_frac_helper that assume that the multiplier can >>> be only the one specified and would result in incorrect number if there >>> were user-specified units in the string. >>> >>> By the was, I'm not really in favor of duplicating the existing >>> functions with a hope to remove the old ones at some time in the future. >>> I think (despite current evidence to the contrary) that these >>> functions are not so difficult to review that we would need a transition >>> period. We would just need to audit every caller to make sure that any >>> semantic changes are handled. >>> >>> And frankly, there would appear to be code that _already_ gets this >>> wrong, so an audit is really needed already. For instance, >>> ll_max_readahead_mb_seq_write() tries to be too clever by assuming that >>> users can only provide an integer that represents number of MiB, and >>> then passes in a multiplier that will have it convert into number of >>> pages. But the since they used lprocfs_write_frac_u64_helper(), the >>> user can specify their own units, and then the number returned number >>> will be bytes instead of pages. Here are the callers that I found that >>> are doing it wrong: >>> >>> ll_max_readahead_mb_seq_write >>> ll_max_cached_mb_seq_write >>> proc_max_dirty_pages_in_mb >>> osc_cached_mb_seq_write >>> >>> 4 out of 5 are doing it wrong. Not a good track record. >>> >>> And getting back to the point, franctions and units are both accepted >>> and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in the >>> name is misleading at best. >>> >>> Why does lprocfs_write_frac_helper do its own handling of negatives and >>> then call the unsigned simple_strtoul function? Why not just use the >>> signed simple_strtol function? As far as I can tell the signed version >>> of the function has been in Linux as long as the unsigned version. >>> >>> Why is mult declared as a signed int? I think it should almost >>> certainly be unsigned. I think it might only be signed because the >>> function author reuses mult as a local variable to stored the negative >>> sign when parsed from the string. If so, that is a poor choice. The >>> function declaration is a contract with the caller. If it makes no >>> sense to pass in a negative multiplier, then the declaration should make >>> that clear by declaring it unsigned. >>> >>> Why do the unsigned versions of the helper functions allow and parse >>> negative numbers? I think that this gets to the heart of your >>> suggestion about special handling for -1. I think that knowing that -1 >>> has special meaning for something things is too specialized for the >>> helper function. I think we are better off letting the caller decided >>> what special handling to do and when. >>> >>> I would suggest that the main helper that does handling of >>> user-specified units should not be casting the number to an unsigned >>> value. Leave the casting to the caller, or perhaps provide a simple >>> wrapper to cast away the sign. I don't think we are going to miss that >>> one extra bit for positive numbers. >>> >>> So maybe we need the most generic function prototype be be something >>> like: >>> >>> int lprocfs_write_helper(char *buffer, unsigned long count, __s64 *val, >>> unsigned int mult, bool units_allowed); >>> >>> The function comment would explain that if units are allowed, then the >>> multiplier is only a default and will be overridden by the >>> user-specificed unit. >>> >>> Chris >>> >>>> On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >>>> Greetings, >>>> >>>> Recently, I've noticed that the lprocfs write frac int and u64 helpers >>>> have a few issues. The biggest issue is that neither function handles >>>> overflow/wrap. I also noticed very similar code that should be >>>> consolidated down and leveraged by both helpers. >>>> >>>> I was thinking of refactoring the functions in the fashion described >>>> below. >>>> >>>> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >>>> count, __u64 *val, int mult); >>>> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >>>> unsigned long count, __u64 *val, int mult); >>>> int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned >>>> long count, int *val, int mult); >>>> >>>> lprocfs_write_frac_helper_internal would handle parsing an unsigned long >>>> long from the kernel char buffer passed in. It will be responsible for >>>> detecting if a uint wrap occurs. >>>> >>>> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >>>> automatically return ULLONG_MAX. If any other string representing a >>>> negative number is passed in, an invalid value error code should be >>>> returned. If the multiplier is negative, that would also be treated as >>>> invalid. The units and multiplier logic can also be consolidated. It >>>> will use lprocfs_write_frac_helper_internal to handle the parsing. >>>> >>>> lprocfs_write_frac_helper_safe will leverage >>>> lprocfs_write_frac_helper_internal. If >>>> lprocfs_write_frac_helper_internal indicates a wrap occurred, then we >>>> also have an invalid integer. Checks for integer overflow happen after a >>>> successful call to the internal helper. This is similar to how the >>>> current lprocfs_write_frac_helper functions. >>>> >>>> It is also worth nothing, I plan to maintain the old helpers and their >>>> use can be gradually phased out once we are confident the refactored >>>> version is doing what it is supposed to. >>>> >>>> Also, unrelated to the above, quick question about lctl. Is there a >>>> particular reason why the setting to be changed when using lctl >>>> set_param is echoed back to the user? I think it can be misleading in >>>> cases where the value set is not necessarily what is being reflected to >>>> the user (i.e. -1 for max value). That could be confusing to a user and >>>> they should be using lctl get_param to confirm their value was set >>>> anyways. Also, it would follow convention that unless an error happens, >>>> nothing is printed to console. Any disagreements on silencing lctl >>>> set_param? >>>> >>>> Thanks, >>>> Giuseppe Di Natale >>>> >>>> >>>> _______________________________________________ >>>> lustre-devel mailing list >>>> lustre-devel at lists.lustre.org >>>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>>> >>> >>> _______________________________________________ >>> lustre-devel mailing list >>> lustre-devel at lists.lustre.org >>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>> _______________________________________________ >>> lustre-devel mailing list >>> lustre-devel at lists.lustre.org >>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>> . >>> >> >> . >> > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From andreas.dilger at intel.com Mon Oct 5 06:20:25 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Mon, 5 Oct 2015 06:20:25 +0000 Subject: [lustre-devel] Multi-Rail Debug Information Message-ID: I think there are two separate issues here. The message below is a PtlRPC layer message, so the important part is the target name and NID where the service is currently running. That is enough to determine which _node_ the service is running on for diagnosing service problems (which is what PtlRPC cares about), but not which _path_ the message took. This is true if there are LNet routers as well, so I don't think the multi-path usage is any worse than a routed configuration in this regard. I think if there is multi-rail LNet then any messages about channel failure need to be printed by the LNet layer. This will allow debugging link-level failures as needed, even while the PtlRPC-level messages continue to work over alternate paths. Cheers, Andreas PS: I changed the subject from "Channel Bonding" to "Multi-Rail" since I agree with Olaf that this project isn't really implementing a "bonded" network (which IMHO implies configuration of a bonded device used as the target NID), but rather an "self-configuring multi-path redundancy" which IMHO is more robust and easier to use (little config in many cases, and no need for an external NID naming service). -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division On 2015/10/02, 9:03 AM, "lustre-devel on behalf of DEGREMONT Aurelien" on behalf of aurelien.degremont at cea.fr> wrote: Hi As discussed at last Developer Summit, my concern is about transparent interface switching, without upper layer knowing it. I'm not talking about a lot of interface details, others already talked about that. I thinking about error messages and admins which are not Lustre experts. This is a typically timeout error message you can get on a Lustre client. You can see a lustre target (here MDT0000) and a NID, especially an IP address. [4863147.960698] Lustre: 25163:0:(client.c:1939:ptlrpc_expire_one_request()) @@@ Request sent has timed out for slow reply: [sent 1443794470/real 1443794470] req at ffff880612a00c00 x1509752994606324/t0(0) o38->lustre-MDT0000-mdc-ffff88062dea2000 at 10.2.10.13@o2ib:12/10 lens 400/544 e 0 to 1 dl 1443794476 ref 1 fl Rpc:XN/0/ffffffff rc 0/-1 If this error is due to LNET taking another link, either on client side or server side and this link is sick/flacky/buggy, ... *this should not be silent*! Ideally this NID should be updated in this error message to reflect the route change. I do not have a strong opinion on the way this error should be reported, but I just wanted the case where : the network error is reported only in debug message and this error message is displayed as-is, without any idea that LNET did some magic stuff that failed. Aurélien Le 28/09/2015 21:30, Amir Shehata a écrit : Hello, As a followup on the discussion in the LAD developer summit, regarding ensuring that there is enough debug information provided as part of the Channel Bonding solution, I'm sending this email to ask for ideas on what type of debug information you would like to see. thanks amir _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.orghttp://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From olaf at sgi.com Mon Oct 5 17:51:13 2015 From: olaf at sgi.com (Olaf Weber) Date: Mon, 5 Oct 2015 19:51:13 +0200 Subject: [lustre-devel] Multi-Rail Debug Information In-Reply-To: References: Message-ID: <5612B891.4020904@sgi.com> For debugging this kind of issue, I see several ways to provide useful information. One is for LNet to log the issues it sees, for example when sending a message on one interface times out and another one is selected. The other one is maintaining some of this information in the interface state. This would be counters indicating how often an interface has seen timeouts and other unexpected conditions (which may or may not be actual errors). Retrieving the interface state should get you those counters as well. (To a first approximation: whenever you emit a log message for some condition, the relevant counter is bumped as well.) The main problem with counters is that it becomes difficult to distinguish old from new errors. This is where decaying sums ("heat") might be useful. Ideally I'd get both, but if I have to choose just one I'll pick the lifetime count over the decaying one. Olaf On 05-10-15 08:20, Dilger, Andreas wrote: > I think there are two separate issues here. The message below is a PtlRPC layer message, so the important part is the target name and NID where the service is currently running. That is enough to determine which _node_ the service is running on for diagnosing service problems (which is what PtlRPC cares about), but not which _path_ the message took. This is true if there are LNet routers as well, so I don't think the multi-path usage is any worse than a routed configuration in this regard. > > I think if there is multi-rail LNet then any messages about channel failure need to be printed by the LNet layer. This will allow debugging link-level failures as needed, even while the PtlRPC-level messages continue to work over alternate paths. > > Cheers, Andreas > > PS: I changed the subject from "Channel Bonding" to "Multi-Rail" since I agree with Olaf that this project isn't really implementing a "bonded" network (which IMHO implies configuration of a bonded device used as the target NID), but rather an "self-configuring multi-path redundancy" which IMHO is more robust and easier to use (little config in many cases, and no need for an external NID naming service). > -- > Andreas Dilger > Lustre Software Architect > Intel High Performance Data Division > > On 2015/10/02, 9:03 AM, "lustre-devel on behalf of DEGREMONT Aurelien" on behalf of aurelien.degremont at cea.fr> wrote: > > Hi > > As discussed at last Developer Summit, my concern is about transparent interface switching, without upper layer knowing it. > I'm not talking about a lot of interface details, others already talked about that. I thinking about error messages and admins which are not Lustre experts. > > This is a typically timeout error message you can get on a Lustre client. You can see a lustre target (here MDT0000) and a NID, especially an IP address. > > [4863147.960698] Lustre: 25163:0:(client.c:1939:ptlrpc_expire_one_request()) @@@ Request sent has timed out for slow reply: [sent 1443794470/real 1443794470] req at ffff880612a00c00 x1509752994606324/t0(0) o38->lustre-MDT0000-mdc-ffff88062dea2000 at 10.2.10.13@o2ib:12/10 lens 400/544 e 0 to 1 dl 1443794476 ref 1 fl Rpc:XN/0/ffffffff rc 0/-1 > > If this error is due to LNET taking another link, either on client side or server side and this link is sick/flacky/buggy, ... *this should not be silent*! Ideally this NID should be updated in this error message to reflect the route change. > I do not have a strong opinion on the way this error should be reported, but I just wanted the case where : the network error is reported only in debug message and this error message is displayed as-is, without any idea that LNET did some magic stuff that failed. > > > > Aurélien > > Le 28/09/2015 21:30, Amir Shehata a écrit : > Hello, > > As a followup on the discussion in the LAD developer summit, regarding ensuring that there is enough debug information provided as part of the Channel Bonding solution, I'm sending this email to ask for ideas on what type of debug information you would like to see. > > thanks > amir > > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.orghttp://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > -- Olaf Weber SGI Phone: +31(0)30-6696796 Veldzigt 2b Fax: +31(0)30-6696799 Sr Software Engineer 3454 PW de Meern Vnet: 955-6796 Storage Software The Netherlands Email: olaf at sgi.com From morrone2 at llnl.gov Mon Oct 5 21:52:06 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Mon, 05 Oct 2015 14:52:06 -0700 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov>, <560F2174.2040003@llnl.gov> Message-ID: <5612F106.1070601@llnl.gov> I don't recall any proc files that accepted pages. I certainly remember callers sending a multiplier that resulted in the string parsing function doing the conversion to pages. But those very callers are the ones that break when the string specifies a unit. The code authors failed to realize that, so this would let us avoid that mistake in the future. I don't think it is terribly onerous to do the bit shifting in the caller instead of passing the multiplier as parameter to the string conversion function. I think it might even make the code a little more readable. Chris On 10/03/2015 02:54 AM, Dilger, Andreas wrote: > What if the default unit is in pages? I don't think there is a common suffix for pages. > > Cheers, Andreas > >> On Oct 2, 2015, at 18:29, Christopher J. Morrone wrote: >> >> It also occurs to me that we shouldn't really have a an integer multiplier parameter in the function definition. There should just be a simple "char default_units" parameter. The caller can specify which character is the default, and then there is no possibility of the multiplier being misused the way it currently is. >> >> Chris >> >>> On 09/30/2015 05:32 PM, Christopher J. Morrone wrote: >>>> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >>>> I looked around to see where the helpers are used. It looks to me that >>>> they are always used in proc related functions. I agree with the >>>> issues you mentioned at the top of the email as well. >>> >>> Yes, but I meant to say we need to consider future use. Largely >>> motivated by the effort to upstream the Lustre client into Linux, the >>> /proc interfaces are slowly going away. So I was just suggesting that >>> we should check that these functions will still be used by the new >>> debugfs/sysfs/whatever interfaces in the future. Nothing really needed >>> to consider though; they are generic enough to still be used well into >>> the future. >>> >>> With that in mind, we should probably change the function names even >>> further. Instead of naming the functions after the current primary >>> callers, we should name them according to what they do. Perhaps >>> something along the lines of: str_to_u64(). >>> >>> That is just good naming practice anyway. When you are reading code and >>> you hit a call to a function named "helper", that doesn't give you much >>> of a clue as to what it does. >>> >>>> It also appears that the multiplier is never negative, so making it an >>>> unsigned int seems like the right way to go. I also noticed that >>>> lprocfs_write_frac_helper calls are always followed by a check if the >>>> value produced is greater than 0 and if not an error is thrown. This >>>> implies the signed version may not be necessary (and that maybe the >>>> unsigned helper should error with strings representing negative >>>> numbers?). >>>> >>>> Also, I think both the unsigned and signed methods parse the numeric >>>> portion of the string in a very similar fashion. At the very least, >>>> they appear to attempt to do the same thing. That is the portion I was >>>> going to consolidate down. >>> >>> Yes, the _u64_ functions almost certainly started out as a cut-and-paste >>> of the other functions. >>> >>>> You didn't comment on detecting overflow/underflow/wrapping. I still >>>> think those are a valid concern as well. >>> >>> I agree. It is completely reasonable to add those checks during the >>> refactoring. >>> >>>> Giuseppe >>>> ________________________________________ >>>> From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf >>>> of Christopher J. Morrone [morrone2 at llnl.gov] >>>> Sent: Tuesday, September 29, 2015 7:25 PM >>>> To: lustre-devel at lists.lustre.org >>>> Subject: Re: [lustre-devel] lprocfs Helper Issues >>>> >>>> I looked through the code a bit, and I think that the even bigger issues >>>> are the lack of reasonable naming, lack of comments, and a puzzling >>>> semantic inconsistency. >>>> >>>> Before working on any of the issues I mention below though, we should >>>> probably make sure that these functions still have a purpose once /proc >>>> goes away. They seem generic enough helpers that they will still be >>>> used with the non-/proc methods, but it is worth checking. >>>> >>>> First, consider this pair of names: >>>> >>>> lprocfs_write_frac_helper >>>> lprocfs_write_frac_u64_helper >>>> >>>> One might reasonably suspect that the major difference between these two >>>> functions is that the latter deails with a u64, and the former does not. >>>> But that is already pretty darn clear from the full function >>>> prototype, and really the main difference is that >>>> lprocfs_write_frac_u64_helper can parse a units character in the string. >>>> Maybe the name should be lprocfs_write_frac_units_helper. >>>> >>>> Also, the semantics surrounding the multiplier are field are different. >>>> For lprocfs_write_frac_helper the mult parameter is always enforced, >>>> and there is code that replies on that. With >>>> lprocfs_write_frac_u64_helper mult is merely a default, and the caller >>>> can't rely on it being used. Two functions with similar names but >>>> difference semantics (and not in the way implied by the name >>>> difference), and no function comments...not a good idea. >>>> >>>> Next there is the naming difference between these: >>>> >>>> lprocfs_write_frac_u64_helper >>>> lprocfs_write_u64_helper >>>> >>>> One might reasonably expect that when using the latter function one >>>> loses the ability to handle fractional numbers. But no, actually it >>>> just sets the multiplier to a default of 1. How does that naming make >>>> any sense? >>>> >>>> I suppose that with lprocfs_write_helper that naming style almost makes >>>> sense, because a multiplier of 1 will result in anything after the >>>> decimal point being calculated out to 0. So the fractional part is, in >>>> effect, ignored. But, strangely enough, fractions are still _accepted_ >>>> by the function. >>>> >>>> This semantic distinction is important to consider. It means that you >>>> can't just do a naive combination of the two functions into your >>>> proposed lprocfs_write_frac_helper_internal() function. There are >>>> callers of lprocfs_write_frac_helper that assume that the multiplier can >>>> be only the one specified and would result in incorrect number if there >>>> were user-specified units in the string. >>>> >>>> By the was, I'm not really in favor of duplicating the existing >>>> functions with a hope to remove the old ones at some time in the future. >>>> I think (despite current evidence to the contrary) that these >>>> functions are not so difficult to review that we would need a transition >>>> period. We would just need to audit every caller to make sure that any >>>> semantic changes are handled. >>>> >>>> And frankly, there would appear to be code that _already_ gets this >>>> wrong, so an audit is really needed already. For instance, >>>> ll_max_readahead_mb_seq_write() tries to be too clever by assuming that >>>> users can only provide an integer that represents number of MiB, and >>>> then passes in a multiplier that will have it convert into number of >>>> pages. But the since they used lprocfs_write_frac_u64_helper(), the >>>> user can specify their own units, and then the number returned number >>>> will be bytes instead of pages. Here are the callers that I found that >>>> are doing it wrong: >>>> >>>> ll_max_readahead_mb_seq_write >>>> ll_max_cached_mb_seq_write >>>> proc_max_dirty_pages_in_mb >>>> osc_cached_mb_seq_write >>>> >>>> 4 out of 5 are doing it wrong. Not a good track record. >>>> >>>> And getting back to the point, franctions and units are both accepted >>>> and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in the >>>> name is misleading at best. >>>> >>>> Why does lprocfs_write_frac_helper do its own handling of negatives and >>>> then call the unsigned simple_strtoul function? Why not just use the >>>> signed simple_strtol function? As far as I can tell the signed version >>>> of the function has been in Linux as long as the unsigned version. >>>> >>>> Why is mult declared as a signed int? I think it should almost >>>> certainly be unsigned. I think it might only be signed because the >>>> function author reuses mult as a local variable to stored the negative >>>> sign when parsed from the string. If so, that is a poor choice. The >>>> function declaration is a contract with the caller. If it makes no >>>> sense to pass in a negative multiplier, then the declaration should make >>>> that clear by declaring it unsigned. >>>> >>>> Why do the unsigned versions of the helper functions allow and parse >>>> negative numbers? I think that this gets to the heart of your >>>> suggestion about special handling for -1. I think that knowing that -1 >>>> has special meaning for something things is too specialized for the >>>> helper function. I think we are better off letting the caller decided >>>> what special handling to do and when. >>>> >>>> I would suggest that the main helper that does handling of >>>> user-specified units should not be casting the number to an unsigned >>>> value. Leave the casting to the caller, or perhaps provide a simple >>>> wrapper to cast away the sign. I don't think we are going to miss that >>>> one extra bit for positive numbers. >>>> >>>> So maybe we need the most generic function prototype be be something >>>> like: >>>> >>>> int lprocfs_write_helper(char *buffer, unsigned long count, __s64 *val, >>>> unsigned int mult, bool units_allowed); >>>> >>>> The function comment would explain that if units are allowed, then the >>>> multiplier is only a default and will be overridden by the >>>> user-specificed unit. >>>> >>>> Chris >>>> >>>>> On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >>>>> Greetings, >>>>> >>>>> Recently, I've noticed that the lprocfs write frac int and u64 helpers >>>>> have a few issues. The biggest issue is that neither function handles >>>>> overflow/wrap. I also noticed very similar code that should be >>>>> consolidated down and leveraged by both helpers. >>>>> >>>>> I was thinking of refactoring the functions in the fashion described >>>>> below. >>>>> >>>>> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >>>>> count, __u64 *val, int mult); >>>>> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >>>>> unsigned long count, __u64 *val, int mult); >>>>> int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned >>>>> long count, int *val, int mult); >>>>> >>>>> lprocfs_write_frac_helper_internal would handle parsing an unsigned long >>>>> long from the kernel char buffer passed in. It will be responsible for >>>>> detecting if a uint wrap occurs. >>>>> >>>>> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >>>>> automatically return ULLONG_MAX. If any other string representing a >>>>> negative number is passed in, an invalid value error code should be >>>>> returned. If the multiplier is negative, that would also be treated as >>>>> invalid. The units and multiplier logic can also be consolidated. It >>>>> will use lprocfs_write_frac_helper_internal to handle the parsing. >>>>> >>>>> lprocfs_write_frac_helper_safe will leverage >>>>> lprocfs_write_frac_helper_internal. If >>>>> lprocfs_write_frac_helper_internal indicates a wrap occurred, then we >>>>> also have an invalid integer. Checks for integer overflow happen after a >>>>> successful call to the internal helper. This is similar to how the >>>>> current lprocfs_write_frac_helper functions. >>>>> >>>>> It is also worth nothing, I plan to maintain the old helpers and their >>>>> use can be gradually phased out once we are confident the refactored >>>>> version is doing what it is supposed to. >>>>> >>>>> Also, unrelated to the above, quick question about lctl. Is there a >>>>> particular reason why the setting to be changed when using lctl >>>>> set_param is echoed back to the user? I think it can be misleading in >>>>> cases where the value set is not necessarily what is being reflected to >>>>> the user (i.e. -1 for max value). That could be confusing to a user and >>>>> they should be using lctl get_param to confirm their value was set >>>>> anyways. Also, it would follow convention that unless an error happens, >>>>> nothing is printed to console. Any disagreements on silencing lctl >>>>> set_param? >>>>> >>>>> Thanks, >>>>> Giuseppe Di Natale >>>>> >>>>> >>>>> _______________________________________________ >>>>> lustre-devel mailing list >>>>> lustre-devel at lists.lustre.org >>>>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>>>> >>>> >>>> _______________________________________________ >>>> lustre-devel mailing list >>>> lustre-devel at lists.lustre.org >>>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>>> _______________________________________________ >>>> lustre-devel mailing list >>>> lustre-devel at lists.lustre.org >>>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>>> . >>>> >>> >>> . >>> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > . > From dinatale2 at llnl.gov Mon Oct 5 22:47:36 2015 From: dinatale2 at llnl.gov (Di Natale, Giuseppe) Date: Mon, 5 Oct 2015 22:47:36 +0000 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <5612F106.1070601@llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov>, <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov>, <560F2174.2040003@llnl.gov> , <5612F106.1070601@llnl.gov> Message-ID: <974262C966B9F640899A48EB96313E9A2CB546@PRDEXMBX-08.the-lab.llnl.gov> The other option is to have two slightly different versions of the function. One will accept units and the other won't. The one that doesn't accept units would error if something other than numbers and a decimal are present. This would create an interface which would clearly represent the caller's intent (units vs no units). Giuseppe ________________________________________ From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Christopher J. Morrone [morrone2 at llnl.gov] Sent: Monday, October 05, 2015 2:52 PM To: Dilger, Andreas Cc: lustre-devel at lists.lustre.org Subject: Re: [lustre-devel] lprocfs Helper Issues I don't recall any proc files that accepted pages. I certainly remember callers sending a multiplier that resulted in the string parsing function doing the conversion to pages. But those very callers are the ones that break when the string specifies a unit. The code authors failed to realize that, so this would let us avoid that mistake in the future. I don't think it is terribly onerous to do the bit shifting in the caller instead of passing the multiplier as parameter to the string conversion function. I think it might even make the code a little more readable. Chris On 10/03/2015 02:54 AM, Dilger, Andreas wrote: > What if the default unit is in pages? I don't think there is a common suffix for pages. > > Cheers, Andreas > >> On Oct 2, 2015, at 18:29, Christopher J. Morrone wrote: >> >> It also occurs to me that we shouldn't really have a an integer multiplier parameter in the function definition. There should just be a simple "char default_units" parameter. The caller can specify which character is the default, and then there is no possibility of the multiplier being misused the way it currently is. >> >> Chris >> >>> On 09/30/2015 05:32 PM, Christopher J. Morrone wrote: >>>> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >>>> I looked around to see where the helpers are used. It looks to me that >>>> they are always used in proc related functions. I agree with the >>>> issues you mentioned at the top of the email as well. >>> >>> Yes, but I meant to say we need to consider future use. Largely >>> motivated by the effort to upstream the Lustre client into Linux, the >>> /proc interfaces are slowly going away. So I was just suggesting that >>> we should check that these functions will still be used by the new >>> debugfs/sysfs/whatever interfaces in the future. Nothing really needed >>> to consider though; they are generic enough to still be used well into >>> the future. >>> >>> With that in mind, we should probably change the function names even >>> further. Instead of naming the functions after the current primary >>> callers, we should name them according to what they do. Perhaps >>> something along the lines of: str_to_u64(). >>> >>> That is just good naming practice anyway. When you are reading code and >>> you hit a call to a function named "helper", that doesn't give you much >>> of a clue as to what it does. >>> >>>> It also appears that the multiplier is never negative, so making it an >>>> unsigned int seems like the right way to go. I also noticed that >>>> lprocfs_write_frac_helper calls are always followed by a check if the >>>> value produced is greater than 0 and if not an error is thrown. This >>>> implies the signed version may not be necessary (and that maybe the >>>> unsigned helper should error with strings representing negative >>>> numbers?). >>>> >>>> Also, I think both the unsigned and signed methods parse the numeric >>>> portion of the string in a very similar fashion. At the very least, >>>> they appear to attempt to do the same thing. That is the portion I was >>>> going to consolidate down. >>> >>> Yes, the _u64_ functions almost certainly started out as a cut-and-paste >>> of the other functions. >>> >>>> You didn't comment on detecting overflow/underflow/wrapping. I still >>>> think those are a valid concern as well. >>> >>> I agree. It is completely reasonable to add those checks during the >>> refactoring. >>> >>>> Giuseppe >>>> ________________________________________ >>>> From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf >>>> of Christopher J. Morrone [morrone2 at llnl.gov] >>>> Sent: Tuesday, September 29, 2015 7:25 PM >>>> To: lustre-devel at lists.lustre.org >>>> Subject: Re: [lustre-devel] lprocfs Helper Issues >>>> >>>> I looked through the code a bit, and I think that the even bigger issues >>>> are the lack of reasonable naming, lack of comments, and a puzzling >>>> semantic inconsistency. >>>> >>>> Before working on any of the issues I mention below though, we should >>>> probably make sure that these functions still have a purpose once /proc >>>> goes away. They seem generic enough helpers that they will still be >>>> used with the non-/proc methods, but it is worth checking. >>>> >>>> First, consider this pair of names: >>>> >>>> lprocfs_write_frac_helper >>>> lprocfs_write_frac_u64_helper >>>> >>>> One might reasonably suspect that the major difference between these two >>>> functions is that the latter deails with a u64, and the former does not. >>>> But that is already pretty darn clear from the full function >>>> prototype, and really the main difference is that >>>> lprocfs_write_frac_u64_helper can parse a units character in the string. >>>> Maybe the name should be lprocfs_write_frac_units_helper. >>>> >>>> Also, the semantics surrounding the multiplier are field are different. >>>> For lprocfs_write_frac_helper the mult parameter is always enforced, >>>> and there is code that replies on that. With >>>> lprocfs_write_frac_u64_helper mult is merely a default, and the caller >>>> can't rely on it being used. Two functions with similar names but >>>> difference semantics (and not in the way implied by the name >>>> difference), and no function comments...not a good idea. >>>> >>>> Next there is the naming difference between these: >>>> >>>> lprocfs_write_frac_u64_helper >>>> lprocfs_write_u64_helper >>>> >>>> One might reasonably expect that when using the latter function one >>>> loses the ability to handle fractional numbers. But no, actually it >>>> just sets the multiplier to a default of 1. How does that naming make >>>> any sense? >>>> >>>> I suppose that with lprocfs_write_helper that naming style almost makes >>>> sense, because a multiplier of 1 will result in anything after the >>>> decimal point being calculated out to 0. So the fractional part is, in >>>> effect, ignored. But, strangely enough, fractions are still _accepted_ >>>> by the function. >>>> >>>> This semantic distinction is important to consider. It means that you >>>> can't just do a naive combination of the two functions into your >>>> proposed lprocfs_write_frac_helper_internal() function. There are >>>> callers of lprocfs_write_frac_helper that assume that the multiplier can >>>> be only the one specified and would result in incorrect number if there >>>> were user-specified units in the string. >>>> >>>> By the was, I'm not really in favor of duplicating the existing >>>> functions with a hope to remove the old ones at some time in the future. >>>> I think (despite current evidence to the contrary) that these >>>> functions are not so difficult to review that we would need a transition >>>> period. We would just need to audit every caller to make sure that any >>>> semantic changes are handled. >>>> >>>> And frankly, there would appear to be code that _already_ gets this >>>> wrong, so an audit is really needed already. For instance, >>>> ll_max_readahead_mb_seq_write() tries to be too clever by assuming that >>>> users can only provide an integer that represents number of MiB, and >>>> then passes in a multiplier that will have it convert into number of >>>> pages. But the since they used lprocfs_write_frac_u64_helper(), the >>>> user can specify their own units, and then the number returned number >>>> will be bytes instead of pages. Here are the callers that I found that >>>> are doing it wrong: >>>> >>>> ll_max_readahead_mb_seq_write >>>> ll_max_cached_mb_seq_write >>>> proc_max_dirty_pages_in_mb >>>> osc_cached_mb_seq_write >>>> >>>> 4 out of 5 are doing it wrong. Not a good track record. >>>> >>>> And getting back to the point, franctions and units are both accepted >>>> and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in the >>>> name is misleading at best. >>>> >>>> Why does lprocfs_write_frac_helper do its own handling of negatives and >>>> then call the unsigned simple_strtoul function? Why not just use the >>>> signed simple_strtol function? As far as I can tell the signed version >>>> of the function has been in Linux as long as the unsigned version. >>>> >>>> Why is mult declared as a signed int? I think it should almost >>>> certainly be unsigned. I think it might only be signed because the >>>> function author reuses mult as a local variable to stored the negative >>>> sign when parsed from the string. If so, that is a poor choice. The >>>> function declaration is a contract with the caller. If it makes no >>>> sense to pass in a negative multiplier, then the declaration should make >>>> that clear by declaring it unsigned. >>>> >>>> Why do the unsigned versions of the helper functions allow and parse >>>> negative numbers? I think that this gets to the heart of your >>>> suggestion about special handling for -1. I think that knowing that -1 >>>> has special meaning for something things is too specialized for the >>>> helper function. I think we are better off letting the caller decided >>>> what special handling to do and when. >>>> >>>> I would suggest that the main helper that does handling of >>>> user-specified units should not be casting the number to an unsigned >>>> value. Leave the casting to the caller, or perhaps provide a simple >>>> wrapper to cast away the sign. I don't think we are going to miss that >>>> one extra bit for positive numbers. >>>> >>>> So maybe we need the most generic function prototype be be something >>>> like: >>>> >>>> int lprocfs_write_helper(char *buffer, unsigned long count, __s64 *val, >>>> unsigned int mult, bool units_allowed); >>>> >>>> The function comment would explain that if units are allowed, then the >>>> multiplier is only a default and will be overridden by the >>>> user-specificed unit. >>>> >>>> Chris >>>> >>>>> On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >>>>> Greetings, >>>>> >>>>> Recently, I've noticed that the lprocfs write frac int and u64 helpers >>>>> have a few issues. The biggest issue is that neither function handles >>>>> overflow/wrap. I also noticed very similar code that should be >>>>> consolidated down and leveraged by both helpers. >>>>> >>>>> I was thinking of refactoring the functions in the fashion described >>>>> below. >>>>> >>>>> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >>>>> count, __u64 *val, int mult); >>>>> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >>>>> unsigned long count, __u64 *val, int mult); >>>>> int lprocfs_write_frac_helper_safe(const char __user *buffer, unsigned >>>>> long count, int *val, int mult); >>>>> >>>>> lprocfs_write_frac_helper_internal would handle parsing an unsigned long >>>>> long from the kernel char buffer passed in. It will be responsible for >>>>> detecting if a uint wrap occurs. >>>>> >>>>> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >>>>> automatically return ULLONG_MAX. If any other string representing a >>>>> negative number is passed in, an invalid value error code should be >>>>> returned. If the multiplier is negative, that would also be treated as >>>>> invalid. The units and multiplier logic can also be consolidated. It >>>>> will use lprocfs_write_frac_helper_internal to handle the parsing. >>>>> >>>>> lprocfs_write_frac_helper_safe will leverage >>>>> lprocfs_write_frac_helper_internal. If >>>>> lprocfs_write_frac_helper_internal indicates a wrap occurred, then we >>>>> also have an invalid integer. Checks for integer overflow happen after a >>>>> successful call to the internal helper. This is similar to how the >>>>> current lprocfs_write_frac_helper functions. >>>>> >>>>> It is also worth nothing, I plan to maintain the old helpers and their >>>>> use can be gradually phased out once we are confident the refactored >>>>> version is doing what it is supposed to. >>>>> >>>>> Also, unrelated to the above, quick question about lctl. Is there a >>>>> particular reason why the setting to be changed when using lctl >>>>> set_param is echoed back to the user? I think it can be misleading in >>>>> cases where the value set is not necessarily what is being reflected to >>>>> the user (i.e. -1 for max value). That could be confusing to a user and >>>>> they should be using lctl get_param to confirm their value was set >>>>> anyways. Also, it would follow convention that unless an error happens, >>>>> nothing is printed to console. Any disagreements on silencing lctl >>>>> set_param? >>>>> >>>>> Thanks, >>>>> Giuseppe Di Natale >>>>> >>>>> >>>>> _______________________________________________ >>>>> lustre-devel mailing list >>>>> lustre-devel at lists.lustre.org >>>>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>>>> >>>> >>>> _______________________________________________ >>>> lustre-devel mailing list >>>> lustre-devel at lists.lustre.org >>>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>>> _______________________________________________ >>>> lustre-devel mailing list >>>> lustre-devel at lists.lustre.org >>>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org >>>> . >>>> >>> >>> . >>> >> >> _______________________________________________ >> lustre-devel mailing list >> lustre-devel at lists.lustre.org >> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > . > _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From andreas.dilger at intel.com Tue Oct 6 04:23:08 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 6 Oct 2015 04:23:08 +0000 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <5612F106.1070601@llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov> <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov> <560F2174.2040003@llnl.gov> <5612F106.1070601@llnl.gov> Message-ID: On 2015/10/05, 3:52 PM, "Christopher J. Morrone" wrote: >I don't recall any proc files that accepted pages. max_pages_per_rpc is probably the main one. >I certainly remember callers sending a multiplier that resulted in the >string parsing function doing the conversion to pages. But those very >callers are the ones that break when the string specifies a unit. The >code authors failed to realize that, so this would let us avoid that >mistake in the future. I'm not against fixing the bugs and improving the interface. >I don't think it is terribly onerous to do the bit shifting in the >caller instead of passing the multiplier as parameter to the string >conversion function. I think it might even make the code a little more >readable. The question is - how to have the caller do the conversion? If each caller handles the units conversion (KMGTP) then that duplicates a lot of code. If the caller doesn't handle the unit conversion, how does it know whether the result needs to be shifted or not (i.e. was the input value in units of pages or MB)? I'm not against doing it as you propose, if it is an improvement over the current code. Cheers, Andreas > >Chris > >On 10/03/2015 02:54 AM, Dilger, Andreas wrote: >> What if the default unit is in pages? I don't think there is a common >>suffix for pages. >> >> Cheers, Andreas >> >>> On Oct 2, 2015, at 18:29, Christopher J. Morrone >>>wrote: >>> >>> It also occurs to me that we shouldn't really have a an integer >>>multiplier parameter in the function definition. There should just be >>>a simple "char default_units" parameter. The caller can specify which >>>character is the default, and then there is no possibility of the >>>multiplier being misused the way it currently is. >>> >>> Chris >>> >>>> On 09/30/2015 05:32 PM, Christopher J. Morrone wrote: >>>>> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >>>>> I looked around to see where the helpers are used. It looks to me >>>>>that >>>>> they are always used in proc related functions. I agree with the >>>>> issues you mentioned at the top of the email as well. >>>> >>>> Yes, but I meant to say we need to consider future use. Largely >>>> motivated by the effort to upstream the Lustre client into Linux, the >>>> /proc interfaces are slowly going away. So I was just suggesting that >>>> we should check that these functions will still be used by the new >>>> debugfs/sysfs/whatever interfaces in the future. Nothing really >>>>needed >>>> to consider though; they are generic enough to still be used well into >>>> the future. >>>> >>>> With that in mind, we should probably change the function names even >>>> further. Instead of naming the functions after the current primary >>>> callers, we should name them according to what they do. Perhaps >>>> something along the lines of: str_to_u64(). >>>> >>>> That is just good naming practice anyway. When you are reading code >>>>and >>>> you hit a call to a function named "helper", that doesn't give you >>>>much >>>> of a clue as to what it does. >>>> >>>>> It also appears that the multiplier is never negative, so making it >>>>>an >>>>> unsigned int seems like the right way to go. I also noticed that >>>>> lprocfs_write_frac_helper calls are always followed by a check if the >>>>> value produced is greater than 0 and if not an error is thrown. This >>>>> implies the signed version may not be necessary (and that maybe the >>>>> unsigned helper should error with strings representing negative >>>>> numbers?). >>>>> >>>>> Also, I think both the unsigned and signed methods parse the numeric >>>>> portion of the string in a very similar fashion. At the very least, >>>>> they appear to attempt to do the same thing. That is the portion I >>>>>was >>>>> going to consolidate down. >>>> >>>> Yes, the _u64_ functions almost certainly started out as a >>>>cut-and-paste >>>> of the other functions. >>>> >>>>> You didn't comment on detecting overflow/underflow/wrapping. I still >>>>> think those are a valid concern as well. >>>> >>>> I agree. It is completely reasonable to add those checks during the >>>> refactoring. >>>> >>>>> Giuseppe >>>>> ________________________________________ >>>>> From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf >>>>> of Christopher J. Morrone [morrone2 at llnl.gov] >>>>> Sent: Tuesday, September 29, 2015 7:25 PM >>>>> To: lustre-devel at lists.lustre.org >>>>> Subject: Re: [lustre-devel] lprocfs Helper Issues >>>>> >>>>> I looked through the code a bit, and I think that the even bigger >>>>>issues >>>>> are the lack of reasonable naming, lack of comments, and a puzzling >>>>> semantic inconsistency. >>>>> >>>>> Before working on any of the issues I mention below though, we should >>>>> probably make sure that these functions still have a purpose once >>>>>/proc >>>>> goes away. They seem generic enough helpers that they will still be >>>>> used with the non-/proc methods, but it is worth checking. >>>>> >>>>> First, consider this pair of names: >>>>> >>>>> lprocfs_write_frac_helper >>>>> lprocfs_write_frac_u64_helper >>>>> >>>>> One might reasonably suspect that the major difference between these >>>>>two >>>>> functions is that the latter deails with a u64, and the former does >>>>>not. >>>>> But that is already pretty darn clear from the full function >>>>> prototype, and really the main difference is that >>>>> lprocfs_write_frac_u64_helper can parse a units character in the >>>>>string. >>>>> Maybe the name should be lprocfs_write_frac_units_helper. >>>>> >>>>> Also, the semantics surrounding the multiplier are field are >>>>>different. >>>>> For lprocfs_write_frac_helper the mult parameter is always >>>>>enforced, >>>>> and there is code that replies on that. With >>>>> lprocfs_write_frac_u64_helper mult is merely a default, and the >>>>>caller >>>>> can't rely on it being used. Two functions with similar names but >>>>> difference semantics (and not in the way implied by the name >>>>> difference), and no function comments...not a good idea. >>>>> >>>>> Next there is the naming difference between these: >>>>> >>>>> lprocfs_write_frac_u64_helper >>>>> lprocfs_write_u64_helper >>>>> >>>>> One might reasonably expect that when using the latter function one >>>>> loses the ability to handle fractional numbers. But no, actually it >>>>> just sets the multiplier to a default of 1. How does that naming >>>>>make >>>>> any sense? >>>>> >>>>> I suppose that with lprocfs_write_helper that naming style almost >>>>>makes >>>>> sense, because a multiplier of 1 will result in anything after the >>>>> decimal point being calculated out to 0. So the fractional part >>>>>is, in >>>>> effect, ignored. But, strangely enough, fractions are still >>>>>_accepted_ >>>>> by the function. >>>>> >>>>> This semantic distinction is important to consider. It means that >>>>>you >>>>> can't just do a naive combination of the two functions into your >>>>> proposed lprocfs_write_frac_helper_internal() function. There are >>>>> callers of lprocfs_write_frac_helper that assume that the multiplier >>>>>can >>>>> be only the one specified and would result in incorrect number if >>>>>there >>>>> were user-specified units in the string. >>>>> >>>>> By the was, I'm not really in favor of duplicating the existing >>>>> functions with a hope to remove the old ones at some time in the >>>>>future. >>>>> I think (despite current evidence to the contrary) that these >>>>> functions are not so difficult to review that we would need a >>>>>transition >>>>> period. We would just need to audit every caller to make sure that >>>>>any >>>>> semantic changes are handled. >>>>> >>>>> And frankly, there would appear to be code that _already_ gets this >>>>> wrong, so an audit is really needed already. For instance, >>>>> ll_max_readahead_mb_seq_write() tries to be too clever by assuming >>>>>that >>>>> users can only provide an integer that represents number of MiB, and >>>>> then passes in a multiplier that will have it convert into number of >>>>> pages. But the since they used lprocfs_write_frac_u64_helper(), the >>>>> user can specify their own units, and then the number returned number >>>>> will be bytes instead of pages. Here are the callers that I found >>>>>that >>>>> are doing it wrong: >>>>> >>>>> ll_max_readahead_mb_seq_write >>>>> ll_max_cached_mb_seq_write >>>>> proc_max_dirty_pages_in_mb >>>>> osc_cached_mb_seq_write >>>>> >>>>> 4 out of 5 are doing it wrong. Not a good track record. >>>>> >>>>> And getting back to the point, franctions and units are both accepted >>>>> and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in >>>>>the >>>>> name is misleading at best. >>>>> >>>>> Why does lprocfs_write_frac_helper do its own handling of negatives >>>>>and >>>>> then call the unsigned simple_strtoul function? Why not just use the >>>>> signed simple_strtol function? As far as I can tell the signed >>>>>version >>>>> of the function has been in Linux as long as the unsigned version. >>>>> >>>>> Why is mult declared as a signed int? I think it should almost >>>>> certainly be unsigned. I think it might only be signed because the >>>>> function author reuses mult as a local variable to stored the >>>>>negative >>>>> sign when parsed from the string. If so, that is a poor choice. The >>>>> function declaration is a contract with the caller. If it makes no >>>>> sense to pass in a negative multiplier, then the declaration should >>>>>make >>>>> that clear by declaring it unsigned. >>>>> >>>>> Why do the unsigned versions of the helper functions allow and parse >>>>> negative numbers? I think that this gets to the heart of your >>>>> suggestion about special handling for -1. I think that knowing that >>>>>-1 >>>>> has special meaning for something things is too specialized for the >>>>> helper function. I think we are better off letting the caller >>>>>decided >>>>> what special handling to do and when. >>>>> >>>>> I would suggest that the main helper that does handling of >>>>> user-specified units should not be casting the number to an unsigned >>>>> value. Leave the casting to the caller, or perhaps provide a simple >>>>> wrapper to cast away the sign. I don't think we are going to miss >>>>>that >>>>> one extra bit for positive numbers. >>>>> >>>>> So maybe we need the most generic function prototype be be something >>>>> like: >>>>> >>>>> int lprocfs_write_helper(char *buffer, unsigned long count, __s64 >>>>>*val, >>>>> unsigned int mult, bool units_allowed); >>>>> >>>>> The function comment would explain that if units are allowed, then >>>>>the >>>>> multiplier is only a default and will be overridden by the >>>>> user-specificed unit. >>>>> >>>>> Chris >>>>> >>>>>> On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >>>>>> Greetings, >>>>>> >>>>>> Recently, I've noticed that the lprocfs write frac int and u64 >>>>>>helpers >>>>>> have a few issues. The biggest issue is that neither function >>>>>>handles >>>>>> overflow/wrap. I also noticed very similar code that should be >>>>>> consolidated down and leveraged by both helpers. >>>>>> >>>>>> I was thinking of refactoring the functions in the fashion described >>>>>> below. >>>>>> >>>>>> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >>>>>> count, __u64 *val, int mult); >>>>>> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >>>>>> unsigned long count, __u64 *val, int mult); >>>>>> int lprocfs_write_frac_helper_safe(const char __user *buffer, >>>>>>unsigned >>>>>> long count, int *val, int mult); >>>>>> >>>>>> lprocfs_write_frac_helper_internal would handle parsing an unsigned >>>>>>long >>>>>> long from the kernel char buffer passed in. It will be responsible >>>>>>for >>>>>> detecting if a uint wrap occurs. >>>>>> >>>>>> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >>>>>> automatically return ULLONG_MAX. If any other string representing a >>>>>> negative number is passed in, an invalid value error code should be >>>>>> returned. If the multiplier is negative, that would also be treated >>>>>>as >>>>>> invalid. The units and multiplier logic can also be consolidated. It >>>>>> will use lprocfs_write_frac_helper_internal to handle the parsing. >>>>>> >>>>>> lprocfs_write_frac_helper_safe will leverage >>>>>> lprocfs_write_frac_helper_internal. If >>>>>> lprocfs_write_frac_helper_internal indicates a wrap occurred, then >>>>>>we >>>>>> also have an invalid integer. Checks for integer overflow happen >>>>>>after a >>>>>> successful call to the internal helper. This is similar to how the >>>>>> current lprocfs_write_frac_helper functions. >>>>>> >>>>>> It is also worth nothing, I plan to maintain the old helpers and >>>>>>their >>>>>> use can be gradually phased out once we are confident the refactored >>>>>> version is doing what it is supposed to. >>>>>> >>>>>> Also, unrelated to the above, quick question about lctl. Is there a >>>>>> particular reason why the setting to be changed when using lctl >>>>>> set_param is echoed back to the user? I think it can be misleading >>>>>>in >>>>>> cases where the value set is not necessarily what is being >>>>>>reflected to >>>>>> the user (i.e. -1 for max value). That could be confusing to a user >>>>>>and >>>>>> they should be using lctl get_param to confirm their value was set >>>>>> anyways. Also, it would follow convention that unless an error >>>>>>happens, >>>>>> nothing is printed to console. Any disagreements on silencing lctl >>>>>> set_param? >>>>>> >>>>>> Thanks, >>>>>> Giuseppe Di Natale >>>>>> >>>>>> >>>>>> Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From rocco at devzen.net Fri Oct 2 21:54:26 2015 From: rocco at devzen.net (Rocco Folino) Date: Fri, 2 Oct 2015 23:54:26 +0200 Subject: [lustre-devel] [PATCH] staging/lustre: Make nrs_policy_get_info_locked() static Message-ID: This patch fixes the warning generated by sparse: "symbol 'nrs_policy_get_info_locked' was not declared. Should it be static?" by declaring the function static. Signed-off-by: Rocco Folino --- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 3a212b4be9a1..6cf9b92c7c05 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -452,7 +452,7 @@ static const char *nrs_state2str(enum ptlrpc_nrs_pol_state state) * \param[in] policy The policy * \param[out] info Holds returned status information */ -void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, +static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, struct ptlrpc_nrs_pol_info *info) { LASSERT(policy != NULL); -- 2.4.3 From lkp at intel.com Fri Oct 2 22:10:12 2015 From: lkp at intel.com (kbuild test robot) Date: Sat, 3 Oct 2015 06:10:12 +0800 Subject: [lustre-devel] [PATCH] staging/lustre: Make nrs_policy_get_info_locked() static In-Reply-To: Message-ID: <201510030633.j7jTVT5b%fengguang.wu@intel.com> Hi Rocco, [auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore] config: sparc64-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=sparc64 All error/warnings (new ones prefixed by >>): >> drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:456:13: error: static declaration of 'nrs_policy_get_info_locked' follows non-static declaration static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, ^ In file included from drivers/staging/lustre/lustre/ptlrpc/../include/lustre_lib.h:64:0, from drivers/staging/lustre/lustre/ptlrpc/../include/obd.h:52, from drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:40: drivers/staging/lustre/lustre/ptlrpc/../include/lustre_net.h:1542:6: note: previous declaration of 'nrs_policy_get_info_locked' was here void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, ^ vim +/nrs_policy_get_info_locked +456 drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c 450 * 451 * Information is copied in \a info. 452 * 453 * \param[in] policy The policy 454 * \param[out] info Holds returned status information 455 */ > 456 static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, 457 struct ptlrpc_nrs_pol_info *info) 458 { 459 LASSERT(policy != NULL); --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/octet-stream Size: 43733 bytes Desc: not available URL: From yghannam at gmail.com Thu Oct 8 23:01:16 2015 From: yghannam at gmail.com (Yazen Ghannam) Date: Thu, 8 Oct 2015 19:01:16 -0400 Subject: [lustre-devel] [PATCH] staging/lustre: Remove unused, commented function call Message-ID: <1444345276-1088-1-git-send-email-yghannam@gmail.com> Also fixes a coding style error. Signed-off-by: Yazen Ghannam --- drivers/staging/lustre/lustre/obdclass/obd_config.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index b8ca324..f014015 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1070,8 +1070,6 @@ int class_config_llog_handler(const struct lu_env *env, char *cfg_buf = (char *) (rec + 1); int rc = 0; - //class_config_dump_handler(handle, rec, data); - switch (rec->lrh_type) { case OBD_CFG_REC: { struct lustre_cfg *lcfg, *lcfg_new; -- 2.1.4 From dinatale2 at llnl.gov Fri Oct 9 17:27:06 2015 From: dinatale2 at llnl.gov (Di Natale, Giuseppe) Date: Fri, 9 Oct 2015 17:27:06 +0000 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov> <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov> <560F2174.2040003@llnl.gov> <5612F106.1070601@llnl.gov>, Message-ID: <974262C966B9F640899A48EB96313E9A2CC1C9@PRDEXMBX-08.the-lab.llnl.gov> Greetings, I've implemented a working version of the new helper, but I need an opinion on what the interface should ultimately be. I'm trying to find a good middle ground based on everyone's suggestions. So below is a list of options with descriptions for how the functionality is exposed outside of lprocfs. This enum is used as a way of defining which "units" are supported or are standard. The enum is used to lookup multipliers for these units. Alignment could also be the incorrect term for what it is achieving. I'm attempting to avoid the potential confusion around units and multiplier. typedef enum { ALIGN_NONE = 0, ALIGN_BYTE = 1, ... ALIGN_PAGE_CACHE_MB = 7, ALIGN_COUNT } alignment; int lprocfs_str_to_u64(const char __user *buffer, unsigned long count, __u64 *val) lprocfs_str_to_u64 expects at most a single decimal and only numeric characters in the string buffer. It will return an error code if string represents a negative number, string is invalid, or value represented by string wraps. int lprocfs_str_to_u64_aligned(const char __user *buffer, unsigned long count, __u64 *val, alignment align) lprocfs_str_to_u64_aligned expects at most a single decimal and only numeric characters in the string buffer. It will return an error code if the string represents a negative number, is invalid, or the final value wraps. The align argument is used to designate what unit (ultimately becomes a multiplier) should be applied to the number represented by the string. int lprocfs_str_to_u64_mult(const char __user *buffer, unsigned long count, __u64 *val, __u64 mult) lprocfs_str_to_u64_mult expects at most a single decimal and only numeric characters in the string buffer. It will return an error code if the string represents a negative number, is invalid, or the final value wraps. The mult argument is the multiplier to apply to the value represented by the string. This could be included to provide more flexibility instead of strictly allowing certain multipliers. int lprocfs_str_with_units_to_u64(const char __user *buffer, unsigned long count, __u64 *val, alignment default_align) lprocfs_str_with_units_to_u64 expects at most a single decimal, numeric characters, and only one non numeric character which must be at the end of the string. It will return an error code if the string represents a negative number, is invalid, contains an invalid unit, or the final value wraps. The default_align argument is the default unit to apply to the value represented by the string if it does not contain a char representing a unit. This could be included to provide more flexibility instead of strictly allowing certain multipliers. So the question is, would all of these be suitable or perhaps only some? I was leaning towards keeping the interface as flexible as possible. lprocfs_str_to_u64_aligned could be removed and a utility function to obtain the appropriate multiplier for a given unit can be used in conjunction with lprocfs_str_to_u64_mult for example. Is there really a need to consider other multipliers outside of the widely used units? Also, I've begun wondering why lprocfs_write_helper exists and if I should incorporate it in the refactor. Currently, it is similar to the u64 helper with the exception that the value returned is an int. It appears that most callers to the function eventually check if the int value is positive before proceeding to do work. Would it be unwise to replace all those calls to lprocfs_write_helper with one of the u64 helpers and then attempt to refactor/handle the areas in the codebase that expected an int? I feel it may be messy and, in some cases, difficult to remove the use of an integer in some of the calling functions, but is that really a good reason to implement a lprocfs_str_to_int function? Thanks, Giuseppe Di Natale ________________________________________ From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Dilger, Andreas [andreas.dilger at intel.com] Sent: Monday, October 05, 2015 9:23 PM To: Morrone, Chris Cc: lustre-devel at lists.lustre.org Subject: Re: [lustre-devel] lprocfs Helper Issues On 2015/10/05, 3:52 PM, "Christopher J. Morrone" wrote: >I don't recall any proc files that accepted pages. max_pages_per_rpc is probably the main one. >I certainly remember callers sending a multiplier that resulted in the >string parsing function doing the conversion to pages. But those very >callers are the ones that break when the string specifies a unit. The >code authors failed to realize that, so this would let us avoid that >mistake in the future. I'm not against fixing the bugs and improving the interface. >I don't think it is terribly onerous to do the bit shifting in the >caller instead of passing the multiplier as parameter to the string >conversion function. I think it might even make the code a little more >readable. The question is - how to have the caller do the conversion? If each caller handles the units conversion (KMGTP) then that duplicates a lot of code. If the caller doesn't handle the unit conversion, how does it know whether the result needs to be shifted or not (i.e. was the input value in units of pages or MB)? I'm not against doing it as you propose, if it is an improvement over the current code. Cheers, Andreas > >Chris > >On 10/03/2015 02:54 AM, Dilger, Andreas wrote: >> What if the default unit is in pages? I don't think there is a common >>suffix for pages. >> >> Cheers, Andreas >> >>> On Oct 2, 2015, at 18:29, Christopher J. Morrone >>>wrote: >>> >>> It also occurs to me that we shouldn't really have a an integer >>>multiplier parameter in the function definition. There should just be >>>a simple "char default_units" parameter. The caller can specify which >>>character is the default, and then there is no possibility of the >>>multiplier being misused the way it currently is. >>> >>> Chris >>> >>>> On 09/30/2015 05:32 PM, Christopher J. Morrone wrote: >>>>> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >>>>> I looked around to see where the helpers are used. It looks to me >>>>>that >>>>> they are always used in proc related functions. I agree with the >>>>> issues you mentioned at the top of the email as well. >>>> >>>> Yes, but I meant to say we need to consider future use. Largely >>>> motivated by the effort to upstream the Lustre client into Linux, the >>>> /proc interfaces are slowly going away. So I was just suggesting that >>>> we should check that these functions will still be used by the new >>>> debugfs/sysfs/whatever interfaces in the future. Nothing really >>>>needed >>>> to consider though; they are generic enough to still be used well into >>>> the future. >>>> >>>> With that in mind, we should probably change the function names even >>>> further. Instead of naming the functions after the current primary >>>> callers, we should name them according to what they do. Perhaps >>>> something along the lines of: str_to_u64(). >>>> >>>> That is just good naming practice anyway. When you are reading code >>>>and >>>> you hit a call to a function named "helper", that doesn't give you >>>>much >>>> of a clue as to what it does. >>>> >>>>> It also appears that the multiplier is never negative, so making it >>>>>an >>>>> unsigned int seems like the right way to go. I also noticed that >>>>> lprocfs_write_frac_helper calls are always followed by a check if the >>>>> value produced is greater than 0 and if not an error is thrown. This >>>>> implies the signed version may not be necessary (and that maybe the >>>>> unsigned helper should error with strings representing negative >>>>> numbers?). >>>>> >>>>> Also, I think both the unsigned and signed methods parse the numeric >>>>> portion of the string in a very similar fashion. At the very least, >>>>> they appear to attempt to do the same thing. That is the portion I >>>>>was >>>>> going to consolidate down. >>>> >>>> Yes, the _u64_ functions almost certainly started out as a >>>>cut-and-paste >>>> of the other functions. >>>> >>>>> You didn't comment on detecting overflow/underflow/wrapping. I still >>>>> think those are a valid concern as well. >>>> >>>> I agree. It is completely reasonable to add those checks during the >>>> refactoring. >>>> >>>>> Giuseppe >>>>> ________________________________________ >>>>> From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf >>>>> of Christopher J. Morrone [morrone2 at llnl.gov] >>>>> Sent: Tuesday, September 29, 2015 7:25 PM >>>>> To: lustre-devel at lists.lustre.org >>>>> Subject: Re: [lustre-devel] lprocfs Helper Issues >>>>> >>>>> I looked through the code a bit, and I think that the even bigger >>>>>issues >>>>> are the lack of reasonable naming, lack of comments, and a puzzling >>>>> semantic inconsistency. >>>>> >>>>> Before working on any of the issues I mention below though, we should >>>>> probably make sure that these functions still have a purpose once >>>>>/proc >>>>> goes away. They seem generic enough helpers that they will still be >>>>> used with the non-/proc methods, but it is worth checking. >>>>> >>>>> First, consider this pair of names: >>>>> >>>>> lprocfs_write_frac_helper >>>>> lprocfs_write_frac_u64_helper >>>>> >>>>> One might reasonably suspect that the major difference between these >>>>>two >>>>> functions is that the latter deails with a u64, and the former does >>>>>not. >>>>> But that is already pretty darn clear from the full function >>>>> prototype, and really the main difference is that >>>>> lprocfs_write_frac_u64_helper can parse a units character in the >>>>>string. >>>>> Maybe the name should be lprocfs_write_frac_units_helper. >>>>> >>>>> Also, the semantics surrounding the multiplier are field are >>>>>different. >>>>> For lprocfs_write_frac_helper the mult parameter is always >>>>>enforced, >>>>> and there is code that replies on that. With >>>>> lprocfs_write_frac_u64_helper mult is merely a default, and the >>>>>caller >>>>> can't rely on it being used. Two functions with similar names but >>>>> difference semantics (and not in the way implied by the name >>>>> difference), and no function comments...not a good idea. >>>>> >>>>> Next there is the naming difference between these: >>>>> >>>>> lprocfs_write_frac_u64_helper >>>>> lprocfs_write_u64_helper >>>>> >>>>> One might reasonably expect that when using the latter function one >>>>> loses the ability to handle fractional numbers. But no, actually it >>>>> just sets the multiplier to a default of 1. How does that naming >>>>>make >>>>> any sense? >>>>> >>>>> I suppose that with lprocfs_write_helper that naming style almost >>>>>makes >>>>> sense, because a multiplier of 1 will result in anything after the >>>>> decimal point being calculated out to 0. So the fractional part >>>>>is, in >>>>> effect, ignored. But, strangely enough, fractions are still >>>>>_accepted_ >>>>> by the function. >>>>> >>>>> This semantic distinction is important to consider. It means that >>>>>you >>>>> can't just do a naive combination of the two functions into your >>>>> proposed lprocfs_write_frac_helper_internal() function. There are >>>>> callers of lprocfs_write_frac_helper that assume that the multiplier >>>>>can >>>>> be only the one specified and would result in incorrect number if >>>>>there >>>>> were user-specified units in the string. >>>>> >>>>> By the was, I'm not really in favor of duplicating the existing >>>>> functions with a hope to remove the old ones at some time in the >>>>>future. >>>>> I think (despite current evidence to the contrary) that these >>>>> functions are not so difficult to review that we would need a >>>>>transition >>>>> period. We would just need to audit every caller to make sure that >>>>>any >>>>> semantic changes are handled. >>>>> >>>>> And frankly, there would appear to be code that _already_ gets this >>>>> wrong, so an audit is really needed already. For instance, >>>>> ll_max_readahead_mb_seq_write() tries to be too clever by assuming >>>>>that >>>>> users can only provide an integer that represents number of MiB, and >>>>> then passes in a multiplier that will have it convert into number of >>>>> pages. But the since they used lprocfs_write_frac_u64_helper(), the >>>>> user can specify their own units, and then the number returned number >>>>> will be bytes instead of pages. Here are the callers that I found >>>>>that >>>>> are doing it wrong: >>>>> >>>>> ll_max_readahead_mb_seq_write >>>>> ll_max_cached_mb_seq_write >>>>> proc_max_dirty_pages_in_mb >>>>> osc_cached_mb_seq_write >>>>> >>>>> 4 out of 5 are doing it wrong. Not a good track record. >>>>> >>>>> And getting back to the point, franctions and units are both accepted >>>>> and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in >>>>>the >>>>> name is misleading at best. >>>>> >>>>> Why does lprocfs_write_frac_helper do its own handling of negatives >>>>>and >>>>> then call the unsigned simple_strtoul function? Why not just use the >>>>> signed simple_strtol function? As far as I can tell the signed >>>>>version >>>>> of the function has been in Linux as long as the unsigned version. >>>>> >>>>> Why is mult declared as a signed int? I think it should almost >>>>> certainly be unsigned. I think it might only be signed because the >>>>> function author reuses mult as a local variable to stored the >>>>>negative >>>>> sign when parsed from the string. If so, that is a poor choice. The >>>>> function declaration is a contract with the caller. If it makes no >>>>> sense to pass in a negative multiplier, then the declaration should >>>>>make >>>>> that clear by declaring it unsigned. >>>>> >>>>> Why do the unsigned versions of the helper functions allow and parse >>>>> negative numbers? I think that this gets to the heart of your >>>>> suggestion about special handling for -1. I think that knowing that >>>>>-1 >>>>> has special meaning for something things is too specialized for the >>>>> helper function. I think we are better off letting the caller >>>>>decided >>>>> what special handling to do and when. >>>>> >>>>> I would suggest that the main helper that does handling of >>>>> user-specified units should not be casting the number to an unsigned >>>>> value. Leave the casting to the caller, or perhaps provide a simple >>>>> wrapper to cast away the sign. I don't think we are going to miss >>>>>that >>>>> one extra bit for positive numbers. >>>>> >>>>> So maybe we need the most generic function prototype be be something >>>>> like: >>>>> >>>>> int lprocfs_write_helper(char *buffer, unsigned long count, __s64 >>>>>*val, >>>>> unsigned int mult, bool units_allowed); >>>>> >>>>> The function comment would explain that if units are allowed, then >>>>>the >>>>> multiplier is only a default and will be overridden by the >>>>> user-specificed unit. >>>>> >>>>> Chris >>>>> >>>>>> On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >>>>>> Greetings, >>>>>> >>>>>> Recently, I've noticed that the lprocfs write frac int and u64 >>>>>>helpers >>>>>> have a few issues. The biggest issue is that neither function >>>>>>handles >>>>>> overflow/wrap. I also noticed very similar code that should be >>>>>> consolidated down and leveraged by both helpers. >>>>>> >>>>>> I was thinking of refactoring the functions in the fashion described >>>>>> below. >>>>>> >>>>>> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >>>>>> count, __u64 *val, int mult); >>>>>> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >>>>>> unsigned long count, __u64 *val, int mult); >>>>>> int lprocfs_write_frac_helper_safe(const char __user *buffer, >>>>>>unsigned >>>>>> long count, int *val, int mult); >>>>>> >>>>>> lprocfs_write_frac_helper_internal would handle parsing an unsigned >>>>>>long >>>>>> long from the kernel char buffer passed in. It will be responsible >>>>>>for >>>>>> detecting if a uint wrap occurs. >>>>>> >>>>>> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >>>>>> automatically return ULLONG_MAX. If any other string representing a >>>>>> negative number is passed in, an invalid value error code should be >>>>>> returned. If the multiplier is negative, that would also be treated >>>>>>as >>>>>> invalid. The units and multiplier logic can also be consolidated. It >>>>>> will use lprocfs_write_frac_helper_internal to handle the parsing. >>>>>> >>>>>> lprocfs_write_frac_helper_safe will leverage >>>>>> lprocfs_write_frac_helper_internal. If >>>>>> lprocfs_write_frac_helper_internal indicates a wrap occurred, then >>>>>>we >>>>>> also have an invalid integer. Checks for integer overflow happen >>>>>>after a >>>>>> successful call to the internal helper. This is similar to how the >>>>>> current lprocfs_write_frac_helper functions. >>>>>> >>>>>> It is also worth nothing, I plan to maintain the old helpers and >>>>>>their >>>>>> use can be gradually phased out once we are confident the refactored >>>>>> version is doing what it is supposed to. >>>>>> >>>>>> Also, unrelated to the above, quick question about lctl. Is there a >>>>>> particular reason why the setting to be changed when using lctl >>>>>> set_param is echoed back to the user? I think it can be misleading >>>>>>in >>>>>> cases where the value set is not necessarily what is being >>>>>>reflected to >>>>>> the user (i.e. -1 for max value). That could be confusing to a user >>>>>>and >>>>>> they should be using lctl get_param to confirm their value was set >>>>>> anyways. Also, it would follow convention that unless an error >>>>>>happens, >>>>>> nothing is printed to console. Any disagreements on silencing lctl >>>>>> set_param? >>>>>> >>>>>> Thanks, >>>>>> Giuseppe Di Natale >>>>>> >>>>>> >>>>>> Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From morrone2 at llnl.gov Fri Oct 9 18:38:07 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Fri, 09 Oct 2015 11:38:07 -0700 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov> <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov> <560F2174.2040003@llnl.gov> <5612F106.1070601@llnl.gov> Message-ID: <5618098F.5010905@llnl.gov> On 10/05/2015 09:23 PM, Dilger, Andreas wrote: > On 2015/10/05, 3:52 PM, "Christopher J. Morrone" wrote: > >> I don't recall any proc files that accepted pages. > > max_pages_per_rpc is probably the main one. I think it was unwise to try to accept both a page count and byte count in the same option without an explicit syntax to determine which is which. The implementation screws up handling of "512K", for instance, and there is no simple way to fix that as designed. Chris From morrone2 at llnl.gov Fri Oct 9 23:43:39 2015 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Fri, 09 Oct 2015 16:43:39 -0700 Subject: [lustre-devel] lprocfs Helper Issues In-Reply-To: <974262C966B9F640899A48EB96313E9A2CC1C9@PRDEXMBX-08.the-lab.llnl.gov> References: <974262C966B9F640899A48EB96313E9A2C9DAA@PRDEXMBX-08.the-lab.llnl.gov> <560B4800.6070103@llnl.gov> <974262C966B9F640899A48EB96313E9A2CA46B@PRDEXMBX-08.the-lab.llnl.gov> <560C7F1A.30004@llnl.gov> <560F2174.2040003@llnl.gov> <5612F106.1070601@llnl.gov>, <974262C966B9F640899A48EB96313E9A2CC1C9@PRDEXMBX-08.the-lab.llnl.gov> Message-ID: <5618512B.7000605@llnl.gov> All of presented functions reject negative numbers, and some proc files need to accept negative numbers. So that is an issue. I still recommend making the helper function return a signed number and making it the calling function's responsibility to handle negative values as appropriate. Yes, I think that all four of these functions can be replaced: lprocfs_write_helper lprocfs_write_frac_helper lprocfs_write_u64_helper lprocfs_write_frac_u64_helper My recommendation for a prototype is now: int str_to_s64(char *buffer, unsigned long count, __s64 *val, char units); It is not clear to me that the enum adds enough value to be worth while. Chris On 10/09/2015 10:27 AM, Di Natale, Giuseppe wrote: > Greetings, > > I've implemented a working version of the new helper, but I need an opinion on what the interface should ultimately be. I'm trying to find a good middle ground based on everyone's suggestions. So below is a list of options with descriptions for how the functionality is exposed outside of lprocfs. > > This enum is used as a way of defining which "units" are supported or are standard. The enum is used to lookup multipliers for these units. Alignment could also be the incorrect term for what it is achieving. I'm attempting to avoid the potential confusion around units and multiplier. > typedef enum { > ALIGN_NONE = 0, > ALIGN_BYTE = 1, > ... > ALIGN_PAGE_CACHE_MB = 7, > ALIGN_COUNT > } alignment; > > int lprocfs_str_to_u64(const char __user *buffer, unsigned long count, __u64 *val) > > lprocfs_str_to_u64 expects at most a single decimal and only numeric characters in the string buffer. It will return an error code if string represents a negative number, string is invalid, or value represented by string wraps. > > int lprocfs_str_to_u64_aligned(const char __user *buffer, unsigned long count, __u64 *val, alignment align) > > lprocfs_str_to_u64_aligned expects at most a single decimal and only numeric characters in the string buffer. It will return an error code if the string represents a negative number, is invalid, or the final value wraps. The align argument is used to designate what unit (ultimately becomes a multiplier) should be applied to the number represented by the string. > > int lprocfs_str_to_u64_mult(const char __user *buffer, unsigned long count, __u64 *val, __u64 mult) > > lprocfs_str_to_u64_mult expects at most a single decimal and only numeric characters in the string buffer. It will return an error code if the string represents a negative number, is invalid, or the final value wraps. The mult argument is the multiplier to apply to the value represented by the string. This could be included to provide more flexibility instead of strictly allowing certain multipliers. > > int lprocfs_str_with_units_to_u64(const char __user *buffer, unsigned long count, __u64 *val, alignment default_align) > > lprocfs_str_with_units_to_u64 expects at most a single decimal, numeric characters, and only one non numeric character which must be at the end of the string. It will return an error code if the string represents a negative number, is invalid, contains an invalid unit, or the final value wraps. The default_align argument is the default unit to apply to the value represented by the string if it does not contain a char representing a unit. This could be included to provide more flexibility instead of strictly allowing certain multipliers. > > > So the question is, would all of these be suitable or perhaps only some? I was leaning towards keeping the interface as flexible as possible. lprocfs_str_to_u64_aligned could be removed and a utility function to obtain the appropriate multiplier for a given unit can be used in conjunction with lprocfs_str_to_u64_mult for example. Is there really a need to consider other multipliers outside of the widely used units? > > Also, I've begun wondering why lprocfs_write_helper exists and if I should incorporate it in the refactor. Currently, it is similar to the u64 helper with the exception that the value returned is an int. It appears that most callers to the function eventually check if the int value is positive before proceeding to do work. Would it be unwise to replace all those calls to lprocfs_write_helper with one of the u64 helpers and then attempt to refactor/handle the areas in the codebase that expected an int? I feel it may be messy and, in some cases, difficult to remove the use of an integer in some of the calling functions, but is that really a good reason to implement a lprocfs_str_to_int function? > > Thanks, > Giuseppe Di Natale > ________________________________________ > From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Dilger, Andreas [andreas.dilger at intel.com] > Sent: Monday, October 05, 2015 9:23 PM > To: Morrone, Chris > Cc: lustre-devel at lists.lustre.org > Subject: Re: [lustre-devel] lprocfs Helper Issues > > On 2015/10/05, 3:52 PM, "Christopher J. Morrone" wrote: > >> I don't recall any proc files that accepted pages. > > max_pages_per_rpc is probably the main one. > > >> I certainly remember callers sending a multiplier that resulted in the >> string parsing function doing the conversion to pages. But those very >> callers are the ones that break when the string specifies a unit. The >> code authors failed to realize that, so this would let us avoid that >> mistake in the future. > > I'm not against fixing the bugs and improving the interface. > >> I don't think it is terribly onerous to do the bit shifting in the >> caller instead of passing the multiplier as parameter to the string >> conversion function. I think it might even make the code a little more >> readable. > > The question is - how to have the caller do the conversion? If each > caller handles the units conversion (KMGTP) then that duplicates a lot of > code. If the caller doesn't handle the unit conversion, how does it know > whether the result needs to be shifted or not (i.e. was the input value in > units of pages or MB)? > > I'm not against doing it as you propose, if it is an improvement over the > current code. > > Cheers, Andreas > >> >> Chris >> >> On 10/03/2015 02:54 AM, Dilger, Andreas wrote: >>> What if the default unit is in pages? I don't think there is a common >>> suffix for pages. >>> >>> Cheers, Andreas >>> >>>> On Oct 2, 2015, at 18:29, Christopher J. Morrone >>>> wrote: >>>> >>>> It also occurs to me that we shouldn't really have a an integer >>>> multiplier parameter in the function definition. There should just be >>>> a simple "char default_units" parameter. The caller can specify which >>>> character is the default, and then there is no possibility of the >>>> multiplier being misused the way it currently is. >>>> >>>> Chris >>>> >>>>> On 09/30/2015 05:32 PM, Christopher J. Morrone wrote: >>>>>> On 09/30/2015 12:46 PM, Di Natale, Giuseppe wrote: >>>>>> I looked around to see where the helpers are used. It looks to me >>>>>> that >>>>>> they are always used in proc related functions. I agree with the >>>>>> issues you mentioned at the top of the email as well. >>>>> >>>>> Yes, but I meant to say we need to consider future use. Largely >>>>> motivated by the effort to upstream the Lustre client into Linux, the >>>>> /proc interfaces are slowly going away. So I was just suggesting that >>>>> we should check that these functions will still be used by the new >>>>> debugfs/sysfs/whatever interfaces in the future. Nothing really >>>>> needed >>>>> to consider though; they are generic enough to still be used well into >>>>> the future. >>>>> >>>>> With that in mind, we should probably change the function names even >>>>> further. Instead of naming the functions after the current primary >>>>> callers, we should name them according to what they do. Perhaps >>>>> something along the lines of: str_to_u64(). >>>>> >>>>> That is just good naming practice anyway. When you are reading code >>>>> and >>>>> you hit a call to a function named "helper", that doesn't give you >>>>> much >>>>> of a clue as to what it does. >>>>> >>>>>> It also appears that the multiplier is never negative, so making it >>>>>> an >>>>>> unsigned int seems like the right way to go. I also noticed that >>>>>> lprocfs_write_frac_helper calls are always followed by a check if the >>>>>> value produced is greater than 0 and if not an error is thrown. This >>>>>> implies the signed version may not be necessary (and that maybe the >>>>>> unsigned helper should error with strings representing negative >>>>>> numbers?). >>>>>> >>>>>> Also, I think both the unsigned and signed methods parse the numeric >>>>>> portion of the string in a very similar fashion. At the very least, >>>>>> they appear to attempt to do the same thing. That is the portion I >>>>>> was >>>>>> going to consolidate down. >>>>> >>>>> Yes, the _u64_ functions almost certainly started out as a >>>>> cut-and-paste >>>>> of the other functions. >>>>> >>>>>> You didn't comment on detecting overflow/underflow/wrapping. I still >>>>>> think those are a valid concern as well. >>>>> >>>>> I agree. It is completely reasonable to add those checks during the >>>>> refactoring. >>>>> >>>>>> Giuseppe >>>>>> ________________________________________ >>>>>> From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf >>>>>> of Christopher J. Morrone [morrone2 at llnl.gov] >>>>>> Sent: Tuesday, September 29, 2015 7:25 PM >>>>>> To: lustre-devel at lists.lustre.org >>>>>> Subject: Re: [lustre-devel] lprocfs Helper Issues >>>>>> >>>>>> I looked through the code a bit, and I think that the even bigger >>>>>> issues >>>>>> are the lack of reasonable naming, lack of comments, and a puzzling >>>>>> semantic inconsistency. >>>>>> >>>>>> Before working on any of the issues I mention below though, we should >>>>>> probably make sure that these functions still have a purpose once >>>>>> /proc >>>>>> goes away. They seem generic enough helpers that they will still be >>>>>> used with the non-/proc methods, but it is worth checking. >>>>>> >>>>>> First, consider this pair of names: >>>>>> >>>>>> lprocfs_write_frac_helper >>>>>> lprocfs_write_frac_u64_helper >>>>>> >>>>>> One might reasonably suspect that the major difference between these >>>>>> two >>>>>> functions is that the latter deails with a u64, and the former does >>>>>> not. >>>>>> But that is already pretty darn clear from the full function >>>>>> prototype, and really the main difference is that >>>>>> lprocfs_write_frac_u64_helper can parse a units character in the >>>>>> string. >>>>>> Maybe the name should be lprocfs_write_frac_units_helper. >>>>>> >>>>>> Also, the semantics surrounding the multiplier are field are >>>>>> different. >>>>>> For lprocfs_write_frac_helper the mult parameter is always >>>>>> enforced, >>>>>> and there is code that replies on that. With >>>>>> lprocfs_write_frac_u64_helper mult is merely a default, and the >>>>>> caller >>>>>> can't rely on it being used. Two functions with similar names but >>>>>> difference semantics (and not in the way implied by the name >>>>>> difference), and no function comments...not a good idea. >>>>>> >>>>>> Next there is the naming difference between these: >>>>>> >>>>>> lprocfs_write_frac_u64_helper >>>>>> lprocfs_write_u64_helper >>>>>> >>>>>> One might reasonably expect that when using the latter function one >>>>>> loses the ability to handle fractional numbers. But no, actually it >>>>>> just sets the multiplier to a default of 1. How does that naming >>>>>> make >>>>>> any sense? >>>>>> >>>>>> I suppose that with lprocfs_write_helper that naming style almost >>>>>> makes >>>>>> sense, because a multiplier of 1 will result in anything after the >>>>>> decimal point being calculated out to 0. So the fractional part >>>>>> is, in >>>>>> effect, ignored. But, strangely enough, fractions are still >>>>>> _accepted_ >>>>>> by the function. >>>>>> >>>>>> This semantic distinction is important to consider. It means that >>>>>> you >>>>>> can't just do a naive combination of the two functions into your >>>>>> proposed lprocfs_write_frac_helper_internal() function. There are >>>>>> callers of lprocfs_write_frac_helper that assume that the multiplier >>>>>> can >>>>>> be only the one specified and would result in incorrect number if >>>>>> there >>>>>> were user-specified units in the string. >>>>>> >>>>>> By the was, I'm not really in favor of duplicating the existing >>>>>> functions with a hope to remove the old ones at some time in the >>>>>> future. >>>>>> I think (despite current evidence to the contrary) that these >>>>>> functions are not so difficult to review that we would need a >>>>>> transition >>>>>> period. We would just need to audit every caller to make sure that >>>>>> any >>>>>> semantic changes are handled. >>>>>> >>>>>> And frankly, there would appear to be code that _already_ gets this >>>>>> wrong, so an audit is really needed already. For instance, >>>>>> ll_max_readahead_mb_seq_write() tries to be too clever by assuming >>>>>> that >>>>>> users can only provide an integer that represents number of MiB, and >>>>>> then passes in a multiplier that will have it convert into number of >>>>>> pages. But the since they used lprocfs_write_frac_u64_helper(), the >>>>>> user can specify their own units, and then the number returned number >>>>>> will be bytes instead of pages. Here are the callers that I found >>>>>> that >>>>>> are doing it wrong: >>>>>> >>>>>> ll_max_readahead_mb_seq_write >>>>>> ll_max_cached_mb_seq_write >>>>>> proc_max_dirty_pages_in_mb >>>>>> osc_cached_mb_seq_write >>>>>> >>>>>> 4 out of 5 are doing it wrong. Not a good track record. >>>>>> >>>>>> And getting back to the point, franctions and units are both accepted >>>>>> and handled by lprocfs_write_u64_helper, so the lack of "_frac_" in >>>>>> the >>>>>> name is misleading at best. >>>>>> >>>>>> Why does lprocfs_write_frac_helper do its own handling of negatives >>>>>> and >>>>>> then call the unsigned simple_strtoul function? Why not just use the >>>>>> signed simple_strtol function? As far as I can tell the signed >>>>>> version >>>>>> of the function has been in Linux as long as the unsigned version. >>>>>> >>>>>> Why is mult declared as a signed int? I think it should almost >>>>>> certainly be unsigned. I think it might only be signed because the >>>>>> function author reuses mult as a local variable to stored the >>>>>> negative >>>>>> sign when parsed from the string. If so, that is a poor choice. The >>>>>> function declaration is a contract with the caller. If it makes no >>>>>> sense to pass in a negative multiplier, then the declaration should >>>>>> make >>>>>> that clear by declaring it unsigned. >>>>>> >>>>>> Why do the unsigned versions of the helper functions allow and parse >>>>>> negative numbers? I think that this gets to the heart of your >>>>>> suggestion about special handling for -1. I think that knowing that >>>>>> -1 >>>>>> has special meaning for something things is too specialized for the >>>>>> helper function. I think we are better off letting the caller >>>>>> decided >>>>>> what special handling to do and when. >>>>>> >>>>>> I would suggest that the main helper that does handling of >>>>>> user-specified units should not be casting the number to an unsigned >>>>>> value. Leave the casting to the caller, or perhaps provide a simple >>>>>> wrapper to cast away the sign. I don't think we are going to miss >>>>>> that >>>>>> one extra bit for positive numbers. >>>>>> >>>>>> So maybe we need the most generic function prototype be be something >>>>>> like: >>>>>> >>>>>> int lprocfs_write_helper(char *buffer, unsigned long count, __s64 >>>>>> *val, >>>>>> unsigned int mult, bool units_allowed); >>>>>> >>>>>> The function comment would explain that if units are allowed, then >>>>>> the >>>>>> multiplier is only a default and will be overridden by the >>>>>> user-specificed unit. >>>>>> >>>>>> Chris >>>>>> >>>>>>> On 09/28/2015 01:08 PM, Di Natale, Giuseppe wrote: >>>>>>> Greetings, >>>>>>> >>>>>>> Recently, I've noticed that the lprocfs write frac int and u64 >>>>>>> helpers >>>>>>> have a few issues. The biggest issue is that neither function >>>>>>> handles >>>>>>> overflow/wrap. I also noticed very similar code that should be >>>>>>> consolidated down and leveraged by both helpers. >>>>>>> >>>>>>> I was thinking of refactoring the functions in the fashion described >>>>>>> below. >>>>>>> >>>>>>> int lprocfs_write_frac_helper_internal(char *buffer, unsigned long >>>>>>> count, __u64 *val, int mult); >>>>>>> int lprocfs_write_frac_u64_helper_safe(const char __user *buffer, >>>>>>> unsigned long count, __u64 *val, int mult); >>>>>>> int lprocfs_write_frac_helper_safe(const char __user *buffer, >>>>>>> unsigned >>>>>>> long count, int *val, int mult); >>>>>>> >>>>>>> lprocfs_write_frac_helper_internal would handle parsing an unsigned >>>>>>> long >>>>>>> long from the kernel char buffer passed in. It will be responsible >>>>>>> for >>>>>>> detecting if a uint wrap occurs. >>>>>>> >>>>>>> For lprocfs_write_frac_u64_helper_safe, the string "-1" will >>>>>>> automatically return ULLONG_MAX. If any other string representing a >>>>>>> negative number is passed in, an invalid value error code should be >>>>>>> returned. If the multiplier is negative, that would also be treated >>>>>>> as >>>>>>> invalid. The units and multiplier logic can also be consolidated. It >>>>>>> will use lprocfs_write_frac_helper_internal to handle the parsing. >>>>>>> >>>>>>> lprocfs_write_frac_helper_safe will leverage >>>>>>> lprocfs_write_frac_helper_internal. If >>>>>>> lprocfs_write_frac_helper_internal indicates a wrap occurred, then >>>>>>> we >>>>>>> also have an invalid integer. Checks for integer overflow happen >>>>>>> after a >>>>>>> successful call to the internal helper. This is similar to how the >>>>>>> current lprocfs_write_frac_helper functions. >>>>>>> >>>>>>> It is also worth nothing, I plan to maintain the old helpers and >>>>>>> their >>>>>>> use can be gradually phased out once we are confident the refactored >>>>>>> version is doing what it is supposed to. >>>>>>> >>>>>>> Also, unrelated to the above, quick question about lctl. Is there a >>>>>>> particular reason why the setting to be changed when using lctl >>>>>>> set_param is echoed back to the user? I think it can be misleading >>>>>>> in >>>>>>> cases where the value set is not necessarily what is being >>>>>>> reflected to >>>>>>> the user (i.e. -1 for max value). That could be confusing to a user >>>>>>> and >>>>>>> they should be using lctl get_param to confirm their value was set >>>>>>> anyways. Also, it would follow convention that unless an error >>>>>>> happens, >>>>>>> nothing is printed to console. Any disagreements on silencing lctl >>>>>>> set_param? >>>>>>> >>>>>>> Thanks, >>>>>>> Giuseppe Di Natale >>>>>>> >>>>>>> >>>>>>> > > > Cheers, Andreas > -- > Andreas Dilger > > Lustre Software Architect > Intel High Performance Data Division > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > > . > From ryan.van.quinlan at gmail.com Sun Oct 11 04:53:50 2015 From: ryan.van.quinlan at gmail.com (Ryan Van Quinlan) Date: Sat, 10 Oct 2015 21:53:50 -0700 Subject: [lustre-devel] [PATCH] staging: lustre: lclient: NULL comparison style Message-ID: <20151011045349.GA21387@ryan-ThinkPad-T430s> Fixes checkpatch.pl checks: CHECK: Comparison to NULL could be written ... Signed-off-by: Ryan Van Quinlan --- drivers/staging/lustre/lustre/lclient/glimpse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/lclient/glimpse.c b/drivers/staging/lustre/lustre/lclient/glimpse.c index b9f2bb6..8533a1e 100644 --- a/drivers/staging/lustre/lustre/lclient/glimpse.c +++ b/drivers/staging/lustre/lustre/lclient/glimpse.c @@ -73,7 +73,7 @@ blkcnt_t dirty_cnt(struct inode *inode) struct ccc_object *vob = cl_inode2ccc(inode); void *results[1]; - if (inode->i_mapping != NULL) + if (inode->i_mapping) cnt += radix_tree_gang_lookup_tag(&inode->i_mapping->page_tree, results, 0, 1, PAGECACHE_TAG_DIRTY); @@ -129,7 +129,7 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, current); cio->cui_glimpse = 0; - if (lock == NULL) + if (!lock) return 0; if (IS_ERR(lock)) @@ -255,7 +255,7 @@ int cl_local_size(struct inode *inode) *descr = whole_file; descr->cld_obj = clob; lock = cl_lock_peek(env, io, descr, "localsize", current); - if (lock != NULL) { + if (lock) { cl_merge_lvb(env, inode); cl_unuse(env, lock); cl_lock_release(env, lock, "localsize", current); -- 1.9.1 From andreas.dilger at intel.com Tue Oct 13 22:42:22 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 13 Oct 2015 22:42:22 +0000 Subject: [lustre-devel] [PATCH 0/7] staging: lustre: remove uses and definition of container_of0 In-Reply-To: References: Message-ID: On 2015/10/13, 16:19, "Aya Mahfouz" wrote: >container_of0 can be replaced by the Linux kernel macro container_of. >The only difference is that container_of0 tries to evade type casting >when the pointer is erroneous or null. All uses of container_of0 have >been replaced by container_of and then the macro was removed in the last >patch. Thank you for your patch. However, it should be noted that this blanket replacement of container_of0() isn't necessarily safe. If the caller isn't explicitly checking for IS_ERR(ptr) or ptr == NULL then the container_of() macro can transform the err/NULL pointer into another pointer that is NOT err/NULL and cause the kernel to oops when the bad pointer is used, even if there are later IS_ERR() or NULL checks. I'm not against removing container_of0() completely, but not without a clear review of the callers to determine whether err/NULL pointers are not actually possible in this callpath, or explicit checks in the callers for err/NULL pointers before container_of() is used. Did you do that? Cheers, Andreas >Aya Mahfouz (7): > staging: lustre: lcommon_cl.c: replace container_of0 by container_of > staging: lustre: llite_nfs.c: replace container_of0 by container_of > staging: lustre: lu_object.c: replace container_of0 by container_of > staging: lustre: echo_client.c: replace container_of0 by container_of > staging: lustre: osc_io.c: replace container_of0 by container_of > staging: lustre: osc_object.c: replace container_of0 by container_of > staging: lustre: remove container_of0 and __container_of > > drivers/staging/lustre/include/linux/libcfs/libcfs.h | 11 ----------- > drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 10 +++++----- > drivers/staging/lustre/lustre/llite/llite_nfs.c | 2 +- > drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +++--- > drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 +- > drivers/staging/lustre/lustre/osc/osc_io.c | 4 ++-- > drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- > 7 files changed, 13 insertions(+), 24 deletions(-) > >-- >2.4.2 > > >-- >Kind Regards, >Aya Saif El-yazal Mahfouz > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From lkp at intel.com Tue Oct 13 23:28:13 2015 From: lkp at intel.com (kbuild test robot) Date: Wed, 14 Oct 2015 07:28:13 +0800 Subject: [lustre-devel] [PATCH 2/7] staging: lustre: llite_nfs.c: replace container_of0 by container_of In-Reply-To: Message-ID: <201510140740.tybjxpAz%fengguang.wu@intel.com> Hi Aya, [auto build test WARNING on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Aya-Mahfouz/staging-lustre-remove-uses-and-definition-of-container_of0/20151014-062751 config: arm64-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm64 All warnings (new ones prefixed by >>): In file included from include/linux/list.h:8:0, from include/linux/wait.h:6, from include/linux/fs.h:5, from drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:44, from drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from drivers/staging/lustre/lustre/llite/llite_nfs.c:45: drivers/staging/lustre/lustre/llite/llite_nfs.c: In function 'll_nfs_get_name_filldir': include/linux/kernel.h:811:48: warning: initialization from incompatible pointer type const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/staging/lustre/lustre/llite/llite_nfs.c:213:26: note: in expansion of macro 'container_of' struct lu_dirent *lde = container_of(name, struct lu_dirent, lde_name); ^ >> include/linux/kernel.h:811:48: warning: (near initialization for 'lde') const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/staging/lustre/lustre/llite/llite_nfs.c:213:26: note: in expansion of macro 'container_of' struct lu_dirent *lde = container_of(name, struct lu_dirent, lde_name); ^ vim +/lde +811 include/linux/kernel.h ^1da177e Linus Torvalds 2005-04-16 795 91f68b73 Wu Fengguang 2009-01-07 796 91f68b73 Wu Fengguang 2009-01-07 797 /* 91f68b73 Wu Fengguang 2009-01-07 798 * swap - swap value of @a and @b 91f68b73 Wu Fengguang 2009-01-07 799 */ ac7b9004 Peter Zijlstra 2009-02-04 800 #define swap(a, b) \ ac7b9004 Peter Zijlstra 2009-02-04 801 do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) 91f68b73 Wu Fengguang 2009-01-07 802 ^1da177e Linus Torvalds 2005-04-16 803 /** ^1da177e Linus Torvalds 2005-04-16 804 * container_of - cast a member of a structure out to the containing structure ^1da177e Linus Torvalds 2005-04-16 805 * @ptr: the pointer to the member. ^1da177e Linus Torvalds 2005-04-16 806 * @type: the type of the container struct this is embedded in. ^1da177e Linus Torvalds 2005-04-16 807 * @member: the name of the member within the struct. ^1da177e Linus Torvalds 2005-04-16 808 * ^1da177e Linus Torvalds 2005-04-16 809 */ ^1da177e Linus Torvalds 2005-04-16 810 #define container_of(ptr, type, member) ({ \ ^1da177e Linus Torvalds 2005-04-16 @811 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^1da177e Linus Torvalds 2005-04-16 812 (type *)( (char *)__mptr - offsetof(type,member) );}) ^1da177e Linus Torvalds 2005-04-16 813 b9d4f426 Arnaud Lacombe 2011-07-25 814 /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ b9d4f426 Arnaud Lacombe 2011-07-25 815 #ifdef CONFIG_FTRACE_MCOUNT_RECORD b9d4f426 Arnaud Lacombe 2011-07-25 816 # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD b9d4f426 Arnaud Lacombe 2011-07-25 817 #endif 9d00f92f WANG Cong 2011-07-25 818 58f86cc8 Rusty Russell 2014-03-24 819 /* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ :::::: The code at line 811 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2 :::::: TO: Linus Torvalds :::::: CC: Linus Torvalds --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/octet-stream Size: 45658 bytes Desc: not available URL: From lkp at intel.com Tue Oct 13 23:25:06 2015 From: lkp at intel.com (kbuild test robot) Date: Wed, 14 Oct 2015 07:25:06 +0800 Subject: [lustre-devel] [PATCH 2/7] staging: lustre: llite_nfs.c: replace container_of0 by container_of In-Reply-To: Message-ID: <201510140754.x1M8HsOi%fengguang.wu@intel.com> Hi Aya, [auto build test WARNING on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Aya-Mahfouz/staging-lustre-remove-uses-and-definition-of-container_of0/20151014-062751 config: blackfin-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=blackfin All warnings (new ones prefixed by >>): drivers/staging/lustre/lustre/llite/llite_nfs.c: In function 'll_nfs_get_name_filldir': >> drivers/staging/lustre/lustre/llite/llite_nfs.c:213:26: warning: initialization from incompatible pointer type [enabled by default] >> drivers/staging/lustre/lustre/llite/llite_nfs.c:213:26: warning: (near initialization for 'lde') [enabled by default] vim +213 drivers/staging/lustre/lustre/llite/llite_nfs.c 197 if (*plen < sizeof(struct lustre_nfs_fid) / 4) 198 return 255; 199 200 nfs_fid->lnf_child = *ll_inode2fid(inode); 201 nfs_fid->lnf_parent = *ll_inode2fid(parent); 202 *plen = sizeof(struct lustre_nfs_fid) / 4; 203 204 return LUSTRE_NFS_FID; 205 } 206 207 static int ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, 208 int namelen, loff_t hash, u64 ino, 209 unsigned type) 210 { 211 /* It is hack to access lde_fid for comparison with lgd_fid. 212 * So the input 'name' must be part of the 'lu_dirent'. */ > 213 struct lu_dirent *lde = container_of(name, struct lu_dirent, lde_name); 214 struct ll_getname_data *lgd = 215 container_of(ctx, struct ll_getname_data, ctx); 216 struct lu_fid fid; 217 218 fid_le_to_cpu(&fid, &lde->lde_fid); 219 if (lu_fid_eq(&fid, &lgd->lgd_fid)) { 220 memcpy(lgd->lgd_name, name, namelen); 221 lgd->lgd_name[namelen] = 0; --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/octet-stream Size: 38047 bytes Desc: not available URL: From mahfouz.saif.elyazal at gmail.com Tue Oct 13 22:23:34 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Wed, 14 Oct 2015 00:23:34 +0200 Subject: [lustre-devel] [PATCH 3/7] staging: lustre: lu_object.c: replace container_of0 by container_of In-Reply-To: References: Message-ID: Replaces container_of0 by container_of. The only difference between the two implementations is that container_of0 tries to evade type casting if the pointer is erroneous or null. The use of container_of is encouraged to bring lustre one step closer to community standards. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 0d15bd5..82873fb 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -294,7 +294,7 @@ static void lu_object_free(const struct lu_env *env, struct lu_object *o) * lives as long as possible and ->loo_object_free() methods * can look at its contents. */ - o = container_of0(splice.prev, struct lu_object, lo_linkage); + o = container_of(splice.prev, struct lu_object, lo_linkage); list_del_init(&o->lo_linkage); LASSERT(o->lo_ops->loo_object_free != NULL); o->lo_ops->loo_object_free(env, o); @@ -368,7 +368,7 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) * races due to the reasons described in lu_object_put(). */ while (!list_empty(&dispose)) { - h = container_of0(dispose.next, + h = container_of(dispose.next, struct lu_object_header, loh_lru); list_del_init(&h->loh_lru); lu_object_free(env, lu_object_top(h)); @@ -542,7 +542,7 @@ static struct lu_object *htable_lookup(struct lu_site *s, return ERR_PTR(-ENOENT); } - h = container_of0(hnode, struct lu_object_header, loh_hash); + h = container_of(hnode, struct lu_object_header, loh_hash); if (likely(!lu_object_is_dying(h))) { cfs_hash_get(s->ls_obj_hash, hnode); lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 13 22:23:54 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Wed, 14 Oct 2015 00:23:54 +0200 Subject: [lustre-devel] [PATCH 4/7] staging: lustre: echo_client.c: replace container_of0 by container_of In-Reply-To: References: Message-ID: Replaces container_of0 by container_of. The only difference between the two implementations is that container_of0 tries to evade type casting if the pointer is erroneous or null. The use of container_of is encouraged to bring lustre one step closer to community standards. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index ef9cb31..1e9a57f 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -103,7 +103,7 @@ static int echo_client_cleanup(struct obd_device *obddev); */ static inline struct echo_device *cl2echo_dev(const struct cl_device *dev) { - return container_of0(dev, struct echo_device, ed_cl); + return container_of(dev, struct echo_device, ed_cl); } static inline struct cl_device *echo_dev2cl(struct echo_device *d) -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 13 22:24:19 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Wed, 14 Oct 2015 00:24:19 +0200 Subject: [lustre-devel] [PATCH 5/7] staging: lustre: osc_io.c: replace container_of0 by container_of In-Reply-To: References: Message-ID: Replaces container_of0 by container_of. The only difference between the two implementations is that container_of0 tries to evade type casting if the pointer is erroneous or null. The use of container_of is encouraged to bring lustre one step closer to community standards. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/osc/osc_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 3a4200f..fb3b415 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -56,13 +56,13 @@ static struct osc_req *cl2osc_req(const struct cl_req_slice *slice) { LINVRNT(slice->crs_dev->cd_lu_dev.ld_type == &osc_device_type); - return container_of0(slice, struct osc_req, or_cl); + return container_of(slice, struct osc_req, or_cl); } static struct osc_io *cl2osc_io(const struct lu_env *env, const struct cl_io_slice *slice) { - struct osc_io *oio = container_of0(slice, struct osc_io, oi_cl); + struct osc_io *oio = container_of(slice, struct osc_io, oi_cl); LINVRNT(oio == osc_env_io(env)); return oio; -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 13 22:22:34 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Wed, 14 Oct 2015 00:22:34 +0200 Subject: [lustre-devel] [PATCH 1/7] staging: lustre: lcommon_cl.c: replace container_of0 by container_of In-Reply-To: References: Message-ID: Replaces container_of0 by container_of. The only difference between the two implementations is that container_of0 tries to evade type casting if the pointer is erroneous or null. The use of container_of is encouraged to bring lustre one step closer to community standards. Cc: jes.sorensen at gmail.com Cc: kyle at mcmartin.ca Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index ef2e266..a941aaf 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -917,12 +917,12 @@ struct lu_device *ccc2lu_dev(struct ccc_device *vdv) struct ccc_device *lu2ccc_dev(const struct lu_device *d) { - return container_of0(d, struct ccc_device, cdv_cl.cd_lu_dev); + return container_of(d, struct ccc_device, cdv_cl.cd_lu_dev); } struct ccc_device *cl2ccc_dev(const struct cl_device *d) { - return container_of0(d, struct ccc_device, cdv_cl); + return container_of(d, struct ccc_device, cdv_cl); } struct lu_object *ccc2lu(struct ccc_object *vob) @@ -932,12 +932,12 @@ struct lu_object *ccc2lu(struct ccc_object *vob) struct ccc_object *lu2ccc(const struct lu_object *obj) { - return container_of0(obj, struct ccc_object, cob_cl.co_lu); + return container_of(obj, struct ccc_object, cob_cl.co_lu); } struct ccc_object *cl2ccc(const struct cl_object *obj) { - return container_of0(obj, struct ccc_object, cob_cl); + return container_of(obj, struct ccc_object, cob_cl); } struct ccc_lock *cl2ccc_lock(const struct cl_lock_slice *slice) @@ -957,7 +957,7 @@ struct ccc_io *cl2ccc_io(const struct lu_env *env, struct ccc_req *cl2ccc_req(const struct cl_req_slice *slice) { - return container_of0(slice, struct ccc_req, crq_cl); + return container_of(slice, struct ccc_req, crq_cl); } struct page *cl2vm_page(const struct cl_page_slice *slice) -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 13 22:24:37 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Wed, 14 Oct 2015 00:24:37 +0200 Subject: [lustre-devel] [PATCH 6/7] staging: lustre: osc_object.c: replace container_of0 by container_of In-Reply-To: References: Message-ID: <9e8c34322eb346f02f3c6c0e9bac7c0652cb78d0.1444774232.git.mahfouz.saif.elyazal@gmail.com> Replaces container_of0 by container_of. The only difference between the two implementations is that container_of0 tries to evade type casting if the pointer is erroneous or null. The use of container_of is encouraged to bring lustre one step closer to community standards. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index acffab9..f916b09 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -60,7 +60,7 @@ static struct lu_object *osc2lu(struct osc_object *osc) static struct osc_object *lu2osc(const struct lu_object *obj) { LINVRNT(osc_is_object(obj)); - return container_of0(obj, struct osc_object, oo_cl.co_lu); + return container_of(obj, struct osc_object, oo_cl.co_lu); } /***************************************************************************** -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 13 22:24:53 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Wed, 14 Oct 2015 00:24:53 +0200 Subject: [lustre-devel] [PATCH 7/7] staging: lustre: remove container_of0 and __container_of In-Reply-To: References: Message-ID: <78ef63421d4d50eb583b22944816720eda8d4717.1444774232.git.mahfouz.saif.elyazal@gmail.com> All uses of container_of0 have been replaced by container_of. container_of0 and __container_of can be safely removed. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/include/linux/libcfs/libcfs.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 385ced1..e4a0c40 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -128,17 +128,6 @@ void cfs_get_random_bytes(void *buf, int size); #include "libcfs_fail.h" #include "libcfs_crypto.h" -/* container_of depends on "likely" which is defined in libcfs_private.h */ -static inline void *__container_of(void *ptr, unsigned long shift) -{ - if (IS_ERR_OR_NULL(ptr)) - return ptr; - return (char *)ptr - shift; -} - -#define container_of0(ptr, type, member) \ - ((type *)__container_of((void *)(ptr), offsetof(type, member))) - #define _LIBCFS_H void *libcfs_kvzalloc(size_t size, gfp_t flags); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From lkp at intel.com Wed Oct 14 02:50:35 2015 From: lkp at intel.com (kbuild test robot) Date: Wed, 14 Oct 2015 10:50:35 +0800 Subject: [lustre-devel] [PATCH 7/7] staging: lustre: remove container_of0 and __container_of In-Reply-To: <78ef63421d4d50eb583b22944816720eda8d4717.1444774232.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <201510141027.Y3GMZDIj%fengguang.wu@intel.com> Hi Aya, [auto build test WARNING on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Aya-Mahfouz/staging-lustre-remove-uses-and-definition-of-container_of0/20151014-062751 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) >> drivers/staging/lustre/lustre/fid/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/fid/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/fid/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/fid/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/fid/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/fid/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/fid/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/fid/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/fid/../include/obd.h:52, from drivers/staging/lustre/lustre/fid/fid_request.c:48: drivers/staging/lustre/lustre/fid/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/fid/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/fid/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/fid/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/fid/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/fld/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/fld/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/fld/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/fld/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/fld/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/fld/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/fld/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/fld/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/fld/../include/obd.h:52, from drivers/staging/lustre/lustre/fld/fld_request.c:49: drivers/staging/lustre/lustre/fld/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/fld/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/fld/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/fld/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/fld/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:40: sparse: got cl_object_header In file included from drivers/staging/lustre/lustre/llite/../include/linux/../lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/linux/../obd_class.h:41, from drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:47, from drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from drivers/staging/lustre/lustre/llite/dcache.c:44: drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/dcache.c:48: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:40: sparse: got cl_object_header In file included from drivers/staging/lustre/lustre/llite/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/obd_class.h:41, from drivers/staging/lustre/lustre/llite/dir.c:52: drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/dir.c:58: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:40: sparse: got cl_object_header In file included from drivers/staging/lustre/lustre/llite/../include/linux/../lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/linux/../obd_class.h:41, from drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:47, from drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from drivers/staging/lustre/lustre/llite/llite_nfs.c:45: drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/llite_nfs.c:46: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from include/linux/list.h:8:0, from include/linux/wait.h:6, from include/linux/fs.h:5, from drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:44, from drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from drivers/staging/lustre/lustre/llite/llite_nfs.c:45: drivers/staging/lustre/lustre/llite/llite_nfs.c: In function 'll_nfs_get_name_filldir': include/linux/kernel.h:811:48: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/staging/lustre/lustre/llite/llite_nfs.c:213:26: note: in expansion of macro 'container_of' struct lu_dirent *lde = container_of(name, struct lu_dirent, lde_name); ^ include/linux/kernel.h:811:48: note: (near initialization for 'lde') const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/staging/lustre/lustre/llite/llite_nfs.c:213:26: note: in expansion of macro 'container_of' struct lu_dirent *lde = container_of(name, struct lu_dirent, lde_name); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:40: sparse: got cl_object_header In file included from drivers/staging/lustre/lustre/llite/../lclient/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../lclient/../include/obd_class.h:41, from drivers/staging/lustre/lustre/llite/../lclient/glimpse.c:44: drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/../lclient/glimpse.c:54:0: drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:40: sparse: got cl_object_header drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:29: sparse: not a function drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:29: sparse: not a function In file included from drivers/staging/lustre/lustre/llite/../lclient/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../lclient/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/llite/../lclient/../include/obd.h:52, from drivers/staging/lustre/lustre/llite/../lclient/lcommon_cl.c:53: drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/../lclient/lcommon_cl.c:60:0: drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2658:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2675:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:40: sparse: got cl_object_header drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' In file included from drivers/staging/lustre/lustre/llite/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/llite/../include/obd.h:52, from drivers/staging/lustre/lustre/llite/vvp_dev.c:43: drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/vvp_dev.c:45: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2669:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/llite/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/llite/../include/obd.h:52, from drivers/staging/lustre/lustre/llite/vvp_dev.c:43: drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/llite/../include/lu_object.h:738:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/vvp_dev.c:45: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/lmv/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lmv/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lmv/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lmv/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lmv/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lmv/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/lmv/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lmv/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lmv/lmv_obd.c:50: drivers/staging/lustre/lustre/lmv/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lmv/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lmv/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lmv/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lmv/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/lov_obd.c:48: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_obd.c:56:0: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/lov_pack.c:45: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:29: sparse: not a function drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:29: sparse: not a function >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: undefined identifier 'struct' In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/obd_class.h:41, from drivers/staging/lustre/lustre/lov/lov_dev.c:44: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lov_dev.c:46: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lov_dev.c:46:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:30: error: expected expression before 'struct' return container_of0(slice, struct lov_page, lps_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:30: error: expected expression before 'struct' return container_of0(slice, struct lov_req, lr_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_page, lsb_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_req, lsrq_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:682:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:704:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lov_dev.c:46: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2658:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/lov/lov_dev.c:46:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:781:1: warning: control reaches end of non-void function [-Wreturn-type] -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:29: sparse: not a function drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:29: sparse: not a function drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:29: sparse: not a function >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:29: sparse: not a function >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:29: sparse: not a function In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/../include/obd.h:52, from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:51, from drivers/staging/lustre/lustre/lov/lov_object.c:44: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lov_object.c:44: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lov_object.c:44:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:30: error: expected expression before 'struct' return container_of0(slice, struct lov_page, lps_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:30: error: expected expression before 'struct' return container_of0(slice, struct lov_req, lr_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_page, lsb_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_req, lsrq_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:726:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lov_object.c:44: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/lov/lov_object.c:44:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:742:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:16: sparse: undefined identifier 'container_of0' In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/../include/obd.h:52, from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:51, from drivers/staging/lustre/lustre/lov/lov_page.c:43: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lov_page.c:43: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lov_page.c:43:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl); ^ -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/../include/obd.h:52, from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:51, from drivers/staging/lustre/lustre/lov/lov_lock.c:43: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lov_lock.c:43: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lov_lock.c:43:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:30: error: expected expression before 'struct' return container_of0(slice, struct lov_page, lps_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:30: error: expected expression before 'struct' return container_of0(slice, struct lov_req, lr_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_page, lsb_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_req, lsrq_cl); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lov_lock.c:43: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/lov/lov_lock.c:43:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:726:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:29: sparse: not a function In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/../include/obd.h:52, from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:51, from drivers/staging/lustre/lustre/lov/lov_io.c:44: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lov_io.c:44: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lov_io.c:44:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:30: error: expected expression before 'struct' return container_of0(slice, struct lov_page, lps_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:30: error: expected expression before 'struct' return container_of0(slice, struct lov_req, lr_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_page, lsb_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_req, lsrq_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:682:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:726:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:748:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:29: sparse: not a function drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:29: sparse: not a function drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: undefined identifier 'struct' In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/../include/obd.h:52, from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:51, from drivers/staging/lustre/lustre/lov/lovsub_dev.c:41: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lovsub_dev.c:41: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lovsub_dev.c:41:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:29: sparse: not a function drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: undefined identifier 'struct' In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/../include/obd.h:52, from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:51, from drivers/staging/lustre/lustre/lov/lovsub_object.c:43: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lovsub_object.c:43: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lovsub_object.c:43:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:30: error: expected expression before 'struct' return container_of0(slice, struct lov_page, lps_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:30: error: expected expression before 'struct' return container_of0(slice, struct lov_req, lr_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_page': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_page, lsb_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_req': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:30: error: expected expression before 'struct' return container_of0(slice, struct lovsub_req, lsrq_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:698:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lovsub_object.c:43: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2669:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/../include/obd.h:52, from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:51, from drivers/staging/lustre/lustre/lov/lovsub_page.c:41: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lovsub_page.c:41: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lovsub_page.c:41:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov_page': -- >> drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:40: sparse: got lov_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:33: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:40: sparse: got lovsub_device drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:42: sparse: got lov_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:35: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:42: sparse: got lovsub_object drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:775:44: sparse: got lov_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:780:44: sparse: got lov_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:787:44: sparse: got lovsub_page drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:37: sparse: typename in expression drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/lov/lov_cl_internal.h:792:44: sparse: got lovsub_req drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:16: sparse: undefined identifier 'container_of0' In file included from drivers/staging/lustre/lustre/lov/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/lov/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/lov/../include/obd.h:52, from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:51, from drivers/staging/lustre/lustre/lov/lovsub_lock.c:43: drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/lov/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/lov/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/lov/lov_cl_internal.h:52:0, from drivers/staging/lustre/lustre/lov/lovsub_lock.c:43: drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/lov/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/lov/lovsub_lock.c:43:0: drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:681:26: error: expected expression before 'struct' return container_of0(d, struct lov_device, ld_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:697:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub_dev': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:703:26: error: expected expression before 'struct' return container_of0(d, struct lovsub_device, acid_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:719:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl.co_lu); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lov': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:725:28: error: expected expression before 'struct' return container_of0(obj, struct lov_object, lo_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'cl2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:741:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl); ^ drivers/staging/lustre/lustre/lov/lov_cl_internal.h: In function 'lu2lovsub': drivers/staging/lustre/lustre/lov/lov_cl_internal.h:747:28: error: expected expression before 'struct' return container_of0(obj, struct lovsub_object, lso_cl.co_lu); ^ -- >> drivers/staging/lustre/lustre/mdc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/mdc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/mdc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/mdc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/mdc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/mdc/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/mdc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/mdc/../include/obd_class.h:41, from drivers/staging/lustre/lustre/mdc/mdc_request.c:46: drivers/staging/lustre/lustre/mdc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/mdc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/mdc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/mdc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/mdc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/mgc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/mgc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/mgc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/mgc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/mgc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/mgc/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/mgc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/mgc/../include/obd_class.h:41, from drivers/staging/lustre/lustre/mgc/mgc_request.c:45: drivers/staging/lustre/lustre/mgc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/mgc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/mgc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/mgc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/mgc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/llog_obd.c:39: drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: got cl_object_header In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/class_obd.c:41: drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/obdclass/class_obd.c:47:0: drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:29: sparse: not a function In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/lu_object.c:53: drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:738:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: got cl_object_header drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:16: sparse: undefined identifier 'container_of0' In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/cl_object.c:56: drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/obdclass/cl_object.c:61:0: drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2669:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/cl_object.c:56: drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:738:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/obdclass/cl_object.c:61:0: drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2658:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: got cl_object_header drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/cl_page.c:44: drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/obdclass/cl_page.c:48:0: drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: got cl_object_header drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:29: sparse: not a function In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/cl_lock.c:43: drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/obdclass/cl_lock.c:47:0: drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:40: sparse: got cl_object_header drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:16: sparse: undefined identifier 'container_of0' In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/cl_io.c:43: drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdclass/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/obdclass/cl_io.c:47:0: drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/obdclass/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdclass/../include/cl_object.h:2658:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/obdclass/linux/../../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdclass/linux/../../include/obd_class.h:41, from drivers/staging/lustre/lustre/obdclass/linux/linux-module.c:71: drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdclass/linux/../../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2690:40: sparse: got cl_object_header drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2674:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:29: sparse: not a function drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2690:29: sparse: not a function >> drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:29: sparse: not a function >> drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:29: sparse: not a function drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:29: sparse: not a function drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:29: sparse: not a function drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:29: sparse: not a function drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:29: sparse: not a function drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:29: sparse: not a function drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:29: sparse: not a function In file included from drivers/staging/lustre/lustre/obdecho/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/obdecho/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/obdecho/../include/obd.h:52, from drivers/staging/lustre/lustre/obdecho/echo_client.c:40: drivers/staging/lustre/lustre/obdecho/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/obdecho/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/obdecho/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/obdecho/echo_client.c:45:0: drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2658:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2669:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2675:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/obdecho/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/obdecho/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: got osc_device drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: got osc_object drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: got osc_lock drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/osc/../include/obd.h:52, from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:51, from drivers/staging/lustre/lustre/osc/osc_page.c:43: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_page.c:43: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:55:0, from drivers/staging/lustre/lustre/osc/osc_page.c:43: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ In file included from drivers/staging/lustre/lustre/osc/osc_page.c:43:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:26: error: expected expression before 'struct' return container_of0(d, struct osc_device, od_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:28: error: expected expression before 'struct' return container_of0(obj, struct osc_object, oo_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:30: error: expected expression before 'struct' return container_of0(slice, struct osc_page, ops_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:28: error: expected expression before 'struct' return container_of0(oap, struct osc_page, ops_oap); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:30: error: expected expression before 'struct' return container_of0(slice, struct osc_lock, ols_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:551:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:502:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:572:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_page.c:43: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/osc/osc_page.c:43:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:518:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: got osc_device drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: got osc_object drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: got osc_lock drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:29: sparse: not a function In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/osc/../include/obd.h:52, from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:51, from drivers/staging/lustre/lustre/osc/osc_lock.c:47: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_lock.c:47: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:55:0, from drivers/staging/lustre/lustre/osc/osc_lock.c:47: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ In file included from drivers/staging/lustre/lustre/osc/osc_lock.c:47:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:26: error: expected expression before 'struct' return container_of0(d, struct osc_device, od_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:28: error: expected expression before 'struct' return container_of0(obj, struct osc_object, oo_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:30: error: expected expression before 'struct' return container_of0(slice, struct osc_page, ops_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:28: error: expected expression before 'struct' return container_of0(oap, struct osc_page, ops_oap); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:30: error: expected expression before 'struct' return container_of0(slice, struct osc_lock, ols_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h:572:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:518:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_lock.c:47: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/osc/osc_lock.c:47:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:502:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: got osc_device drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: got osc_object drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: got osc_lock drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:16: sparse: undefined identifier 'container_of0' In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/osc/../include/obd.h:52, from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:51, from drivers/staging/lustre/lustre/osc/osc_io.c:44: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_io.c:44: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:55:0, from drivers/staging/lustre/lustre/osc/osc_io.c:44: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ In file included from drivers/staging/lustre/lustre/osc/osc_io.c:44:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:26: error: expected expression before 'struct' return container_of0(d, struct osc_device, od_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:28: error: expected expression before 'struct' return container_of0(obj, struct osc_object, oo_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:30: error: expected expression before 'struct' return container_of0(slice, struct osc_page, ops_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:28: error: expected expression before 'struct' return container_of0(oap, struct osc_page, ops_oap); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:30: error: expected expression before 'struct' return container_of0(slice, struct osc_lock, ols_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:518:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:551:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:502:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_io.c:44: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/osc/osc_io.c:44:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:572:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/obd_class.h:41, from drivers/staging/lustre/lustre/osc/osc_quota.c:31: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_internal.h:104:0, from drivers/staging/lustre/lustre/osc/osc_quota.c:32: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/osc_quota.c:32:0: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: got osc_device drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: got osc_object drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: got osc_lock drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:35: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:29: sparse: not a function In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/osc/../include/obd.h:52, from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:51, from drivers/staging/lustre/lustre/osc/osc_cache.c:44: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_cache.c:44: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:55:0, from drivers/staging/lustre/lustre/osc/osc_cache.c:44: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cache.c:44:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:26: error: expected expression before 'struct' return container_of0(d, struct osc_device, od_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:28: error: expected expression before 'struct' return container_of0(obj, struct osc_object, oo_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:30: error: expected expression before 'struct' return container_of0(slice, struct osc_page, ops_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:28: error: expected expression before 'struct' return container_of0(oap, struct osc_page, ops_oap); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:30: error: expected expression before 'struct' return container_of0(slice, struct osc_lock, ols_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:556:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:502:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:518:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device drivers/staging/lustre/lustre/osc/osc_internal.h:177:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: undefined identifier 'struct' >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:29: sparse: not a function >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:29: sparse: not a function In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/obd_class.h:41, from drivers/staging/lustre/lustre/osc/lproc_osc.c:40: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_internal.h:104:0, from drivers/staging/lustre/lustre/osc/lproc_osc.c:43: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/lproc_osc.c:43:0: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/osc_internal.h:178:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: got osc_device drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: got osc_object drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: got osc_lock drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:16: sparse: undefined identifier 'container_of0' In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/osc/../include/lustre_dlm.h:51, from drivers/staging/lustre/lustre/osc/osc_request.c:41: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_internal.h:104:0, from drivers/staging/lustre/lustre/osc/osc_request.c:53: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/osc_request.c:53:0: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ In file included from drivers/staging/lustre/lustre/osc/osc_request.c:54:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:26: error: expected expression before 'struct' return container_of0(d, struct osc_device, od_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:28: error: expected expression before 'struct' return container_of0(obj, struct osc_object, oo_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:30: error: expected expression before 'struct' return container_of0(slice, struct osc_page, ops_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:28: error: expected expression before 'struct' return container_of0(oap, struct osc_page, ops_oap); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:30: error: expected expression before 'struct' return container_of0(slice, struct osc_lock, ols_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:556:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: got osc_device drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: got osc_object drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: got osc_lock drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:16: sparse: undefined identifier 'container_of0' In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/obd_class.h:41, from drivers/staging/lustre/lustre/osc/osc_dev.c:44: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_dev.c:46: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:55:0, from drivers/staging/lustre/lustre/osc/osc_dev.c:46: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ In file included from drivers/staging/lustre/lustre/osc/osc_dev.c:46:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:26: error: expected expression before 'struct' return container_of0(d, struct osc_device, od_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:28: error: expected expression before 'struct' return container_of0(obj, struct osc_object, oo_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:30: error: expected expression before 'struct' return container_of0(slice, struct osc_page, ops_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:28: error: expected expression before 'struct' return container_of0(oap, struct osc_page, ops_oap); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:30: error: expected expression before 'struct' return container_of0(slice, struct osc_lock, ols_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:502:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_dev.c:46: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2658:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:40: sparse: got cl_object_header >> drivers/staging/lustre/lustre/osc/osc_internal.h:177:45: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_internal.h:177:52: sparse: got osc_device >> drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:33: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:40: sparse: got osc_device drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:42: sparse: got osc_object drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:44: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:35: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:42: sparse: got osc_page drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:37: sparse: typename in expression drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: Expected ) in function call drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:44: sparse: got osc_lock drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:16: sparse: undefined identifier 'container_of0' >> drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:29: sparse: not a function drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:33: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:16: sparse: undefined identifier 'container_of0' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:35: sparse: undefined identifier 'struct' drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:29: sparse: not a function drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:16: sparse: undefined identifier 'container_of0' In file included from drivers/staging/lustre/lustre/osc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/osc/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/osc/../include/obd.h:52, from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:51, from drivers/staging/lustre/lustre/osc/osc_object.c:43: drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/osc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/osc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_object.c:43: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:55:0, from drivers/staging/lustre/lustre/osc/osc_object.c:43: drivers/staging/lustre/lustre/osc/osc_internal.h: In function 'obd2osc_dev': drivers/staging/lustre/lustre/osc/osc_internal.h:177:38: error: expected expression before 'struct' return container_of0(d->obd_lu_dev, struct osc_device, od_cl.cd_lu_dev); ^ In file included from drivers/staging/lustre/lustre/osc/osc_object.c:43:0: drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:501:26: error: expected expression before 'struct' return container_of0(d, struct osc_device, od_cl.cd_lu_dev); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:517:28: error: expected expression before 'struct' return container_of0(obj, struct osc_object, oo_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_page': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:550:30: error: expected expression before 'struct' return container_of0(slice, struct osc_page, ops_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'oap2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:555:28: error: expected expression before 'struct' return container_of0(oap, struct osc_page, ops_oap); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc_lock': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:571:30: error: expected expression before 'struct' return container_of0(slice, struct osc_lock, ols_cl); ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'cl2osc': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:518:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/osc_cl_internal.h: In function 'lu2osc_dev': drivers/staging/lustre/lustre/osc/osc_cl_internal.h:502:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/osc/osc_cl_internal.h:53:0, from drivers/staging/lustre/lustre/osc/osc_object.c:43: drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2675:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2669:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/osc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/osc/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lustre_dlm.h:51, from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_resource.c:43: drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2690:40: sparse: got cl_object_header In file included from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lustre_dlm.h:51, from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:101: drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:102:0: drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:745:57: sparse: got lu_object In file included from drivers/staging/lustre/lustre/ptlrpc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/ptlrpc/../include/obd_class.h:41, from drivers/staging/lustre/lustre/ptlrpc/client.c:42: drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- >> drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:50: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:57: sparse: got lu_object drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:745:50: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:745:57: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:745:57: sparse: got lu_object >> drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2657:33: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2657:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2657:40: sparse: got cl_device drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2668:33: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2668:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2668:40: sparse: got cl_object drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2674:36: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2674:43: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2674:43: sparse: got cl_object_conf drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2685:47: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2685:54: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2685:54: sparse: got cl_device drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2690:33: sparse: typename in expression drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2690:40: sparse: Expected ) in function call drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2690:40: sparse: got cl_object_header In file included from drivers/staging/lustre/lustre/ptlrpc/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c:60: drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/ptlrpc/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c:65:0: drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/ptlrpc/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors vim +737 drivers/staging/lustre/lustre/fid/../include/lu_object.h d7e09d039 Peng Tao 2013-05-02 721 struct lu_device *dev, d7e09d039 Peng Tao 2013-05-02 722 const struct lu_fid *f, d7e09d039 Peng Tao 2013-05-02 723 const struct lu_object_conf *conf); d7e09d039 Peng Tao 2013-05-02 724 /** @} caching */ d7e09d039 Peng Tao 2013-05-02 725 d7e09d039 Peng Tao 2013-05-02 726 /** \name helpers d7e09d039 Peng Tao 2013-05-02 727 * Helpers. d7e09d039 Peng Tao 2013-05-02 728 * @{ d7e09d039 Peng Tao 2013-05-02 729 */ d7e09d039 Peng Tao 2013-05-02 730 d7e09d039 Peng Tao 2013-05-02 731 /** d7e09d039 Peng Tao 2013-05-02 732 * First (topmost) sub-object of given compound object d7e09d039 Peng Tao 2013-05-02 733 */ d7e09d039 Peng Tao 2013-05-02 734 static inline struct lu_object *lu_object_top(struct lu_object_header *h) d7e09d039 Peng Tao 2013-05-02 735 { d7e09d039 Peng Tao 2013-05-02 736 LASSERT(!list_empty(&h->loh_layers)); d7e09d039 Peng Tao 2013-05-02 @737 return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); d7e09d039 Peng Tao 2013-05-02 738 } d7e09d039 Peng Tao 2013-05-02 739 d7e09d039 Peng Tao 2013-05-02 740 /** d7e09d039 Peng Tao 2013-05-02 741 * Next sub-object in the layering d7e09d039 Peng Tao 2013-05-02 742 */ d7e09d039 Peng Tao 2013-05-02 743 static inline struct lu_object *lu_object_next(const struct lu_object *o) d7e09d039 Peng Tao 2013-05-02 744 { d7e09d039 Peng Tao 2013-05-02 745 return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); :::::: The code at line 737 was first introduced by commit :::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system client support :::::: TO: Peng Tao :::::: CC: Greg Kroah-Hartman --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation From mahfouz.saif.elyazal at gmail.com Tue Oct 13 22:19:25 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Wed, 14 Oct 2015 00:19:25 +0200 Subject: [lustre-devel] [PATCH 0/7] staging: lustre: remove uses and definition of container_of0 Message-ID: container_of0 can be replaced by the Linux kernel macro container_of. The only difference is that container_of0 tries to evade type casting when the pointer is erroneous or null. All uses of container_of0 have been replaced by container_of and then the macro was removed in the last patch. Aya Mahfouz (7): staging: lustre: lcommon_cl.c: replace container_of0 by container_of staging: lustre: llite_nfs.c: replace container_of0 by container_of staging: lustre: lu_object.c: replace container_of0 by container_of staging: lustre: echo_client.c: replace container_of0 by container_of staging: lustre: osc_io.c: replace container_of0 by container_of staging: lustre: osc_object.c: replace container_of0 by container_of staging: lustre: remove container_of0 and __container_of drivers/staging/lustre/include/linux/libcfs/libcfs.h | 11 ----------- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 10 +++++----- drivers/staging/lustre/lustre/llite/llite_nfs.c | 2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +++--- drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 +- drivers/staging/lustre/lustre/osc/osc_io.c | 4 ++-- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- 7 files changed, 13 insertions(+), 24 deletions(-) -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 13 22:23:14 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Wed, 14 Oct 2015 00:23:14 +0200 Subject: [lustre-devel] [PATCH 2/7] staging: lustre: llite_nfs.c: replace container_of0 by container_of In-Reply-To: References: Message-ID: Replaces container_of0 by container_of. The only difference between the two implementations is that container_of0 tries to evade type casting if the pointer is erroneous or null. The use of container_of is encouraged to bring lustre one step closer to community standards. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/llite/llite_nfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index e578a11..340fb61 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c @@ -210,7 +210,7 @@ static int ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, { /* It is hack to access lde_fid for comparison with lgd_fid. * So the input 'name' must be part of the 'lu_dirent'. */ - struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name); + struct lu_dirent *lde = container_of(name, struct lu_dirent, lde_name); struct ll_getname_data *lgd = container_of(ctx, struct ll_getname_data, ctx); struct lu_fid fid; -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From dan.carpenter at oracle.com Thu Oct 15 10:59:43 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 15 Oct 2015 13:59:43 +0300 Subject: [lustre-devel] staging: add Lustre file system client support Message-ID: <20151015105943.GA22833@mwanda> Hello Lustre Devs, The patch d7e09d0397e8: "staging: add Lustre file system client support" from May 2, 2013, leads to the following static checker warning: drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c:150 libcfs_kkuc_group_rem() error: buffer overflow 'kkuc_groups' 3 <= s32max drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c 146 int libcfs_kkuc_group_rem(int uid, int group) 147 { 148 struct kkuc_reg *reg, *next; 149 150 if (kkuc_groups[group].next == NULL) group doesn't appear to have been validated at all. It comes from the user. The call tree is: -> lmv_iocontrol() -> lmv_hsm_ct_unregister() -> libcfs_kkuc_group_rem() It looks like this code could oops. 151 return 0; 152 153 if (uid == 0) { 154 /* Broadcast a shutdown message */ 155 struct kuc_hdr lh; 156 157 lh.kuc_magic = KUC_MAGIC; 158 lh.kuc_transport = KUC_TRANSPORT_GENERIC; 159 lh.kuc_msgtype = KUC_MSG_SHUTDOWN; 160 lh.kuc_msglen = sizeof(lh); 161 libcfs_kkuc_group_put(group, &lh); 162 } 163 164 down_write(&kg_sem); 165 list_for_each_entry_safe(reg, next, &kkuc_groups[group], kr_chain) { 166 if ((uid == 0) || (uid == reg->kr_uid)) { 167 list_del(®->kr_chain); 168 CDEBUG(D_KUC, "Removed uid=%d fp=%p from group %d\n", 169 reg->kr_uid, reg->kr_fp, group); 170 if (reg->kr_fp != NULL) 171 fput(reg->kr_fp); 172 kfree(reg); 173 } 174 } 175 up_write(&kg_sem); 176 177 return 0; 178 } regards, dan carpenter From dan.carpenter at oracle.com Thu Oct 15 11:14:19 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 15 Oct 2015 14:14:19 +0300 Subject: [lustre-devel] staging: add Lustre file system client support Message-ID: <20151015111419.GA24704@mwanda> Hello Lustre Devs, The patch d7e09d0397e8: "staging: add Lustre file system client support" from May 2, 2013, leads to the following static checker warning: drivers/staging/lustre/lnet/selftest/console.c:1330 lstcon_test_add() error: 'paramlen' from user is not capped properly drivers/staging/lustre/lnet/selftest/console.c 1273 int 1274 lstcon_test_add(char *batch_name, int type, int loop, 1275 int concur, int dist, int span, 1276 char *src_name, char *dst_name, 1277 void *param, int paramlen, int *retp, 1278 struct list_head *result_up) 1279 { 1280 lstcon_test_t *test = NULL; 1281 int rc; 1282 lstcon_group_t *src_grp = NULL; 1283 lstcon_group_t *dst_grp = NULL; 1284 lstcon_batch_t *batch = NULL; 1285 1286 /* 1287 * verify that a batch of the given name exists, and the groups 1288 * that will be part of the batch exist and have at least one 1289 * active node 1290 */ 1291 rc = lstcon_verify_batch(batch_name, &batch); 1292 if (rc != 0) 1293 goto out; 1294 1295 rc = lstcon_verify_group(src_name, &src_grp); 1296 if (rc != 0) 1297 goto out; 1298 1299 rc = lstcon_verify_group(dst_name, &dst_grp); 1300 if (rc != 0) 1301 goto out; 1302 1303 if (dst_grp->grp_userland) 1304 *retp = 1; 1305 1306 LIBCFS_ALLOC(test, offsetof(lstcon_test_t, tes_param[paramlen])); There is an underflow and integer overflow bug here. 1307 if (!test) { 1308 CERROR("Can't allocate test descriptor\n"); 1309 rc = -ENOMEM; 1310 1311 goto out; 1312 } 1313 1314 test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id; 1315 test->tes_batch = batch; 1316 test->tes_type = type; 1317 test->tes_oneside = 0; /* TODO */ 1318 test->tes_loop = loop; 1319 test->tes_concur = concur; 1320 test->tes_stop_onerr = 1; /* TODO */ 1321 test->tes_span = span; 1322 test->tes_dist = dist; 1323 test->tes_cliidx = 0; /* just used for creating RPC */ 1324 test->tes_src_grp = src_grp; 1325 test->tes_dst_grp = dst_grp; 1326 INIT_LIST_HEAD(&test->tes_trans_list); 1327 1328 if (param != NULL) { 1329 test->tes_paramlen = paramlen; 1330 memcpy(&test->tes_param[0], param, paramlen); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the warning. 1331 } The warning here is a false positive because the caller validates "paramlen" when "param" is non-NULL. Unfortunately, on line 1306, we use "paramlen" even when param is NULL. "paramlen" is signed so this can mean "test" is smaller than expected leading to memory corruption. regards, dan carpenter From dan.carpenter at oracle.com Thu Oct 15 11:38:45 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 15 Oct 2015 14:38:45 +0300 Subject: [lustre-devel] staging: add Lustre file system client support In-Reply-To: <20151015111419.GA24704@mwanda> References: <20151015111419.GA24704@mwanda> Message-ID: <20151015113845.GQ7289@mwanda> Actually this we can't overflow here, it will return -EFAULT if param is NULL and paramlen is non-zero. I'll send a patch to clean this up. regards, dan carpenter From dan.carpenter at oracle.com Thu Oct 15 11:43:50 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 15 Oct 2015 14:43:50 +0300 Subject: [lustre-devel] staging: add Lustre file system client support In-Reply-To: <20151015113845.GQ7289@mwanda> References: <20151015111419.GA24704@mwanda> <20151015113845.GQ7289@mwanda> Message-ID: <20151015114350.GR7289@mwanda> On Thu, Oct 15, 2015 at 02:38:45PM +0300, Dan Carpenter wrote: > Actually this we can't overflow here, it will return -EFAULT if param is > NULL and paramlen is non-zero. I'll send a patch to clean this up. Ugh... No, I won't send a patch for this. That LIBCFS_ALLOC() macro is inscrutible and I am not emotionally prepared to look at it. regards, dan carpenter From oleg.drokin at intel.com Thu Oct 15 18:55:57 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Thu, 15 Oct 2015 18:55:57 +0000 Subject: [lustre-devel] lustre: TODO updated? In-Reply-To: <561CF52C.2070806@gmail.com> References: <561CF52C.2070806@gmail.com> Message-ID: Hello! On Oct 13, 2015, at 8:12 AM, Xose Vazquez Perez wrote: > Is drivers/staging/lustre/TODO file updated? Yes, it's still accurate from 10.000 ft view. If you need some more detailed ideas, here's my current list of stuff: getting rid of remaining lustre allocation macros: OBD_SLAB_ALLOC/FREE and friends much like we got rid of OBD_ALLOC/FREE before. I think LIBCFS_ALLOC/FREE and friends would need the same treatment. I bet there are other wrapping functions (from libcfs compat code and such) that need to be removed. typedefs: we did remove some, there are more left that need to be taken care of. Coding style - we are much better now here and the work is ongoing by a lot of other people. Function defines - need to be looked into. In addition, more involved ones: After that there are more laborous ones like figuring out how to fit into the perf framework as one example. Also we need to rip remaining parts of server code that is still present greatly there (one example - oti handle users are either server only or client only with dummy handle - in echo code only. These could be greatly pruned. Then we can cleanup all the obd method tables to remove now unused pointers and so on). Bye, Oleg From shraddha.6596 at gmail.com Thu Oct 15 19:30:10 2015 From: shraddha.6596 at gmail.com (Shraddha Barke) Date: Fri, 16 Oct 2015 01:00:10 +0530 Subject: [lustre-devel] [PATCH] Staging: lustre: obd_support.h: Remove unused OBD_SLAB_FREE_RTN0 Message-ID: <1444937410-4796-1-git-send-email-shraddha.6596@gmail.com> Remove macro OBD_SLAB_FREE_RTN0 since it is defined but not used Signed-off-by: Shraddha Barke --- drivers/staging/lustre/lustre/include/obd_support.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index ec14b72c..abc53f1 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -517,12 +517,6 @@ do { \ /* we memset() the slab object to 0 when allocation succeeds, so DO NOT * HAVE A CTOR THAT DOES ANYTHING. its work will be cleared here. we'd * love to assert on that, but slab.c keeps kmem_cache_s all to itself. */ -#define OBD_SLAB_FREE_RTN0(ptr, slab) \ -({ \ - kmem_cache_free((slab), (ptr)); \ - (ptr) = NULL; \ - 0; \ -}) #define __OBD_SLAB_ALLOC_VERBOSE(ptr, slab, cptab, cpt, size, type) \ do { \ -- 2.1.4 From olaf at sgi.com Fri Oct 16 10:14:43 2015 From: olaf at sgi.com (Olaf Weber) Date: Fri, 16 Oct 2015 12:14:43 +0200 Subject: [lustre-devel] Multi-rail networking for Lustre Message-ID: <5620CE13.8020706@sgi.com> As some of you know, I held a presentation at the LAD'15 developers meeting describing a proposal for implementing multi-rail networking for Lustre. Some discussion on this list has referenced that talk. The slides I used can be found here (1MB PDF): http://wiki.lustre.org/images/7/79/LAD15_Lustre_Interface_Bonding_Final.pdf Since I grew up when a slide deck was a pile of transparencies, and the rule was that you'd used too much text if people could get more than the bare gist of your talk from the slides, the rest of this mail is a slide-by-slide paraphrase of the talk. (There is no recording: unless the other attendees weigh in this is the best you'll get.) A few points are starred to indicate that they are after-the-talk additions. Slide 1: Lustre Interface Bonding Title - boring. Slide 2: Interface Bonding Under various names multi-rail has been a longstanding wishlist item. The various names do imply technical differences in how people think about the problem and the solutions they propose. Despite the title of the presentation, this proposal is best characterized by "multi-rail", which is the term we've been using internally at SGI. Fujitsu contributed an implementation at the level of the infiniband LND. It wasn't landed, and some of the reviewers felt that an LNet- level solution should be investigated instead. This code was a big influence on how I ended up approaching the problem. The current proposal is a collaboration between SGI and Intel. There is in fact a contract and resources have been committed. Whether the implementation will match this proposal is still an open question: these are the early days, and your feedback is welcome and can be taken into account. The end goal is general availability. Slide 3: Why Multi-Rail? At SGI we care because our big systems can have tens of terabytes of memory, and therefore need a fat connection to the rest of a Lustre cluster. An additional complication is that big systems have an internal "network" (NUMAlink in SGI's case) and it can matter a lot for performance whether memory is close or remote to an interface. So what we want is to have multiple interfaces spread throughout a system, and then be able to use whichever will be most efficient for a particular I/O operation. Slide 4: Design Constraints These are a couple of constraints (or requirements if you prefer) that the design tries to satisfy. Mixed-version clusters: it should not be a requirement to update an entire cluster because of a few multi-rail capable nodes. Moreover, in mixed- vendor situations, it may not be possible to upgrade an entire cluster in one fell swoop. Simple configuration: creating and distributing configuration files, and then keeping them in sync across a cluster, becomes tricky once clusters get bigger. So I look for ways to have the systems configure themselves. Adaptable: autoconfiguration is nice, but there are always cases where it doesn't get things quite right. There have to be ways to fine-tune a system or cluster, or even to completely override the autoconfiguration. LNet-level implementation: there are three levels at which you can reasonably implement multi-rail: LND, LNet, and PortalRPC. An LND-level solution has as its main disadvantage that you cannot balance I/O load between LNDs. A PortalRPC-level solution would certainly follow a commonly design tenet in networking: "the upper layers will take care of that". The upper layers just want a reliable network, thankyouverymuch. LNet seems like the right spot for something like this. It allows the implementation to be reasonably self-contained within the LNet subsystem. Slide 5: Example Lustre Cluster A simple cluster, used to guide the discussion. Missing in the picture is the connecting fabric. Note that the UV client is much bigger than the other nodes. Slide 6: Mono-rail Single Fabric The kind of fabric we have today. The UV is starved for I/O. Slide 7: LNets in a Single Fabric You can make additional interfaces in the UV useful by defining multiple LNets in the fabric, and then carefully setting up aliases on the nodes with only a single interface. This can be done today, but setting this up correctly is a bit tricky, and involves cluster-wide configuration. It is not something you'd like to have to retrofit top an existing cluster. Slide 8: Multi-rail Single Fabric An example of a fabric topology that we want to work well. Some nodes have multiple interfaces, and when they do they can all be used to talk to the other nodes. Slide 9: Multi-rail Dual Fabric Similar to previous slide, but now with more LNets. Here too the goal is active-active use of the LNets and all interfaces. Slide 10: Mixed-Version Clusters This section of the presentation expands on the first item of Slide 4. Slide 11: A Single Multi-Rail Node Assume we install multi-rail capable Lustre only on the UV. Would that work? It turns out that it should actually work, though there are some limits to the functionality. In particular, the MGS/MDS/OSS nodes will not be aware that they know the UV by a number of NIDs, and it may be best to avoid this by ensuring that the UV always uses the same interface to talk to a particular node. This gives us the same functionality as the multiple LNet example of Slide 7, but with a much less complicated configuration. Slide 12: Peer Version Discovery A multi-rail capable node would like to know if any peer node is also multi-rail capable. The LNet protocol itself isn't properly versioned, but the LNet ping protocol (not to be confused with the ptlrpc pinger!) does transport a feature flags field. There are enough bits available in that field that we can just steal one and use it to indicate multi-rail capability in a ping reply. Note that a ping request does not carry any information beyond the source NID of the requesting node. In particular, it cannot carry version information to the node being pinged. Slide 13: Peer Version Discovery A simple version discovery protocol can be built on LNet ping. 1) LNet keeps track of all known peers 2) On first communication, do an LNet ping 3) The node now knows the peer version And we get a list of the peer's interfaces for free. Slide 14: Easy Configuration This section of the presentation expands on the second item of Slide 4. Slide 15: Peer Interface Discovery The list of interfaces of a peer is all we need to know for the simple cases. With that we know the peer under all its aliases, and can determine whether any of the other local interfaces (for example those on different LNets) can talk to the same peer. Now the peer also needs to know the node's interfaces. It would be nice if there was a reliable way to get the peer to issue an LNet ping to the node. For the most basic situation this works, but once I looked at more complex situations it became clear that this cannot be done reliably. So instead I propose to just have the node push a list of its interfaces to the peer. Slide 16: Peer Interface Discovery The push of the list is much like an LNet ping, except it does an LNetPut() instead of an LNetGet(). This should be safe on several grounds. An LNet router doesn't do deep inspection of Put/Get requests, so even a downrev router will be able to forward them. If such a Put somehow ends up at a downrev peer, the peer will silently drop the message. (The slide says a protocol error will be returned, which is wrong.) Slide 17: Configuring Interfaces on a Node How does a node know its own interfaces? This can be done in a way similar to the current methods: kernel module parameters and/or DLC. These use the same in-kernel parser, so the syntax is similar in either case. networks=o2ib(ib0,ib1) This is an example where two interfaces are used in the same LNet. networks=o2ib(ib0[2],ib1[6])[2,6] The same example annotated with CPT information. This refers back to Slide 3: on a big NUMA system it matters to be able to place the helper threads for an interface close to that interface. * Of course that information is also available in the kernel, and with a few extensions to the CPT mechanism, the kernel could itself find the node to which an interface is connected, then find the/a CPT that contains CPUs on that node. Slide 18: Configuring Interfaces on a Node LNet uses credits to determine whether a node can send something across an interface or to a peer. These credits are assigned per-interface, for both local and peer credits. So more interfaces means more credits overall. The defaults for credit-related tunables can stay the same. On LNet routers, which do have multiple interfaces, these tunables are already interpreted per interface. Slide 19: Dynamic Configuration There is some scope for supporting hot-plugging interfaces. When adding an interface, enable then push. When removing an interface, push then disable. Note that removing the interface with the NID by which a node is known to the MGS (MDS/...) might not be a good idea. If additional interfaces are present then existing connections can remain active, but establishing new ones becomes a problem. * This is a weakness of this proposal. Slide 20: Adaptable This section of the presentation expands on the third item of Slide 4. Slide 21: Interface Selection Selecting a local interface to send from, and a peer interface to send to can use a number of rules. - Direct connection preferred: by default, don't go through an LNet router unless there is no other path. Note that today an LNet router will refuse to forward traffic if it believes there is a direct connection between the node and the peer. - LNet network type: since using TCP only is the default, it also makes sense to have a default rule that if a non-TCP network has been configured, then that network should be used first. (As with all such rules, it must be possible to override this default.) - NUMA criteria: pick a local interface that (i) can reach the peer, (ii) is close to the memory used for the I/O, and (iii) close to the CPU driving the I/O. - Local credits: pick a local interface depending on the availability of credits. Credits are a useful indicator for how busy an interface is. Systematically choosing the interface with the most available credits should get you something resembling a round-robin strategy. And this can even be used to balance across heterogeneous interfaces/fabrics. - Peer credits: pick a peer interface depending on the availability of peer credits. Then pick a local interface that connects to this peer interface. - Other criteria, namely... Slice 22: Routing Enhancements The fabric connecting nodes in a cluster can have a complicated topology. So can have cases where a node has two interfaces N1,N2, and a peer has two interfaces P1,P2, all on the same LNet, yet N1-P1 and N2-P2 are preferred paths, while N1-P2 and N2-P1 should be avoided. So there should be ways to define preferred point-to-point connections within an LNet. This solves the N1-P1 problem mentioned above. There also need to be ways to define a preference for using one LNet over another, possibly for a subset of NIDs. This is the mechanism by which the "anything but TCP" default can be overruled. The existing syntax for LNet routing can easily(?) be extended to cover these cases. Slide 23: Extra Considerations As you may have noticed, I'm looking for ways to be NUMA friendly. But one thing I want to avoid is having Lustre nodes know too much about the topology of their peers. How much is too much? I draw the line at them knowing anything at all. At the PortalRPC level each RPC is a request/response pair. (This in contrast to the LNet level put/ack and get/reply pairs that make up the request and the response.) The PortalRPC layer is told the originating interface of a request. It then sends the response to that same interface. The node sending the request is usually a client -- especially when a large data transfer is involved -- and this is a simple way to ensure that whatever NUMA-aware policies it used to select the originating interface are also honored when the response arrives. Slide 24: Extra Considerations If for some reason the peer cannot send a message to the originating interface, then any other interface will do. This is an event worth logging, as it indicates a malfunction somewhere, and after that just keeping the cluster going should be the prime concern. Trying all local-remote interface pairs might not be a good idea: there can be too many combinations and the cumulative timeouts become a problem. To avoid timeouts at the PortalRPC level, LNet may already need to start resending a message long before the "offical" below-LND-level timeout for message arrival has expired. The added network resiliency is limited. As noted for Slide 19, if the interface that fails is has the NID by which a node is primarily known, establishing new connections to that node becomes impossible. Slide 25: Extra Considerations Failing nodes can be used to construct some very creative scenarios. For example if a peer reboots with downrev software LNet on a node will not be able to tell by itself. But in this case the PortalRPC layer can signal to LNet that it needs to re-check the peer. NID reuse by different nodes is also a scenario that introduces a lot complications. (Arguably it does do this already today.) If needed, it might be possible to sneak a 32 bit identifying cookie into the NID each node reports on the loopback network. Whether this would actually be useful (and for that matter how such cookies would be assigned) is not clear. Slide 26: LNet-level Implementation This section of the presentation expands on the fourth item of Slide 4. Slide 27-29: Implementation Notes A staccato of notes on how to implement bits and pieces of the above. There's too much text in the slides already, so I'm not paraphrasing. Slide 30: Implementation Notes This slide gives a plausible way to cut the work into smaller pieces that can be implemented as self-contained bits. 1) Split lnet_ni 2) Local interface selection *) Routing enhancements for local interface selection 3) Split lnet_peer 4) Ping on connect 5) Implement push 6) Peer interface selection 7) Resending on failure 8) Routing enhancements There's of course no guarantee that this division will survive the actual coding. But if it does, then note that after step 2 is implemented, the configuration of Slide 11 (single multi-rail node) should already be working. Slide 31: Feedback & Discussion Looking forward to further feedback & discussion here. Slide 32: End title - also boring. Olaf -- Olaf Weber SGI Phone: +31(0)30-6696796 Veldzigt 2b Fax: +31(0)30-6696799 Sr Software Engineer 3454 PW de Meern Vnet: 955-6796 Storage Software The Netherlands Email: olaf at sgi.com From mahfouz.saif.elyazal at gmail.com Fri Oct 16 22:03:39 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 00:03:39 +0200 Subject: [lustre-devel] [PATCH 0/4] Remove uses and definition of IS_PO2 Message-ID: Concerned with the removal of IS_PO2 by replacing its uses with is_power_of_2 and then removing the definition Aya Mahfouz (4): staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 staging: lustre: hash.c: replace IS_PO2 by is_power_of_2 staging: lustre: workitem.c: replace IS_PO2 with is_power_of_2 staging: lustre: remove IS_PO2 and __is_po2 drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++- drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 4 files changed, 10 insertions(+), 10 deletions(-) -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Fri Oct 16 22:05:44 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 00:05:44 +0200 Subject: [lustre-devel] [PATCH 1/4] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug macros. In this case, it is LASSERT. Note that the replacement changes the types involved, because the parameter of IS_PO2 is of type long long and the return type is int, while the parameter of is_power_of_2 is of type long and the return type is bool. This, however, has no impact, because the actual argument is always of type int, and the return value is always used as a boolean. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index 57b997d..3e7e97e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -50,6 +50,9 @@ */ #define DEBUG_SUBSYSTEM S_LDLM + +#include + #include "../../include/linux/libcfs/libcfs.h" #include "../include/lustre_dlm.h" #include "../include/obd_support.h" @@ -149,7 +152,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode) int index; LASSERT(mode != 0); - LASSERT(IS_PO2(mode)); + LASSERT(is_power_of_2(mode)); for (index = -1; mode; index++) mode >>= 1; LASSERT(index < LCK_MODE_NUM); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Fri Oct 16 22:06:28 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 00:06:28 +0200 Subject: [lustre-devel] [PATCH 2/4] staging: lustre: hash.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <798c319bad7c0c621b608f499860eaaa1c78d03d.1445032901.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug macros. In this case, it is CDEBUG. Note that the replacement changes the types involved, because the parameter of IS_PO2 is of type long long and the return type is int, while the parameter of is_power_of_2 is of type long and the return type is bool. This, however, has no impact, because the actual argument is always of type int, and the return value is always used as a boolean. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 6f4c7d4..4b5e79a 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -109,6 +109,8 @@ #include "../../include/linux/libcfs/libcfs.h" #include +#include + #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 static unsigned int warn_on_depth = 8; @@ -1785,7 +1787,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) for (i = 2; cfs_hash_is_rehashing(hs); i++) { cfs_hash_unlock(hs, 1); /* raise console warning while waiting too long */ - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, "hash %s is still rehashing, rescheded %d\n", hs->hs_name, i - 1); cond_resched(); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Fri Oct 16 22:06:59 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 00:06:59 +0200 Subject: [lustre-devel] [PATCH 3/4] staging: lustre: workitem.c: replace IS_PO2 with is_power_of_2 In-Reply-To: References: Message-ID: <2519058141bb445670678a4f7dfbca2eabde4477.1445032901.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug macros. In this case, it is CDEBUG. Note that the replacement changes the types involved, because the parameter of IS_PO2 is of type long long and the return type is int, while the parameter of is_power_of_2 is of type long and the return type is bool. This, however, has no impact, because the actual argument is always of type int, and the return value is always used as a boolean. Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index e1143a5..377e1ea 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -41,6 +41,8 @@ #define DEBUG_SUBSYSTEM S_LNET +#include + #include "../../include/linux/libcfs/libcfs.h" #define CFS_WS_NAME_LEN 16 @@ -325,7 +327,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) spin_lock(&cfs_wi_data.wi_glock); while (sched->ws_nthreads > 0) { - CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, + CDEBUG(is_power_of_2(++i) ? D_WARNING : D_NET, "waiting for %d threads of WI sched[%s] to terminate\n", sched->ws_nthreads, sched->ws_name); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Fri Oct 16 22:07:28 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 00:07:28 +0200 Subject: [lustre-devel] [PATCH 4/4] staging: lustre: remove IS_PO2 and __is_po2 In-Reply-To: References: Message-ID: <97ba103dc2a11e23fd4a384eb041c273b67a9aee.1445032901.git.mahfouz.saif.elyazal@gmail.com> Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have been replaced by is_power_of_2 Signed-off-by: Aya Mahfouz --- drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 385ced1..c78a147 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -42,13 +42,6 @@ #include "curproc.h" -static inline int __is_po2(unsigned long long val) -{ - return !(val & (val - 1)); -} - -#define IS_PO2(val) __is_po2((unsigned long long)(val)) - #define LOWEST_BIT_SET(x) ((x) & ~((x) - 1)) /* -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From lkp at intel.com Sat Oct 17 00:49:02 2015 From: lkp at intel.com (kbuild test robot) Date: Sat, 17 Oct 2015 08:49:02 +0800 Subject: [lustre-devel] [PATCH 4/4] staging: lustre: remove IS_PO2 and __is_po2 In-Reply-To: <97ba103dc2a11e23fd4a384eb041c273b67a9aee.1445032901.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <201510170820.kKUzlWjA%fengguang.wu@intel.com> Hi Aya, [auto build test ERROR on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Aya-Mahfouz/Remove-uses-and-definition-of-IS_PO2/20151017-060923 config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): In file included from drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs.h:40:0, from drivers/staging/lustre/lnet/selftest/conrpc.c:43: drivers/staging/lustre/lnet/selftest/conrpc.c: In function 'lstcon_rpc_cleanup_wait': >> drivers/staging/lustre/lnet/selftest/selftest.h:588:10: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/linux/libcfs.h:109:25: note: in definition of macro '__CHECK_STACK' (msgdata)->msg_mask = mask; \ ^ >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:214:2: note: in expansion of macro 'CFS_CHECK_STACK' CFS_CHECK_STACK(&msgdata, mask, cdls); \ ^ >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:222:35: note: in expansion of macro '__CDEBUG' #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__) ^ >> drivers/staging/lustre/lnet/selftest/selftest.h:588:3: note: in expansion of macro 'CDEBUG' CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ >> drivers/staging/lustre/lnet/selftest/conrpc.c:1359:2: note: in expansion of macro 'lst_wait_until' lst_wait_until((atomic_read(&console_session.ses_rpc_counter) == 0), ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs.h:40:0, from drivers/staging/lustre/lnet/selftest/selftest.h:46, from drivers/staging/lustre/lnet/selftest/framework.c:44: drivers/staging/lustre/lnet/selftest/framework.c: In function 'sfw_shutdown': >> drivers/staging/lustre/lnet/selftest/selftest.h:588:10: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/linux/libcfs.h:109:25: note: in definition of macro '__CHECK_STACK' (msgdata)->msg_mask = mask; \ ^ >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:214:2: note: in expansion of macro 'CFS_CHECK_STACK' CFS_CHECK_STACK(&msgdata, mask, cdls); \ ^ >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:222:35: note: in expansion of macro '__CDEBUG' #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__) ^ >> drivers/staging/lustre/lnet/selftest/selftest.h:588:3: note: in expansion of macro 'CDEBUG' CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ >> drivers/staging/lustre/lnet/selftest/framework.c:1741:2: note: in expansion of macro 'lst_wait_until' lst_wait_until(sfw_data.fw_active_srpc == NULL, sfw_data.fw_lock, ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs.h:40:0, from drivers/staging/lustre/lnet/selftest/selftest.h:46, from drivers/staging/lustre/lnet/selftest/timer.c:43: drivers/staging/lustre/lnet/selftest/timer.c: In function 'stt_shutdown': >> drivers/staging/lustre/lnet/selftest/selftest.h:588:10: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/linux/libcfs.h:109:25: note: in definition of macro '__CHECK_STACK' (msgdata)->msg_mask = mask; \ ^ >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:214:2: note: in expansion of macro 'CFS_CHECK_STACK' CFS_CHECK_STACK(&msgdata, mask, cdls); \ ^ >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:222:35: note: in expansion of macro '__CDEBUG' #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__) ^ >> drivers/staging/lustre/lnet/selftest/selftest.h:588:3: note: in expansion of macro 'CDEBUG' CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ >> drivers/staging/lustre/lnet/selftest/timer.c:240:2: note: in expansion of macro 'lst_wait_until' lst_wait_until(stt_data.stt_nthreads == 0, stt_data.stt_lock, ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs.h:40:0, from drivers/staging/lustre/lnet/selftest/selftest.h:46, from drivers/staging/lustre/lnet/selftest/rpc.c:47: drivers/staging/lustre/lnet/selftest/rpc.c: In function 'srpc_service_add_buffers': >> drivers/staging/lustre/lnet/selftest/selftest.h:588:10: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/linux/libcfs.h:109:25: note: in definition of macro '__CHECK_STACK' (msgdata)->msg_mask = mask; \ ^ >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:214:2: note: in expansion of macro 'CFS_CHECK_STACK' CFS_CHECK_STACK(&msgdata, mask, cdls); \ ^ >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:222:35: note: in expansion of macro '__CDEBUG' #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__) ^ >> drivers/staging/lustre/lnet/selftest/selftest.h:588:3: note: in expansion of macro 'CDEBUG' CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ >> drivers/staging/lustre/lnet/selftest/rpc.c:619:3: note: in expansion of macro 'lst_wait_until' lst_wait_until(scd->scd_buf_err != 0 || ^ cc1: some warnings being treated as errors vim +/IS_PO2 +588 drivers/staging/lustre/lnet/selftest/selftest.h d3caf4d58 Peng Tao 2014-03-18 582 } while (0) d7e09d039 Peng Tao 2013-05-02 583 d7e09d039 Peng Tao 2013-05-02 584 #define lst_wait_until(cond, lock, fmt, ...) \ d7e09d039 Peng Tao 2013-05-02 585 do { \ d7e09d039 Peng Tao 2013-05-02 586 int __I = 2; \ d7e09d039 Peng Tao 2013-05-02 587 while (!(cond)) { \ d7e09d039 Peng Tao 2013-05-02 @588 CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ d7e09d039 Peng Tao 2013-05-02 589 fmt, ## __VA_ARGS__); \ d7e09d039 Peng Tao 2013-05-02 590 spin_unlock(&(lock)); \ d7e09d039 Peng Tao 2013-05-02 591 \ :::::: The code at line 588 was first introduced by commit :::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system client support :::::: TO: Peng Tao :::::: CC: Greg Kroah-Hartman --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/octet-stream Size: 51721 bytes Desc: not available URL: From lkp at intel.com Sat Oct 17 01:55:01 2015 From: lkp at intel.com (kbuild test robot) Date: Sat, 17 Oct 2015 09:55:01 +0800 Subject: [lustre-devel] [PATCH 4/4] staging: lustre: remove IS_PO2 and __is_po2 In-Reply-To: <97ba103dc2a11e23fd4a384eb041c273b67a9aee.1445032901.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <201510170920.6EL2elzP%fengguang.wu@intel.com> Hi Aya, [auto build test ERROR on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Aya-Mahfouz/Remove-uses-and-definition-of-IS_PO2/20151017-060923 config: i386-allyesconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/staging/lustre/lnet/selftest/conrpc.c: In function 'lstcon_rpc_cleanup_wait': >> drivers/staging/lustre/lnet/selftest/conrpc.c:1359:386: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors -- drivers/staging/lustre/lnet/selftest/framework.c: In function 'sfw_shutdown': >> drivers/staging/lustre/lnet/selftest/framework.c:1741:386: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors -- drivers/staging/lustre/lnet/selftest/timer.c: In function 'stt_shutdown': >> drivers/staging/lustre/lnet/selftest/timer.c:240:386: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors -- drivers/staging/lustre/lnet/selftest/rpc.c: In function 'srpc_service_add_buffers': >> drivers/staging/lustre/lnet/selftest/rpc.c:619:387: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors vim +/IS_PO2 +1359 drivers/staging/lustre/lnet/selftest/conrpc.c d7e09d039 Peng Tao 2013-05-02 1353 d7e09d039 Peng Tao 2013-05-02 1354 mutex_lock(&console_session.ses_mutex); d7e09d039 Peng Tao 2013-05-02 1355 } d7e09d039 Peng Tao 2013-05-02 1356 d7e09d039 Peng Tao 2013-05-02 1357 spin_lock(&console_session.ses_rpc_lock); d7e09d039 Peng Tao 2013-05-02 1358 d7e09d039 Peng Tao 2013-05-02 @1359 lst_wait_until((atomic_read(&console_session.ses_rpc_counter) == 0), d7e09d039 Peng Tao 2013-05-02 1360 console_session.ses_rpc_lock, eac2e8c6f Rashika Kheria 2013-10-17 1361 "Network is not accessible or target is down, waiting for %d console RPCs to being recycled\n", d7e09d039 Peng Tao 2013-05-02 1362 atomic_read(&console_session.ses_rpc_counter)); :::::: The code at line 1359 was first introduced by commit :::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system client support :::::: TO: Peng Tao :::::: CC: Greg Kroah-Hartman --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/octet-stream Size: 51116 bytes Desc: not available URL: From lkp at intel.com Sat Oct 17 04:53:03 2015 From: lkp at intel.com (kbuild test robot) Date: Sat, 17 Oct 2015 12:53:03 +0800 Subject: [lustre-devel] [PATCH 4/4] staging: lustre: remove IS_PO2 and __is_po2 In-Reply-To: <97ba103dc2a11e23fd4a384eb041c273b67a9aee.1445032901.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <201510171217.WfggLgqH%fengguang.wu@intel.com> Hi Aya, [auto build test ERROR on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Aya-Mahfouz/Remove-uses-and-definition-of-IS_PO2/20151017-060923 config: s390-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=s390 All errors (new ones prefixed by >>): In file included from drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs.h:111:0, from drivers/staging/lustre/lnet/selftest/conrpc.c:43: drivers/staging/lustre/lnet/selftest/conrpc.c: In function 'lstcon_rpc_cleanup_wait': >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:212:16: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] static struct libcfs_debug_msg_data msgdata; \ ^ drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:222:35: note: in expansion of macro '__CDEBUG' #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__) ^ drivers/staging/lustre/lnet/selftest/selftest.h:588:3: note: in expansion of macro 'CDEBUG' CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ drivers/staging/lustre/lnet/selftest/conrpc.c:1359:2: note: in expansion of macro 'lst_wait_until' lst_wait_until((atomic_read(&console_session.ses_rpc_counter) == 0), ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs.h:111:0, from drivers/staging/lustre/lnet/selftest/selftest.h:46, from drivers/staging/lustre/lnet/selftest/framework.c:44: drivers/staging/lustre/lnet/selftest/framework.c: In function 'sfw_shutdown': >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:212:16: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] static struct libcfs_debug_msg_data msgdata; \ ^ drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:222:35: note: in expansion of macro '__CDEBUG' #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__) ^ drivers/staging/lustre/lnet/selftest/selftest.h:588:3: note: in expansion of macro 'CDEBUG' CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ drivers/staging/lustre/lnet/selftest/framework.c:1741:2: note: in expansion of macro 'lst_wait_until' lst_wait_until(sfw_data.fw_active_srpc == NULL, sfw_data.fw_lock, ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs.h:111:0, from drivers/staging/lustre/lnet/selftest/selftest.h:46, from drivers/staging/lustre/lnet/selftest/timer.c:43: drivers/staging/lustre/lnet/selftest/timer.c: In function 'stt_shutdown': >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:212:16: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] static struct libcfs_debug_msg_data msgdata; \ ^ drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:222:35: note: in expansion of macro '__CDEBUG' #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__) ^ drivers/staging/lustre/lnet/selftest/selftest.h:588:3: note: in expansion of macro 'CDEBUG' CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ drivers/staging/lustre/lnet/selftest/timer.c:240:2: note: in expansion of macro 'lst_wait_until' lst_wait_until(stt_data.stt_nthreads == 0, stt_data.stt_lock, ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs.h:111:0, from drivers/staging/lustre/lnet/selftest/selftest.h:46, from drivers/staging/lustre/lnet/selftest/rpc.c:47: drivers/staging/lustre/lnet/selftest/rpc.c: In function 'srpc_service_add_buffers': >> drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:212:16: error: implicit declaration of function 'IS_PO2' [-Werror=implicit-function-declaration] static struct libcfs_debug_msg_data msgdata; \ ^ drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h:222:35: note: in expansion of macro '__CDEBUG' #define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__) ^ drivers/staging/lustre/lnet/selftest/selftest.h:588:3: note: in expansion of macro 'CDEBUG' CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ ^ drivers/staging/lustre/lnet/selftest/rpc.c:619:3: note: in expansion of macro 'lst_wait_until' lst_wait_until(scd->scd_buf_err != 0 || ^ cc1: some warnings being treated as errors vim +/IS_PO2 +212 drivers/staging/lustre/lnet/selftest/../../include/linux/libcfs/libcfs_debug.h d7e09d039 Peng Tao 2013-05-02 206 return mask & D_CANTMASK || d7e09d039 Peng Tao 2013-05-02 207 ((libcfs_debug & mask) && (libcfs_subsystem_debug & subsystem)); d7e09d039 Peng Tao 2013-05-02 208 } d7e09d039 Peng Tao 2013-05-02 209 d7e09d039 Peng Tao 2013-05-02 210 #define __CDEBUG(cdls, mask, format, ...) \ d7e09d039 Peng Tao 2013-05-02 211 do { \ d7e09d039 Peng Tao 2013-05-02 @212 static struct libcfs_debug_msg_data msgdata; \ d7e09d039 Peng Tao 2013-05-02 213 \ d7e09d039 Peng Tao 2013-05-02 214 CFS_CHECK_STACK(&msgdata, mask, cdls); \ d7e09d039 Peng Tao 2013-05-02 215 \ :::::: The code at line 212 was first introduced by commit :::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system client support :::::: TO: Peng Tao :::::: CC: Greg Kroah-Hartman --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/octet-stream Size: 38548 bytes Desc: not available URL: From greg at kroah.com Sat Oct 17 05:21:05 2015 From: greg at kroah.com (Greg KH) Date: Fri, 16 Oct 2015 22:21:05 -0700 Subject: [lustre-devel] [PATCH 4/4] staging: lustre: remove IS_PO2 and __is_po2 In-Reply-To: <97ba103dc2a11e23fd4a384eb041c273b67a9aee.1445032901.git.mahfouz.saif.elyazal@gmail.com> References: <97ba103dc2a11e23fd4a384eb041c273b67a9aee.1445032901.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <20151017052105.GA10998@kroah.com> On Sat, Oct 17, 2015 at 12:07:28AM +0200, Aya Mahfouz wrote: > Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have > been replaced by is_power_of_2 > > Signed-off-by: Aya Mahfouz > --- > drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- > 1 file changed, 7 deletions(-) You didn't test build this patch :( From gregkh at linuxfoundation.org Sat Oct 17 05:40:25 2015 From: gregkh at linuxfoundation.org (Greg KH) Date: Fri, 16 Oct 2015 22:40:25 -0700 Subject: [lustre-devel] [PATCH 2/4] staging: lustre: hash.c: replace IS_PO2 by is_power_of_2 In-Reply-To: <798c319bad7c0c621b608f499860eaaa1c78d03d.1445032901.git.mahfouz.saif.elyazal@gmail.com> References: <798c319bad7c0c621b608f499860eaaa1c78d03d.1445032901.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <20151017054025.GA25392@kroah.com> On Sat, Oct 17, 2015 at 12:06:28AM +0200, Aya Mahfouz wrote: > Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug > macros. In this case, it is CDEBUG. Note that the replacement changes > the types involved, because the parameter of IS_PO2 is of type long long > and the return type is int, while the parameter of is_power_of_2 is of > type long and the return type is bool. This, however, has no impact, > because the actual argument is always of type int, and the return value > is always used as a boolean. > > Signed-off-by: Aya Mahfouz > --- > drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c > index 6f4c7d4..4b5e79a 100644 > --- a/drivers/staging/lustre/lustre/libcfs/hash.c > +++ b/drivers/staging/lustre/lustre/libcfs/hash.c > @@ -109,6 +109,8 @@ > > #include "../../include/linux/libcfs/libcfs.h" > #include > +#include > + > > #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 > static unsigned int warn_on_depth = 8; > @@ -1785,7 +1787,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) > for (i = 2; cfs_hash_is_rehashing(hs); i++) { > cfs_hash_unlock(hs, 1); > /* raise console warning while waiting too long */ > - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, > + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, is_power_of_2() works differently than IS_PO2(), are you _sure_ that the value here can not be 0? If so, this will do something different :( thanks, greg k-h From gregkh at linuxfoundation.org Sat Oct 17 05:40:49 2015 From: gregkh at linuxfoundation.org (Greg KH) Date: Fri, 16 Oct 2015 22:40:49 -0700 Subject: [lustre-devel] [PATCH 3/4] staging: lustre: workitem.c: replace IS_PO2 with is_power_of_2 In-Reply-To: <2519058141bb445670678a4f7dfbca2eabde4477.1445032901.git.mahfouz.saif.elyazal@gmail.com> References: <2519058141bb445670678a4f7dfbca2eabde4477.1445032901.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <20151017054049.GB25392@kroah.com> On Sat, Oct 17, 2015 at 12:06:59AM +0200, Aya Mahfouz wrote: > Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug > macros. In this case, it is CDEBUG. Note that the replacement changes > the types involved, because the parameter of IS_PO2 is of type long long > and the return type is int, while the parameter of is_power_of_2 is of > type long and the return type is bool. This, however, has no impact, > because the actual argument is always of type int, and the return value > is always used as a boolean. > > Signed-off-by: Aya Mahfouz > --- > drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c > index e1143a5..377e1ea 100644 > --- a/drivers/staging/lustre/lustre/libcfs/workitem.c > +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c > @@ -41,6 +41,8 @@ > > #define DEBUG_SUBSYSTEM S_LNET > > +#include > + > #include "../../include/linux/libcfs/libcfs.h" > > #define CFS_WS_NAME_LEN 16 > @@ -325,7 +327,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) > > spin_lock(&cfs_wi_data.wi_glock); > while (sched->ws_nthreads > 0) { > - CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, > + CDEBUG(is_power_of_2(++i) ? D_WARNING : D_NET, Same question about 0 here as well. thanks, greg k-h From gregkh at linuxfoundation.org Sat Oct 17 05:41:09 2015 From: gregkh at linuxfoundation.org (Greg KH) Date: Fri, 16 Oct 2015 22:41:09 -0700 Subject: [lustre-devel] [PATCH 1/4] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <20151017054109.GC25392@kroah.com> On Sat, Oct 17, 2015 at 12:05:44AM +0200, Aya Mahfouz wrote: > Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug > macros. In this case, it is LASSERT. Note that the replacement changes > the types involved, because the parameter of IS_PO2 is of type long > long and the return type is int, while the parameter of is_power_of_2 > is of type long and the return type is bool. This, however, has no > impact, because the actual argument is always of type int, and the > return value is always used as a boolean. All of this info about the types mean nothing for this patch :( From eman.yarlagadda at intel.com Sat Oct 17 08:54:30 2015 From: eman.yarlagadda at intel.com (Yarlagadda, Eman) Date: Sat, 17 Oct 2015 08:54:30 +0000 Subject: [lustre-devel] =?utf-8?q?Event_Reminder_=E2=80=93_Lustre*_User_Gr?= =?utf-8?q?oup_PRC_2015?= In-Reply-To: <827868883.-1385268955.1444704714456.JavaMail.root@abmas01.marketo.org> References: <827868883.-1385268955.1444704714456.JavaMail.root@abmas01.marketo.org> Message-ID: [Intel® - High Performance Data Division] Event Details: Hear directly from industry thought leaders about the latest Lustre* file system trends by attending the 2015 PRC Lustre* Users Group conference. Don’t miss this exclusive opportunity to collaborate with industry leaders to advance the Lustre* file system and contribute to new releases on behalf of the open source community. Register Here Event Date: October 20th, 2015 from 8:30am - 5:00pm (Click Here to Add Event to your Calendar) Location: Regent Hotel Beijing (99 Jinbao Street, Dongcheng District, Beijing, 100005, China) Telephone: +86 10 8522 1888 Review Agenda (Draft) UNABLE TO ATTEND? We’re sorry that you cannot make it to the event, but you can still sign-up for our mailing list to receive future communications about this gathering and valuable information about Intel ® Solutions for Lustre* software. Subscribe to Newsletter (Click Here) [HPDD PRC Footer] [Intel®] Trademarks | Terms of Use | Privacy Policy | Contact Us Copyright © 2014 Intel Corporation. All rights reserved. Intel, the Intel logo, and Intel Xeon are trademarks of Intel Corporation in the U.S. and/or other countries. *Other names and brands may be claimed as the property of others. *Other names and brands may be claimed as the property of others. If you no longer wish to receive these emails, click on the following link: Unsubscribe -------------- next part -------------- An HTML attachment was scrubbed... URL: From mahfouz.saif.elyazal at gmail.com Sat Oct 17 09:54:22 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 11:54:22 +0200 Subject: [lustre-devel] [PATCH 4/4] staging: lustre: remove IS_PO2 and __is_po2 In-Reply-To: <20151017052105.GA10998@kroah.com> References: <97ba103dc2a11e23fd4a384eb041c273b67a9aee.1445032901.git.mahfouz.saif.elyazal@gmail.com> <20151017052105.GA10998@kroah.com> Message-ID: <20151017095422.GA29503@waves> On Fri, Oct 16, 2015 at 10:21:05PM -0700, Greg KH wrote: > On Sat, Oct 17, 2015 at 12:07:28AM +0200, Aya Mahfouz wrote: > > Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have > > been replaced by is_power_of_2 > > > > Signed-off-by: Aya Mahfouz > > --- > > drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- > > 1 file changed, 7 deletions(-) > > You didn't test build this patch :( I think I'm too old for this mistake. The way kbuild tests patch sets will cause errors for sure. It tests every patch independently and of course the removal of IS_PO2 will cause a problem if the previous patches were not applied. -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Sat Oct 17 09:59:41 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 11:59:41 +0200 Subject: [lustre-devel] [PATCH 1/4] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 In-Reply-To: <20151017054109.GC25392@kroah.com> References: <20151017054109.GC25392@kroah.com> Message-ID: <20151017095941.GB29503@waves> On Fri, Oct 16, 2015 at 10:41:09PM -0700, Greg KH wrote: > On Sat, Oct 17, 2015 at 12:05:44AM +0200, Aya Mahfouz wrote: > > Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug > > macros. In this case, it is LASSERT. Note that the replacement changes > > the types involved, because the parameter of IS_PO2 is of type long > > long and the return type is int, while the parameter of is_power_of_2 > > is of type long and the return type is bool. This, however, has no > > impact, because the actual argument is always of type int, and the > > return value is always used as a boolean. > > All of this info about the types mean nothing for this patch :( > Hmm, my problem is that I realized the difference of return types between the macro IS_PO2 and is_power_of_2. I tested the bool datatype with a user space program to see what I will get and I get 0s and 1s. I can do it with a simple kernel driver to see what happens there too if you would like. Kindly let me know what kind of information you would like to see in the commit message. -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Sat Oct 17 10:34:14 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 12:34:14 +0200 Subject: [lustre-devel] [PATCH 2/4] staging: lustre: hash.c: replace IS_PO2 by is_power_of_2 In-Reply-To: <20151017054025.GA25392@kroah.com> References: <798c319bad7c0c621b608f499860eaaa1c78d03d.1445032901.git.mahfouz.saif.elyazal@gmail.com> <20151017054025.GA25392@kroah.com> Message-ID: <20151017103414.GC29503@waves> On Fri, Oct 16, 2015 at 10:40:25PM -0700, Greg KH wrote: > On Sat, Oct 17, 2015 at 12:06:28AM +0200, Aya Mahfouz wrote: > > Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug > > macros. In this case, it is CDEBUG. Note that the replacement changes > > the types involved, because the parameter of IS_PO2 is of type long long > > and the return type is int, while the parameter of is_power_of_2 is of > > type long and the return type is bool. This, however, has no impact, > > because the actual argument is always of type int, and the return value > > is always used as a boolean. > > > > Signed-off-by: Aya Mahfouz > > --- > > drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c > > index 6f4c7d4..4b5e79a 100644 > > --- a/drivers/staging/lustre/lustre/libcfs/hash.c > > +++ b/drivers/staging/lustre/lustre/libcfs/hash.c > > @@ -109,6 +109,8 @@ > > > > #include "../../include/linux/libcfs/libcfs.h" > > #include > > +#include > > + > > > > #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 > > static unsigned int warn_on_depth = 8; > > @@ -1785,7 +1787,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) > > for (i = 2; cfs_hash_is_rehashing(hs); i++) { > > cfs_hash_unlock(hs, 1); > > /* raise console warning while waiting too long */ > > - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, > > + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, > > is_power_of_2() works differently than IS_PO2(), are you _sure_ that the > value here can not be 0? If so, this will do something different :( > This is actually an interesting point to raise. __is_po2 the inline function used by IS_PO2 should actually check if the number is greater than 0. The current implementation of __is_po2 would allow the comparison of 0 with 2^(size of unsigned long long)-1. Is this correct? Or is this something intentional? > thanks, > > greg k-h -- Kind Regards, Aya Saif El-yazal Mahfouz From julia.lawall at lip6.fr Sat Oct 17 10:47:13 2015 From: julia.lawall at lip6.fr (Julia Lawall) Date: Sat, 17 Oct 2015 12:47:13 +0200 (CEST) Subject: [lustre-devel] [PATCH 2/4] staging: lustre: hash.c: replace IS_PO2 by is_power_of_2 In-Reply-To: <20151017103414.GC29503@waves> References: <798c319bad7c0c621b608f499860eaaa1c78d03d.1445032901.git.mahfouz.saif.elyazal@gmail.com> <20151017054025.GA25392@kroah.com> <20151017103414.GC29503@waves> Message-ID: On Sat, 17 Oct 2015, Aya Mahfouz wrote: > On Fri, Oct 16, 2015 at 10:40:25PM -0700, Greg KH wrote: > > On Sat, Oct 17, 2015 at 12:06:28AM +0200, Aya Mahfouz wrote: > > > Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug > > > macros. In this case, it is CDEBUG. Note that the replacement changes > > > the types involved, because the parameter of IS_PO2 is of type long long > > > and the return type is int, while the parameter of is_power_of_2 is of > > > type long and the return type is bool. This, however, has no impact, > > > because the actual argument is always of type int, and the return value > > > is always used as a boolean. > > > > > > Signed-off-by: Aya Mahfouz > > > --- > > > drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c > > > index 6f4c7d4..4b5e79a 100644 > > > --- a/drivers/staging/lustre/lustre/libcfs/hash.c > > > +++ b/drivers/staging/lustre/lustre/libcfs/hash.c > > > @@ -109,6 +109,8 @@ > > > > > > #include "../../include/linux/libcfs/libcfs.h" > > > #include > > > +#include > > > + > > > > > > #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 > > > static unsigned int warn_on_depth = 8; > > > @@ -1785,7 +1787,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) > > > for (i = 2; cfs_hash_is_rehashing(hs); i++) { > > > cfs_hash_unlock(hs, 1); > > > /* raise console warning while waiting too long */ > > > - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, > > > + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, > > > > is_power_of_2() works differently than IS_PO2(), are you _sure_ that the > > value here can not be 0? If so, this will do something different :( > > > > This is actually an interesting point to raise. __is_po2 the inline > function used by IS_PO2 should actually check if the number is greater > than 0. The current implementation of __is_po2 would allow the > comparison of 0 with 2^(size of unsigned long long)-1. Is this correct? > Or is this something intentional? What is the actual result in each case? julia From mahfouz.saif.elyazal at gmail.com Sat Oct 17 13:23:48 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sat, 17 Oct 2015 15:23:48 +0200 Subject: [lustre-devel] [PATCH 2/4] staging: lustre: hash.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: <798c319bad7c0c621b608f499860eaaa1c78d03d.1445032901.git.mahfouz.saif.elyazal@gmail.com> <20151017054025.GA25392@kroah.com> <20151017103414.GC29503@waves> Message-ID: <20151017132348.GB29953@waves> On Sat, Oct 17, 2015 at 12:47:13PM +0200, Julia Lawall wrote: > On Sat, 17 Oct 2015, Aya Mahfouz wrote: > > > On Fri, Oct 16, 2015 at 10:40:25PM -0700, Greg KH wrote: > > > On Sat, Oct 17, 2015 at 12:06:28AM +0200, Aya Mahfouz wrote: > > > > Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug > > > > macros. In this case, it is CDEBUG. Note that the replacement changes > > > > the types involved, because the parameter of IS_PO2 is of type long long > > > > and the return type is int, while the parameter of is_power_of_2 is of > > > > type long and the return type is bool. This, however, has no impact, > > > > because the actual argument is always of type int, and the return value > > > > is always used as a boolean. > > > > > > > > Signed-off-by: Aya Mahfouz > > > > --- > > > > drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- > > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c > > > > index 6f4c7d4..4b5e79a 100644 > > > > --- a/drivers/staging/lustre/lustre/libcfs/hash.c > > > > +++ b/drivers/staging/lustre/lustre/libcfs/hash.c > > > > @@ -109,6 +109,8 @@ > > > > > > > > #include "../../include/linux/libcfs/libcfs.h" > > > > #include > > > > +#include > > > > + > > > > > > > > #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 > > > > static unsigned int warn_on_depth = 8; > > > > @@ -1785,7 +1787,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) > > > > for (i = 2; cfs_hash_is_rehashing(hs); i++) { > > > > cfs_hash_unlock(hs, 1); > > > > /* raise console warning while waiting too long */ > > > > - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, > > > > + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, > > > > > > is_power_of_2() works differently than IS_PO2(), are you _sure_ that the > > > value here can not be 0? If so, this will do something different :( > > > > > > > This is actually an interesting point to raise. __is_po2 the inline > > function used by IS_PO2 should actually check if the number is greater > > than 0. The current implementation of __is_po2 would allow the > > comparison of 0 with 2^(size of unsigned long long)-1. Is this correct? > > Or is this something intentional? > > What is the actual result in each case? > for __is_po2, if the number is 0 or power of 2 i.e. 1,2,4,8,16,32 etc then return 1, 0 otherwise for is_power_of_2 if the number is power of 2 return 1, 0 otherwise > julia -- Kind Regards, Aya Saif El-yazal Mahfouz From andreas.dilger at intel.com Sat Oct 17 16:06:09 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Sat, 17 Oct 2015 16:06:09 +0000 Subject: [lustre-devel] [PATCH 2/4] staging: lustre: hash.c: replace IS_PO2 by is_power_of_2 In-Reply-To: <20151017132348.GB29953@waves> References: <798c319bad7c0c621b608f499860eaaa1c78d03d.1445032901.git.mahfouz.saif.elyazal@gmail.com> <20151017054025.GA25392@kroah.com> <20151017103414.GC29503@waves> , <20151017132348.GB29953@waves> Message-ID: <7B4AB32D-3F72-43F0-98A7-C812D635B649@intel.com> On Oct 17, 2015, at 07:23, Aya Mahfouz wrote: > >> On Sat, Oct 17, 2015 at 12:47:13PM +0200, Julia Lawall wrote: >>> On Sat, 17 Oct 2015, Aya Mahfouz wrote: >>> >>>> On Fri, Oct 16, 2015 at 10:40:25PM -0700, Greg KH wrote: >>>>> On Sat, Oct 17, 2015 at 12:06:28AM +0200, Aya Mahfouz wrote: >>>>> Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug >>>>> macros. In this case, it is CDEBUG. Note that the replacement changes >>>>> the types involved, because the parameter of IS_PO2 is of type long long >>>>> and the return type is int, while the parameter of is_power_of_2 is of >>>>> type long and the return type is bool. This, however, has no impact, >>>>> because the actual argument is always of type int, and the return value >>>>> is always used as a boolean. >>>>> >>>>> Signed-off-by: Aya Mahfouz >>>>> --- >>>>> drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- >>>>> 1 file changed, 3 insertions(+), 1 deletion(-) >>>>> >>>>> diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c >>>>> index 6f4c7d4..4b5e79a 100644 >>>>> --- a/drivers/staging/lustre/lustre/libcfs/hash.c >>>>> +++ b/drivers/staging/lustre/lustre/libcfs/hash.c >>>>> @@ -109,6 +109,8 @@ >>>>> >>>>> #include "../../include/linux/libcfs/libcfs.h" >>>>> #include >>>>> +#include >>>>> + >>>>> >>>>> #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 >>>>> static unsigned int warn_on_depth = 8; >>>>> @@ -1785,7 +1787,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) >>>>> for (i = 2; cfs_hash_is_rehashing(hs); i++) { >>>>> cfs_hash_unlock(hs, 1); >>>>> /* raise console warning while waiting too long */ >>>>> - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, >>>>> + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, >>>> >>>> is_power_of_2() works differently than IS_PO2(), are you _sure_ that the >>>> value here can not be 0? If so, this will do something different :( >>>> >>> >>> This is actually an interesting point to raise. __is_po2 the inline >>> function used by IS_PO2 should actually check if the number is greater >>> than 0. The current implementation of __is_po2 would allow the >>> comparison of 0 with 2^(size of unsigned long long)-1. Is this correct? >>> Or is this something intentional? >> >> What is the actual result in each case? >> > > for __is_po2, if the number is 0 or power of 2 i.e. 1,2,4,8,16,32 etc > then return 1, 0 otherwise > for is_power_of_2 if the number is power of 2 return 1, 0 otherwise It looks to me that the new behavior is actually more correct than the old one. The message shouldn't print onto the console until it has been tried several times, which is the case with is_power_of_2(). This hasn't been noticed in the past since it only happens if the hash table is still being resized at the same time it is being destroyed. In summary, I think the existing patch is fine. You can add: Reviewed-by: Andreas Dilger Cheers, Andreas From andreas.dilger at intel.com Sat Oct 17 16:15:28 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Sat, 17 Oct 2015 16:15:28 +0000 Subject: [lustre-devel] [PATCH 3/4] staging: lustre: workitem.c: replace IS_PO2 with is_power_of_2 In-Reply-To: <20151017054049.GB25392@kroah.com> References: <2519058141bb445670678a4f7dfbca2eabde4477.1445032901.git.mahfouz.saif.elyazal@gmail.com>, <20151017054049.GB25392@kroah.com> Message-ID: <36CD7538-A3A6-4704-A622-E8BA4C676D57@intel.com> On Oct 16, 2015, at 23:40, Greg KH wrote: > >> On Sat, Oct 17, 2015 at 12:06:59AM +0200, Aya Mahfouz wrote: >> Replaces IS_PO2 by is_power_of_2. IS_PO2 is used with several debug >> macros. In this case, it is CDEBUG. Note that the replacement changes >> the types involved, because the parameter of IS_PO2 is of type long long >> and the return type is int, while the parameter of is_power_of_2 is of >> type long and the return type is bool. This, however, has no impact, >> because the actual argument is always of type int, and the return value >> is always used as a boolean. >> >> Signed-off-by: Aya Mahfouz >> --- >> drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c >> index e1143a5..377e1ea 100644 >> --- a/drivers/staging/lustre/lustre/libcfs/workitem.c >> +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c >> @@ -41,6 +41,8 @@ >> >> #define DEBUG_SUBSYSTEM S_LNET >> >> +#include >> + >> #include "../../include/linux/libcfs/libcfs.h" >> >> #define CFS_WS_NAME_LEN 16 >> @@ -325,7 +327,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) >> >> spin_lock(&cfs_wi_data.wi_glock); >> while (sched->ws_nthreads > 0) { >> - CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, >> + CDEBUG(is_power_of_2(++i) ? D_WARNING : D_NET, > > Same question about 0 here as well. The initial value of "i" is 2 so the distinction doesn't make a difference in this case. You can add: Reviewed-by: Andreas Dilger From mahfouz.saif.elyazal at gmail.com Sun Oct 18 10:51:50 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sun, 18 Oct 2015 12:51:50 +0200 Subject: [lustre-devel] [PATCH 4/4] staging: lustre: remove IS_PO2 and __is_po2 In-Reply-To: <20151017052105.GA10998@kroah.com> References: <97ba103dc2a11e23fd4a384eb041c273b67a9aee.1445032901.git.mahfouz.saif.elyazal@gmail.com> <20151017052105.GA10998@kroah.com> Message-ID: <20151018105150.GA6834@waves> On Fri, Oct 16, 2015 at 10:21:05PM -0700, Greg KH wrote: > On Sat, Oct 17, 2015 at 12:07:28AM +0200, Aya Mahfouz wrote: > > Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have > > been replaced by is_power_of_2 > > > > Signed-off-by: Aya Mahfouz > > --- > > drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- > > 1 file changed, 7 deletions(-) > > You didn't test build this patch :( I'm sorry I didn't run spatch on the header files too. I reran the scripts on all lustre files including header and issued make clean and then make. Will be resending v2 soon. kbuild does apply all patches in a patch set in order. -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Sun Oct 18 11:11:42 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sun, 18 Oct 2015 13:11:42 +0200 Subject: [lustre-devel] [PATCH v2 0/5] Remove uses and definition of IS_PO2 Message-ID: Concerned with the removal of IS_PO2 by replacing its uses with is_power_of_2 and then removing the definition. This is the second version of the patch set. The commit messages were changed and a new patch was added for a use of IS_PO2 indicated by kbuild test robot. Aya Mahfouz (5): staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2 staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2 staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- drivers/staging/lustre/lnet/selftest/selftest.h | 4 +++- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++- drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 5 files changed, 13 insertions(+), 11 deletions(-) -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Sun Oct 18 11:13:33 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sun, 18 Oct 2015 13:13:33 +0200 Subject: [lustre-devel] [PATCH v2 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Signed-off-by: Aya Mahfouz --- v2: -changed commit message drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index 57b997d..3e7e97e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -50,6 +50,9 @@ */ #define DEBUG_SUBSYSTEM S_LDLM + +#include + #include "../../include/linux/libcfs/libcfs.h" #include "../include/lustre_dlm.h" #include "../include/obd_support.h" @@ -149,7 +152,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode) int index; LASSERT(mode != 0); - LASSERT(IS_PO2(mode)); + LASSERT(is_power_of_2(mode)); for (index = -1; mode; index++) mode >>= 1; LASSERT(index < LCK_MODE_NUM); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Sun Oct 18 11:14:56 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sun, 18 Oct 2015 13:14:56 +0200 Subject: [lustre-devel] [PATCH v2 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <3b5f88331856582fe517be9d55f3ddded80e6c88.1445166429.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Reviewed-by: Andreas Dilger Signed-off-by: Aya Mahfouz --- v2: -changed commit message -added Andreas Reviewed by tag drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 6f4c7d4..4b5e79a 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -109,6 +109,8 @@ #include "../../include/linux/libcfs/libcfs.h" #include +#include + #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 static unsigned int warn_on_depth = 8; @@ -1785,7 +1787,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) for (i = 2; cfs_hash_is_rehashing(hs); i++) { cfs_hash_unlock(hs, 1); /* raise console warning while waiting too long */ - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, "hash %s is still rehashing, rescheded %d\n", hs->hs_name, i - 1); cond_resched(); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Sun Oct 18 11:16:21 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sun, 18 Oct 2015 13:16:21 +0200 Subject: [lustre-devel] [PATCH v2 3/5] staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <83b9e52c85e13c63d42b434fbd36307e869e244b.1445166429.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Reviewed-by: Andreas Dilger Signed-off-by: Aya Mahfouz --- v2: -changed commit message -added Andreas Reviewed by tag drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index e1143a5..377e1ea 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -41,6 +41,8 @@ #define DEBUG_SUBSYSTEM S_LNET +#include + #include "../../include/linux/libcfs/libcfs.h" #define CFS_WS_NAME_LEN 16 @@ -325,7 +327,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) spin_lock(&cfs_wi_data.wi_glock); while (sched->ws_nthreads > 0) { - CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, + CDEBUG(is_power_of_2(++i) ? D_WARNING : D_NET, "waiting for %d threads of WI sched[%s] to terminate\n", sched->ws_nthreads, sched->ws_name); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Sun Oct 18 11:17:30 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sun, 18 Oct 2015 13:17:30 +0200 Subject: [lustre-devel] [PATCH v2 4/5] staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <80d953d3bda682675fed808e6ae2a6c6855a5ae5.1445166429.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Signed-off-by: Aya Mahfouz --- v2: -added new patch in patch set for selftest.h drivers/staging/lustre/lnet/selftest/selftest.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 8a77d3f..2846f26 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -43,6 +43,8 @@ #define LNET_ONLY +#include + #include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/lnet/lnet.h" #include "../../include/linux/lnet/lib-lnet.h" @@ -585,7 +587,7 @@ swi_state2str (int state) do { \ int __I = 2; \ while (!(cond)) { \ - CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ + CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET, \ fmt, ## __VA_ARGS__); \ spin_unlock(&(lock)); \ \ -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Sun Oct 18 11:18:46 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Sun, 18 Oct 2015 13:18:46 +0200 Subject: [lustre-devel] [PATCH v2 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 In-Reply-To: References: Message-ID: <0e9d3eee355071a1a5c1cb85eb60da11584fb912.1445166429.git.mahfouz.saif.elyazal@gmail.com> Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have been replaced by is_power_of_2 Signed-off-by: Aya Mahfouz --- v2: -became patch number 5 in the series drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 385ced1..c78a147 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -42,13 +42,6 @@ #include "curproc.h" -static inline int __is_po2(unsigned long long val) -{ - return !(val & (val - 1)); -} - -#define IS_PO2(val) __is_po2((unsigned long long)(val)) - #define LOWEST_BIT_SET(x) ((x) & ~((x) - 1)) /* -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From bevans at cray.com Tue Oct 20 22:02:01 2015 From: bevans at cray.com (Ben Evans) Date: Tue, 20 Oct 2015 17:02:01 -0500 Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h Message-ID: <20151020220201.GA6065@lusbld01.us.cray.com> Put IT_* definitions into an enum, as they're sent over the wire, adjust calls, print statements, etc. to use the new enum. Signed-off-by: Ben Evans --- .../lustre/lustre/include/lustre/lustre_idl.h | 18 ++++++++++++++++++ drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/obd.h | 16 ---------------- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index ac78dbc..646c095 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2782,6 +2782,24 @@ union ldlm_gl_desc { void lustre_swab_gl_desc(union ldlm_gl_desc *); +enum ldlm_intent_flags { + IT_OPEN = 0x00000001, + IT_CREAT = 0x00000002, + IT_OPEN_CREAT = 0x00000003, + IT_READDIR = 0x00000004, + IT_GETATTR = 0x00000008, + IT_LOOKUP = 0x00000010, + IT_UNLINK = 0x00000020, + IT_TRUNC = 0x00000040, + IT_GETXATTR = 0x00000080, + IT_EXEC = 0x00000100, + IT_PIN = 0x00000200, + IT_LAYOUT = 0x00000400, + IT_QUOTA_DQACQ = 0x00000800, + IT_QUOTA_CONN = 0x00001000, + IT_SETXATTR = 0x00002000, +}; + struct ldlm_intent { __u64 opc; }; diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 3552546..af46f36 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1017,7 +1017,7 @@ extern struct obd_ops ldlm_obd_ops; extern char *ldlm_lockname[]; extern char *ldlm_typename[]; -char *ldlm_it2str(int it); +const char *ldlm_it2str(enum ldlm_intent_flags it); /** * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG. diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 9ad8c26..f731f51 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -995,22 +995,6 @@ enum obd_cleanup_stage { struct lu_context; -/* /!\ must be coherent with include/linux/namei.h on patched kernel */ -#define IT_OPEN (1 << 0) -#define IT_CREAT (1 << 1) -#define IT_READDIR (1 << 2) -#define IT_GETATTR (1 << 3) -#define IT_LOOKUP (1 << 4) -#define IT_UNLINK (1 << 5) -#define IT_TRUNC (1 << 6) -#define IT_GETXATTR (1 << 7) -#define IT_EXEC (1 << 8) -#define IT_PIN (1 << 9) -#define IT_LAYOUT (1 << 10) -#define IT_QUOTA_DQACQ (1 << 11) -#define IT_QUOTA_CONN (1 << 12) -#define IT_SETXATTR (1 << 13) - static inline int it_to_lock_mode(struct lookup_intent *it) { /* CREAT needs to be tested before open (both could be set) */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index cd340fc..f3b197a 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -123,7 +123,7 @@ void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type, convert(wpolicy, lpolicy); } -char *ldlm_it2str(int it) +const char *ldlm_it2str(enum ldlm_intent_flags it) { switch (it) { case IT_OPEN: -- 1.6.5.6 From paf at cray.com Wed Oct 21 00:41:19 2015 From: paf at cray.com (Patrick Farrell) Date: Wed, 21 Oct 2015 00:41:19 +0000 Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h In-Reply-To: <20151020220201.GA6065@lusbld01.us.cray.com> References: <20151020220201.GA6065@lusbld01.us.cray.com> Message-ID: Do you know what the removed comment about being coherent with namei.h means or once meant? I took a look and can't see anything that corresponds now, but I'd feel more comfortable if I knew for sure what that comment meant... - Patrick ________________________________________ From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Ben Evans [bevans at cray.com] Sent: Tuesday, October 20, 2015 5:02 PM To: lustre-devel at lists.lustre.org Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h Put IT_* definitions into an enum, as they're sent over the wire, adjust calls, print statements, etc. to use the new enum. Signed-off-by: Ben Evans --- .../lustre/lustre/include/lustre/lustre_idl.h | 18 ++++++++++++++++++ drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/obd.h | 16 ---------------- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index ac78dbc..646c095 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2782,6 +2782,24 @@ union ldlm_gl_desc { void lustre_swab_gl_desc(union ldlm_gl_desc *); +enum ldlm_intent_flags { + IT_OPEN = 0x00000001, + IT_CREAT = 0x00000002, + IT_OPEN_CREAT = 0x00000003, + IT_READDIR = 0x00000004, + IT_GETATTR = 0x00000008, + IT_LOOKUP = 0x00000010, + IT_UNLINK = 0x00000020, + IT_TRUNC = 0x00000040, + IT_GETXATTR = 0x00000080, + IT_EXEC = 0x00000100, + IT_PIN = 0x00000200, + IT_LAYOUT = 0x00000400, + IT_QUOTA_DQACQ = 0x00000800, + IT_QUOTA_CONN = 0x00001000, + IT_SETXATTR = 0x00002000, +}; + struct ldlm_intent { __u64 opc; }; diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 3552546..af46f36 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1017,7 +1017,7 @@ extern struct obd_ops ldlm_obd_ops; extern char *ldlm_lockname[]; extern char *ldlm_typename[]; -char *ldlm_it2str(int it); +const char *ldlm_it2str(enum ldlm_intent_flags it); /** * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG. diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 9ad8c26..f731f51 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -995,22 +995,6 @@ enum obd_cleanup_stage { struct lu_context; -/* /!\ must be coherent with include/linux/namei.h on patched kernel */ -#define IT_OPEN (1 << 0) -#define IT_CREAT (1 << 1) -#define IT_READDIR (1 << 2) -#define IT_GETATTR (1 << 3) -#define IT_LOOKUP (1 << 4) -#define IT_UNLINK (1 << 5) -#define IT_TRUNC (1 << 6) -#define IT_GETXATTR (1 << 7) -#define IT_EXEC (1 << 8) -#define IT_PIN (1 << 9) -#define IT_LAYOUT (1 << 10) -#define IT_QUOTA_DQACQ (1 << 11) -#define IT_QUOTA_CONN (1 << 12) -#define IT_SETXATTR (1 << 13) - static inline int it_to_lock_mode(struct lookup_intent *it) { /* CREAT needs to be tested before open (both could be set) */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index cd340fc..f3b197a 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -123,7 +123,7 @@ void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type, convert(wpolicy, lpolicy); } -char *ldlm_it2str(int it) +const char *ldlm_it2str(enum ldlm_intent_flags it) { switch (it) { case IT_OPEN: -- 1.6.5.6 _______________________________________________ lustre-devel mailing list lustre-devel at lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From snnw at gruttepier.net Mon Oct 19 11:56:51 2015 From: snnw at gruttepier.net (snnw at gruttepier.net) Date: Mon, 19 Oct 2015 13:56:51 +0200 Subject: [lustre-devel] [PATCH V3] staging: lustre: kernel style neating (block comments) In-Reply-To: <20151012234606.GA16427@kroah.com> References: <20151012234606.GA16427@kroah.com> Message-ID: <1445255811-8275-1-git-send-email-snnw@gruttepier.net> From: Sanne Wouda Fix lustre/ptlrpc/client.c block comments following the Coding Style preferred format for multi-line and single-line comments: /* * This is the preferred style for multi-line * comments in the Linux kernel source code. * Please use it consistently. * * Description: A column of asterisks on the left side, * with beginning and ending almost-blank lines. */ Included some minor textual fixes to get some comments on a single line. Signed-off-by: Sanne Wouda --- Greg: > This doesn't apply to my tree anymore, can you please redo it against > the staging-testing branch of my staging.git tree on git.kernel.org and > resend it? Applies cleanly to c3af8a28f43 "staging: IB/hfi1: use TASK_COMM_LEN in hfi1_ctxtdata" Comments by Andreas have been addressed. drivers/staging/lustre/lustre/ptlrpc/client.c | 322 +++++++++++++++----------- 1 file changed, 182 insertions(+), 140 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 9bf13d7..083f99c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -72,9 +72,11 @@ struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid) lnet_process_id_t peer; int err; - /* ptlrpc_uuid_to_peer() initializes its 2nd parameter - * before accessing its values. */ - /* coverity[uninit_use_in_call] */ + /* + * ptlrpc_uuid_to_peer() initializes its 2nd parameter + * before accessing its values. + * coverity[uninit_use_in_call] + */ err = ptlrpc_uuid_to_peer(uuid, &peer, &self); if (err != 0) { CNETERR("cannot find peer %s!\n", uuid->uuid); @@ -117,8 +119,10 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned npages, unsigned max_brw, desc->bd_md_count = 0; LASSERT(max_brw > 0); desc->bd_md_max_brw = min(max_brw, PTLRPC_BULK_OPS_COUNT); - /* PTLRPC_BULK_OPS_COUNT is the compile-time transfer limit for this - * node. Negotiated ocd_brw_size will always be <= this number. */ + /* + * PTLRPC_BULK_OPS_COUNT is the compile-time transfer limit for this + * node. Negotiated ocd_brw_size will always be <= this number. + */ for (i = 0; i < PTLRPC_BULK_OPS_COUNT; i++) LNetInvalidateHandle(&desc->bd_mds[i]); @@ -223,8 +227,9 @@ void ptlrpc_at_set_req_timeout(struct ptlrpc_request *req) LASSERT(req->rq_import); if (AT_OFF) { - /* non-AT settings */ - /** + /* + * non-AT settings + * * \a imp_server_timeout means this is reverse import and * we send (currently only) ASTs to the client and cannot afford * to wait too long for the reply, otherwise the other client @@ -240,11 +245,15 @@ void ptlrpc_at_set_req_timeout(struct ptlrpc_request *req) serv_est = at_get(&at->iat_service_estimate[idx]); req->rq_timeout = at_est2timeout(serv_est); } - /* We could get even fancier here, using history to predict increased - loading... */ + /* + * We could get even fancier here, using history to predict increased + * loading... + */ - /* Let the server know what this RPC timeout is by putting it in the - reqmsg*/ + /* + * Let the server know what this RPC timeout is by putting it in the + * reqmsg + */ lustre_msg_set_timeout(req->rq_reqmsg, req->rq_timeout); } EXPORT_SYMBOL(ptlrpc_at_set_req_timeout); @@ -261,8 +270,10 @@ static void ptlrpc_at_adj_service(struct ptlrpc_request *req, at = &req->rq_import->imp_at; idx = import_at_get_index(req->rq_import, req->rq_request_portal); - /* max service estimates are tracked on the server side, - so just keep minimal history here */ + /* + * max service estimates are tracked on the server side, + * so just keep minimal history here + */ oldse = at_measured(&at->iat_service_estimate[idx], serv_est); if (oldse != 0) CDEBUG(D_ADAPTTO, "The RPC service estimate for %s ptl %d has changed from %d to %d\n", @@ -287,7 +298,8 @@ static void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req, LASSERT(req->rq_import); if (service_time > now - req->rq_sent + 3) { - /* bz16408, however, this can also happen if early reply + /* + * bz16408, however, this can also happen if early reply * is lost and client RPC is expired and resent, early reply * or reply of original RPC can still be fit in reply buffer * of resent RPC, now client is measuring time from the @@ -376,8 +388,10 @@ static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req) spin_lock(&req->rq_lock); olddl = req->rq_deadline; - /* server assumes it now has rq_timeout from when it sent the - * early reply, so client should give it at least that long. */ + /* + * server assumes it now has rq_timeout from when it sent the + * early reply, so client should give it at least that long. + */ req->rq_deadline = ktime_get_real_seconds() + req->rq_timeout + ptlrpc_at_get_net_latency(req); @@ -503,8 +517,10 @@ ptlrpc_init_rq_pool(int num_rq, int msgsize, if (!pool) return NULL; - /* Request next power of two for the allocation, because internally - kernel would do exactly this */ + /* + * Request next power of two for the allocation, because internally + * kernel would do exactly this + */ spin_lock_init(&pool->prp_lock); INIT_LIST_HEAD(&pool->prp_req_list); @@ -531,10 +547,12 @@ ptlrpc_prep_req_from_pool(struct ptlrpc_request_pool *pool) spin_lock(&pool->prp_lock); - /* See if we have anything in a pool, and bail out if nothing, + /* + * See if we have anything in a pool, and bail out if nothing, * in writeout path, where this matters, this is safe to do, because * nothing is lost in this case, and when some in-flight requests - * complete, this code will be called again. */ + * complete, this code will be called again. + */ if (unlikely(list_empty(&pool->prp_req_list))) { spin_unlock(&pool->prp_lock); return NULL; @@ -665,7 +683,8 @@ int ptlrpc_request_pack(struct ptlrpc_request *request, if (rc) return rc; - /* For some old 1.8 clients (< 1.8.7), they will LASSERT the size of + /* + * For some old 1.8 clients (< 1.8.7), they will LASSERT the size of * ptlrpc_body sent from server equal to local ptlrpc_body size, so we * have to send old ptlrpc_body to keep interoperability with these * clients. @@ -936,8 +955,10 @@ void ptlrpc_set_add_req(struct ptlrpc_request_set *set, lustre_msg_set_jobid(req->rq_reqmsg, NULL); if (set->set_producer != NULL) - /* If the request set has a producer callback, the RPC must be - * sent straight away */ + /* + * If the request set has a producer callback, the RPC must be + * sent straight away + */ ptlrpc_send_new_req(req); } EXPORT_SYMBOL(ptlrpc_set_add_req); @@ -957,9 +978,7 @@ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc, LASSERT(test_bit(LIOD_STOP, &pc->pc_flags) == 0); spin_lock(&set->set_new_req_lock); - /* - * The set takes over the caller's request reference. - */ + /* The set takes over the caller's request reference. */ req->rq_set = set; req->rq_queued_time = cfs_time_current(); list_add_tail(&req->rq_set_chain, &set->set_new_requests); @@ -970,9 +989,11 @@ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc, if (count == 1) { wake_up(&set->set_waitq); - /* XXX: It maybe unnecessary to wakeup all the partners. But to + /* + * XXX: It maybe unnecessary to wakeup all the partners. But to * guarantee the async RPC can be processed ASAP, we have - * no other better choice. It maybe fixed in future. */ + * no other better choice. It maybe fixed in future. + */ for (i = 0; i < pc->pc_npartners; i++) wake_up(&pc->pc_partners[i]->pc_set->set_waitq); } @@ -1060,8 +1081,10 @@ static int ptlrpc_console_allow(struct ptlrpc_request *req) LASSERT(req->rq_reqmsg != NULL); opc = lustre_msg_get_opc(req->rq_reqmsg); - /* Suppress particular reconnect errors which are to be expected. No - * errors are suppressed for the initial connection on an import */ + /* + * Suppress particular reconnect errors which are to be expected. No + * errors are suppressed for the initial connection on an import + */ if ((lustre_handle_is_used(&req->rq_import->imp_remote_handle)) && (opc == OST_CONNECT || opc == MDS_CONNECT || opc == MGS_CONNECT)) { @@ -1156,10 +1179,11 @@ static int after_reply(struct ptlrpc_request *req) } sptlrpc_cli_free_repbuf(req); - /* Pass the required reply buffer size (include - * space for early reply). - * NB: no need to roundup because alloc_repbuf - * will roundup it */ + /* + * Pass the required reply buffer size (include space for early + * reply). NB: no need to round up because alloc_repbuf will + * round it up + */ req->rq_replen = req->rq_nob_received; req->rq_nob_received = 0; spin_lock(&req->rq_lock); @@ -1178,9 +1202,7 @@ static int after_reply(struct ptlrpc_request *req) return rc; } - /* - * Security layer unwrap might ask resend this request. - */ + /* Security layer unwrap might ask resend this request. */ if (req->rq_resend) return 0; @@ -1201,18 +1223,19 @@ static int after_reply(struct ptlrpc_request *req) /* allocate new xid to avoid reply reconstruction */ if (!req->rq_bulk) { - /* new xid is already allocated for bulk in - * ptlrpc_check_set() */ + /* new xid is already allocated for bulk in ptlrpc_check_set() */ req->rq_xid = ptlrpc_next_xid(); DEBUG_REQ(D_RPCTRACE, req, "Allocating new xid for resend on EINPROGRESS"); } /* Readjust the timeout for current conditions */ ptlrpc_at_set_req_timeout(req); - /* delay resend to give a chance to the server to get ready. + /* + * delay resend to give a chance to the server to get ready. * The delay is increased by 1s on every resend and is capped to * the current request timeout (i.e. obd_timeout if AT is off, - * or AT service time x 125% + 5s, see at_est2timeout) */ + * or AT service time x 125% + 5s, see at_est2timeout) + */ if (req->rq_nr_resend > req->rq_timeout) req->rq_sent = now + req->rq_timeout; else @@ -1268,9 +1291,7 @@ static int after_reply(struct ptlrpc_request *req) ldlm_cli_update_pool(req); } - /* - * Store transno in reqmsg for replay. - */ + /* Store transno in reqmsg for replay. */ if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)) { req->rq_transno = lustre_msg_get_transno(req->rq_repmsg); lustre_msg_set_transno(req->rq_reqmsg, req->rq_transno); @@ -1286,22 +1307,22 @@ static int after_reply(struct ptlrpc_request *req) (req->rq_transno > lustre_msg_get_last_committed(req->rq_repmsg) || req->rq_replay)) { - /** version recovery */ + /* version recovery */ ptlrpc_save_versions(req); ptlrpc_retain_replayable_request(req, imp); } else if (req->rq_commit_cb != NULL && list_empty(&req->rq_replay_list)) { - /* NB: don't call rq_commit_cb if it's already on + /* + * NB: don't call rq_commit_cb if it's already on * rq_replay_list, ptlrpc_free_committed() will call - * it later, see LU-3618 for details */ + * it later, see LU-3618 for details + */ spin_unlock(&imp->imp_lock); req->rq_commit_cb(req); spin_lock(&imp->imp_lock); } - /* - * Replay-enabled imports return commit-status information. - */ + /* Replay-enabled imports return commit-status information. */ if (lustre_msg_get_last_committed(req->rq_repmsg)) { imp->imp_peer_committed_transno = lustre_msg_get_last_committed(req->rq_repmsg); @@ -1420,8 +1441,10 @@ static inline int ptlrpc_set_producer(struct ptlrpc_request_set *set) remaining = atomic_read(&set->set_remaining); - /* populate the ->set_requests list with requests until we - * reach the maximum number of RPCs in flight for this set */ + /* + * populate the ->set_requests list with requests until we + * reach the maximum number of RPCs in flight for this set + */ while (atomic_read(&set->set_remaining) < set->set_max_inflight) { rc = set->set_producer(set, set->set_producer_arg); if (rc == -ENOENT) { @@ -1461,7 +1484,8 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) int unregistered = 0; int rc = 0; - /* This schedule point is mainly for the ptlrpcd caller of this + /* + * This schedule point is mainly for the ptlrpcd caller of this * function. Most ptlrpc sets are not long-lived and unbounded * in length, but at the least the set used by the ptlrpcd is. * Since the processing time is unbounded, we need to insert an @@ -1520,8 +1544,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) OBD_FAIL_ONCE); } - /* - * Move to next phase if reply was successfully + /* Move to next phase if reply was successfully * unlinked. */ ptlrpc_rqphase_move(req, req->rq_next_phase); @@ -1535,15 +1558,11 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) if (req->rq_phase == RQ_PHASE_INTERPRET) goto interpret; - /* - * Note that this also will start async reply unlink. - */ + /* Note that this also will start async reply unlink. */ if (req->rq_net_err && !req->rq_timedout) { ptlrpc_expire_one_request(req, 1); - /* - * Check if we still need to wait for unlink. - */ + /* Check if we still need to wait for unlink. */ if (ptlrpc_client_recv_or_unlink(req) || ptlrpc_client_bulk_active(req)) continue; @@ -1568,7 +1587,8 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) goto interpret; } - /* ptlrpc_set_wait->l_wait_event sets lwi_allow_intr + /* + * ptlrpc_set_wait->l_wait_event sets lwi_allow_intr * so it sets rq_intr regardless of individual rpc * timeouts. The synchronous IO waiting path sets * rq_intr irrespective of whether ptlrpcd @@ -1595,8 +1615,10 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) spin_lock(&imp->imp_lock); if (ptlrpc_import_delay_req(imp, req, &status)) { - /* put on delay list - only if we wait - * recovery finished - before send */ + /* + * put on delay list - only if we wait + * recovery finished - before send + */ list_del_init(&req->rq_list); list_add_tail(&req->rq_list, &imp-> @@ -1632,8 +1654,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) spin_unlock(&req->rq_lock); if (req->rq_timedout || req->rq_resend) { - /* This is re-sending anyways, - * let's mark req as resend. */ + /* This is re-sending anyway, let's mark req as resend. */ spin_lock(&req->rq_lock); req->rq_resend = 1; spin_unlock(&req->rq_lock); @@ -1711,8 +1732,10 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) spin_unlock(&req->rq_lock); - /* unlink from net because we are going to - * swab in-place of reply buffer */ + /* + * unlink from net because we are going to + * swab in-place of reply buffer + */ unregistered = ptlrpc_unregister_reply(req, 1); if (!unregistered) continue; @@ -1721,7 +1744,8 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) if (req->rq_resend) continue; - /* If there is no bulk associated with this request, + /* + * If there is no bulk associated with this request, * then we're done and should let the interpreter * process the reply. Similarly if the RPC returned * an error, and therefore the bulk will never arrive. @@ -1739,10 +1763,12 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) continue; if (req->rq_bulk->bd_failure) { - /* The RPC reply arrived OK, but the bulk screwed + /* + * The RPC reply arrived OK, but the bulk screwed * up! Dead weird since the server told us the RPC * was good after getting the REPLY for her GET or - * the ACK for her PUT. */ + * the ACK for her PUT. + */ DEBUG_REQ(D_ERROR, req, "bulk transfer failed"); req->rq_status = -EIO; } @@ -1752,8 +1778,10 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) interpret: LASSERT(req->rq_phase == RQ_PHASE_INTERPRET); - /* This moves to "unregistering" phase we need to wait for - * reply unlink. */ + /* + * This moves to "unregistering" phase we need to wait for + * reply unlink. + */ if (!unregistered && !ptlrpc_unregister_reply(req, 1)) { /* start async bulk unlink too */ ptlrpc_unregister_bulk(req, 1); @@ -1763,8 +1791,7 @@ interpret: if (!ptlrpc_unregister_bulk(req, 1)) continue; - /* When calling interpret receiving already should be - * finished. */ + /* When calling interpret receive should already be finished. */ LASSERT(!req->rq_receiving_reply); ptlrpc_req_interpret(env, req, req->rq_status); @@ -1783,10 +1810,12 @@ interpret: lustre_msg_get_opc(req->rq_reqmsg)); spin_lock(&imp->imp_lock); - /* Request already may be not on sending or delaying list. This + /* + * Request already may be not on sending or delaying list. This * may happen in the case of marking it erroneous for the case * ptlrpc_import_delay_req(req, status) find it impossible to - * allow sending this rpc and returns *status != 0. */ + * allow sending this rpc and returns *status != 0. + */ if (!list_empty(&req->rq_list)) { list_del_init(&req->rq_list); atomic_dec(&imp->imp_inflight); @@ -1801,8 +1830,10 @@ interpret: if (ptlrpc_set_producer(set) > 0) force_timer_recalc = 1; - /* free the request that has just been completed - * in order not to pollute set->set_requests */ + /* + * free the request that has just been completed + * in order not to pollute set->set_requests + */ list_del_init(&req->rq_set_chain); spin_lock(&req->rq_lock); req->rq_set = NULL; @@ -1818,8 +1849,10 @@ interpret: } } - /* move completed request at the head of list so it's easier for - * caller to find them */ + /* + * move completed request at the head of list so it's easier for + * caller to find them + */ list_splice(&comp_reqs, &set->set_requests); /* If we hit an error, we want to recover promptly. */ @@ -1869,8 +1902,10 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink) if (imp->imp_dlm_fake) return 1; - /* If this request is for recovery or other primordial tasks, - * then error it out here. */ + /* + * If this request is for recovery or other primordial tasks, + * then error it out here. + */ if (req->rq_ctx_init || req->rq_ctx_fini || req->rq_send_state != LUSTRE_IMP_FULL || imp->imp_obd->obd_no_recov) { @@ -1884,8 +1919,10 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink) return 1; } - /* if a request can't be resent we can't wait for an answer after - the timeout */ + /* + * if a request can't be resent we can't wait for an answer after + * the timeout + */ if (ptlrpc_no_resend(req)) { DEBUG_REQ(D_RPCTRACE, req, "TIMEOUT-NORESEND:"); rc = 1; @@ -1909,9 +1946,7 @@ int ptlrpc_expired_set(void *data) LASSERT(set != NULL); - /* - * A timeout expired. See which reqs it applies to... - */ + /* A timeout expired. See which reqs it applies to... */ list_for_each(tmp, &set->set_requests) { struct ptlrpc_request *req = list_entry(tmp, struct ptlrpc_request, @@ -1931,8 +1966,10 @@ int ptlrpc_expired_set(void *data) req->rq_deadline > now) /* not expired */ continue; - /* Deal with this guy. Do it asynchronously to not block - * ptlrpcd thread. */ + /* + * Deal with this guy. Do it asynchronously to not block + * ptlrpcd thread. + */ ptlrpc_expire_one_request(req, 1); } @@ -1996,23 +2033,17 @@ int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set) list_for_each(tmp, &set->set_requests) { req = list_entry(tmp, struct ptlrpc_request, rq_set_chain); - /* - * Request in-flight? - */ + /* Request in-flight? */ if (!(((req->rq_phase == RQ_PHASE_RPC) && !req->rq_waiting) || (req->rq_phase == RQ_PHASE_BULK) || (req->rq_phase == RQ_PHASE_NEW))) continue; - /* - * Already timed out. - */ + /* Already timed out. */ if (req->rq_timedout) continue; - /* - * Waiting for ctx. - */ + /* Waiting for ctx. */ if (req->rq_wait_ctx) continue; @@ -2061,8 +2092,10 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set) do { timeout = ptlrpc_set_next_timeout(set); - /* wait until all complete, interrupted, or an in-flight - * req times out */ + /* + * wait until all complete, interrupted, or an in-flight + * req times out + */ CDEBUG(D_RPCTRACE, "set %p going to sleep for %d seconds\n", set, timeout); @@ -2087,18 +2120,22 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set) rc = l_wait_event(set->set_waitq, ptlrpc_check_set(NULL, set), &lwi); - /* LU-769 - if we ignored the signal because it was already + /* + * LU-769 - if we ignored the signal because it was already * pending when we started, we need to handle it now or we risk - * it being ignored forever */ + * it being ignored forever + */ if (rc == -ETIMEDOUT && !lwi.lwi_allow_intr && cfs_signal_pending()) { sigset_t blocked_sigs = cfs_block_sigsinv(LUSTRE_FATAL_SIGS); - /* In fact we only interrupt for the "fatal" signals + /* + * In fact we only interrupt for the "fatal" signals * like SIGINT or SIGKILL. We still ignore less * important signals since ptlrpc set is not easily - * reentrant from userspace again */ + * reentrant from userspace again + */ if (cfs_signal_pending()) ptlrpc_interrupted_set(set); cfs_restore_sigs(blocked_sigs); @@ -2106,13 +2143,15 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set) LASSERT(rc == 0 || rc == -EINTR || rc == -ETIMEDOUT); - /* -EINTR => all requests have been flagged rq_intr so next + /* + * -EINTR => all requests have been flagged rq_intr so next * check completes. * -ETIMEDOUT => someone timed out. When all reqs have * timed out, signals are enabled allowing completion with * EINTR. * I don't really care if we go once more round the loop in - * the error cases -eeb. */ + * the error cases -eeb. + */ if (rc == 0 && atomic_read(&set->set_remaining) == 0) { list_for_each(tmp, &set->set_requests) { req = list_entry(tmp, struct ptlrpc_request, @@ -2178,8 +2217,10 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked) req_capsule_fini(&request->rq_pill); - /* We must take it off the imp_replay_list first. Otherwise, we'll set - * request->rq_reqmsg to NULL while osc_close is dereferencing it. */ + /* + * We must take it off the imp_replay_list first. Otherwise, we'll set + * request->rq_reqmsg to NULL while osc_close is dereferencing it. + */ if (request->rq_import != NULL) { if (!locked) spin_lock(&request->rq_import->imp_lock); @@ -2280,40 +2321,28 @@ int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async) wait_queue_head_t *wq; struct l_wait_info lwi; - /* - * Might sleep. - */ + /* Might sleep. */ LASSERT(!in_interrupt()); - /* - * Let's setup deadline for reply unlink. - */ + /* Let's setup deadline for reply unlink. */ if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_REPL_UNLINK) && async && request->rq_reply_deadline == 0) request->rq_reply_deadline = ktime_get_real_seconds()+LONG_UNLINK; - /* - * Nothing left to do. - */ + /* Nothing left to do. */ if (!ptlrpc_client_recv_or_unlink(request)) return 1; LNetMDUnlink(request->rq_reply_md_h); - /* - * Let's check it once again. - */ + /* Let's check it once again. */ if (!ptlrpc_client_recv_or_unlink(request)) return 1; - /* - * Move to "Unregistering" phase as reply was not unlinked yet. - */ + /* Move to "Unregistering" phase as reply was not unlinked yet. */ ptlrpc_rqphase_move(request, RQ_PHASE_UNREGISTERING); - /* - * Do not wait for unlink to finish. - */ + /* Do not wait for unlink to finish. */ if (async) return 0; @@ -2328,8 +2357,10 @@ int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async) wq = &request->rq_reply_waitq; for (;;) { - /* Network access will complete in finite time but the HUGE - * timeout lets us CWARN for visibility of sluggish NALs */ + /* + * Network access will complete in finite time but the HUGE + * timeout lets us CWARN for visibility of sluggish NALs + */ lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(LONG_UNLINK), cfs_time_seconds(1), NULL, NULL); rc = l_wait_event(*wq, !ptlrpc_client_recv_or_unlink(request), @@ -2472,8 +2503,10 @@ void ptlrpc_resend_req(struct ptlrpc_request *req) DEBUG_REQ(D_HA, req, "going to resend"); spin_lock(&req->rq_lock); - /* Request got reply but linked to the import list still. - Let ptlrpc_check_set() to process it. */ + /* + * Request got reply but linked to the import list still. + * Let ptlrpc_check_set() to process it. + */ if (ptlrpc_client_replied(req)) { spin_unlock(&req->rq_lock); DEBUG_REQ(D_HA, req, "it has reply, so skip it"); @@ -2525,8 +2558,10 @@ void ptlrpc_retain_replayable_request(struct ptlrpc_request *req, LBUG(); } - /* clear this for new requests that were resent as well - as resent replayed requests. */ + /* + * clear this for new requests that were resent as well + * as resent replayed requests. + */ lustre_msg_clear_flags(req->rq_reqmsg, MSG_RESENT); /* don't re-add requests that have been replayed */ @@ -2543,7 +2578,8 @@ void ptlrpc_retain_replayable_request(struct ptlrpc_request *req, list_entry(tmp, struct ptlrpc_request, rq_replay_list); - /* We may have duplicate transnos if we create and then + /* + * We may have duplicate transnos if we create and then * open a file, or for closes retained if to match creating * opens, so use req->rq_xid as a secondary key. * (See bugs 684, 685, and 428.) @@ -2728,8 +2764,10 @@ int ptlrpc_replay_req(struct ptlrpc_request *req) /* Readjust the timeout for current conditions */ ptlrpc_at_set_req_timeout(req); - /* Tell server the net_latency, so the server can calculate how long - * it should wait for next replay */ + /* + * Tell server the net_latency, so the server can calculate how long + * it should wait for next replay + */ lustre_msg_set_service_time(req->rq_reqmsg, ptlrpc_at_get_net_latency(req)); DEBUG_REQ(D_HA, req, "REPLAY"); @@ -2749,13 +2787,15 @@ void ptlrpc_abort_inflight(struct obd_import *imp) { struct list_head *tmp, *n; - /* Make sure that no new requests get processed for this import. + /* + * Make sure that no new requests get processed for this import. * ptlrpc_{queue,set}_wait must (and does) hold imp_lock while testing * this flag and then putting requests on sending_list or delayed_list. */ spin_lock(&imp->imp_lock); - /* XXX locking? Maybe we should remove each request with the list + /* + * XXX locking? Maybe we should remove each request with the list * locked? Also, how do we know if the requests on the list are * being freed at this time? */ @@ -2789,8 +2829,10 @@ void ptlrpc_abort_inflight(struct obd_import *imp) spin_unlock(&req->rq_lock); } - /* Last chance to free reqs left on the replay list, but we - * will still leak reqs that haven't committed. */ + /* + * Last chance to free reqs left on the replay list, but we + * will still leak reqs that haven't committed. + */ if (imp->imp_replayable) ptlrpc_free_committed(imp); -- 2.4.3 From xose.vazquez at gmail.com Mon Oct 19 12:33:28 2015 From: xose.vazquez at gmail.com (Xose Vazquez Perez) Date: Mon, 19 Oct 2015 14:33:28 +0200 Subject: [lustre-devel] lustre: TODO updated? In-Reply-To: References: <561CF52C.2070806@gmail.com> Message-ID: <5624E318.2000302@gmail.com> On 10/15/2015 08:55 PM, Drokin, Oleg wrote: > Yes, it's still accurate from 10.000 ft view. > > If you need some more detailed ideas, here's my current list of stuff: > > getting rid of remaining lustre allocation macros: OBD_SLAB_ALLOC/FREE and friends much like we got rid of > OBD_ALLOC/FREE before. > I think LIBCFS_ALLOC/FREE and friends would need the same treatment. > > I bet there are other wrapping functions (from libcfs compat code and such) > that need to be removed. > > typedefs: we did remove some, there are more left that need to be taken care of. > > Coding style - we are much better now here and the work is ongoing by a lot of > other people. > > Function defines - need to be looked into. > > In addition, more involved ones: > > After that there are more laborous ones like figuring out how to fit into the > perf framework as one example. > > Also we need to rip remaining parts of server code that is still present greatly there > (one example - oti handle users are either server only or client only with dummy > handle - in echo code only. These could be greatly pruned. > Then we can cleanup all the obd method tables to remove now unused pointers and so on). Could you please reflect these things in TODO file ? -thanks- From oleg.drokin at intel.com Wed Oct 21 00:49:45 2015 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Wed, 21 Oct 2015 00:49:45 +0000 Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h In-Reply-To: References: <20151020220201.GA6065@lusbld01.us.cray.com> Message-ID: This is a throwback to the times when we patched client kernel with "raw operations". We no longer do, so the comment is only confusing now. On Oct 20, 2015, at 8:41 PM, Patrick Farrell wrote: > Do you know what the removed comment about being coherent with namei.h means or once meant? I took a look and can't see anything that corresponds now, but I'd feel more comfortable if I knew for sure what that comment meant... > > - Patrick > ________________________________________ > From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Ben Evans [bevans at cray.com] > Sent: Tuesday, October 20, 2015 5:02 PM > To: lustre-devel at lists.lustre.org > Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h > > Put IT_* definitions into an enum, as they're sent over the wire, > adjust calls, print statements, etc. to use the new enum. > > Signed-off-by: Ben Evans > --- > .../lustre/lustre/include/lustre/lustre_idl.h | 18 ++++++++++++++++++ > drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- > drivers/staging/lustre/lustre/include/obd.h | 16 ---------------- > drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- > 4 files changed, 20 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h > index ac78dbc..646c095 100644 > --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h > +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h > @@ -2782,6 +2782,24 @@ union ldlm_gl_desc { > > void lustre_swab_gl_desc(union ldlm_gl_desc *); > > +enum ldlm_intent_flags { > + IT_OPEN = 0x00000001, > + IT_CREAT = 0x00000002, > + IT_OPEN_CREAT = 0x00000003, > + IT_READDIR = 0x00000004, > + IT_GETATTR = 0x00000008, > + IT_LOOKUP = 0x00000010, > + IT_UNLINK = 0x00000020, > + IT_TRUNC = 0x00000040, > + IT_GETXATTR = 0x00000080, > + IT_EXEC = 0x00000100, > + IT_PIN = 0x00000200, > + IT_LAYOUT = 0x00000400, > + IT_QUOTA_DQACQ = 0x00000800, > + IT_QUOTA_CONN = 0x00001000, > + IT_SETXATTR = 0x00002000, > +}; > + > struct ldlm_intent { > __u64 opc; > }; > diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h > index 3552546..af46f36 100644 > --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h > +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h > @@ -1017,7 +1017,7 @@ extern struct obd_ops ldlm_obd_ops; > > extern char *ldlm_lockname[]; > extern char *ldlm_typename[]; > -char *ldlm_it2str(int it); > +const char *ldlm_it2str(enum ldlm_intent_flags it); > > /** > * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG. > diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h > index 9ad8c26..f731f51 100644 > --- a/drivers/staging/lustre/lustre/include/obd.h > +++ b/drivers/staging/lustre/lustre/include/obd.h > @@ -995,22 +995,6 @@ enum obd_cleanup_stage { > > struct lu_context; > > -/* /!\ must be coherent with include/linux/namei.h on patched kernel */ > -#define IT_OPEN (1 << 0) > -#define IT_CREAT (1 << 1) > -#define IT_READDIR (1 << 2) > -#define IT_GETATTR (1 << 3) > -#define IT_LOOKUP (1 << 4) > -#define IT_UNLINK (1 << 5) > -#define IT_TRUNC (1 << 6) > -#define IT_GETXATTR (1 << 7) > -#define IT_EXEC (1 << 8) > -#define IT_PIN (1 << 9) > -#define IT_LAYOUT (1 << 10) > -#define IT_QUOTA_DQACQ (1 << 11) > -#define IT_QUOTA_CONN (1 << 12) > -#define IT_SETXATTR (1 << 13) > - > static inline int it_to_lock_mode(struct lookup_intent *it) > { > /* CREAT needs to be tested before open (both could be set) */ > diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > index cd340fc..f3b197a 100644 > --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > @@ -123,7 +123,7 @@ void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type, > convert(wpolicy, lpolicy); > } > > -char *ldlm_it2str(int it) > +const char *ldlm_it2str(enum ldlm_intent_flags it) > { > switch (it) { > case IT_OPEN: > -- > 1.6.5.6 > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From bevans at cray.com Wed Oct 21 13:37:52 2015 From: bevans at cray.com (Ben Evans) Date: Wed, 21 Oct 2015 13:37:52 +0000 Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h In-Reply-To: References: <20151020220201.GA6065@lusbld01.us.cray.com> Message-ID: Yep, see the discussion here: http://review.whamcloud.com/#/c/16228/ On 10/20/15, 8:41 PM, "Patrick Farrell" wrote: >Do you know what the removed comment about being coherent with namei.h >means or once meant? I took a look and can't see anything that >corresponds now, but I'd feel more comfortable if I knew for sure what >that comment meant... > >- Patrick >________________________________________ >From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of >Ben Evans [bevans at cray.com] >Sent: Tuesday, October 20, 2015 5:02 PM >To: lustre-devel at lists.lustre.org >Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to > lustre_idl.h > >Put IT_* definitions into an enum, as they're sent over the wire, >adjust calls, print statements, etc. to use the new enum. > >Signed-off-by: Ben Evans >--- > .../lustre/lustre/include/lustre/lustre_idl.h | 18 >++++++++++++++++++ > drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- > drivers/staging/lustre/lustre/include/obd.h | 16 >---------------- > drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- > 4 files changed, 20 insertions(+), 18 deletions(-) > >diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >index ac78dbc..646c095 100644 >--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >@@ -2782,6 +2782,24 @@ union ldlm_gl_desc { > > void lustre_swab_gl_desc(union ldlm_gl_desc *); > >+enum ldlm_intent_flags { >+ IT_OPEN = 0x00000001, >+ IT_CREAT = 0x00000002, >+ IT_OPEN_CREAT = 0x00000003, >+ IT_READDIR = 0x00000004, >+ IT_GETATTR = 0x00000008, >+ IT_LOOKUP = 0x00000010, >+ IT_UNLINK = 0x00000020, >+ IT_TRUNC = 0x00000040, >+ IT_GETXATTR = 0x00000080, >+ IT_EXEC = 0x00000100, >+ IT_PIN = 0x00000200, >+ IT_LAYOUT = 0x00000400, >+ IT_QUOTA_DQACQ = 0x00000800, >+ IT_QUOTA_CONN = 0x00001000, >+ IT_SETXATTR = 0x00002000, >+}; >+ > struct ldlm_intent { > __u64 opc; > }; >diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h >b/drivers/staging/lustre/lustre/include/lustre_dlm.h >index 3552546..af46f36 100644 >--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h >+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h >@@ -1017,7 +1017,7 @@ extern struct obd_ops ldlm_obd_ops; > > extern char *ldlm_lockname[]; > extern char *ldlm_typename[]; >-char *ldlm_it2str(int it); >+const char *ldlm_it2str(enum ldlm_intent_flags it); > > /** > * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG. >diff --git a/drivers/staging/lustre/lustre/include/obd.h >b/drivers/staging/lustre/lustre/include/obd.h >index 9ad8c26..f731f51 100644 >--- a/drivers/staging/lustre/lustre/include/obd.h >+++ b/drivers/staging/lustre/lustre/include/obd.h >@@ -995,22 +995,6 @@ enum obd_cleanup_stage { > > struct lu_context; > >-/* /!\ must be coherent with include/linux/namei.h on patched kernel */ >-#define IT_OPEN (1 << 0) >-#define IT_CREAT (1 << 1) >-#define IT_READDIR (1 << 2) >-#define IT_GETATTR (1 << 3) >-#define IT_LOOKUP (1 << 4) >-#define IT_UNLINK (1 << 5) >-#define IT_TRUNC (1 << 6) >-#define IT_GETXATTR (1 << 7) >-#define IT_EXEC (1 << 8) >-#define IT_PIN (1 << 9) >-#define IT_LAYOUT (1 << 10) >-#define IT_QUOTA_DQACQ (1 << 11) >-#define IT_QUOTA_CONN (1 << 12) >-#define IT_SETXATTR (1 << 13) >- > static inline int it_to_lock_mode(struct lookup_intent *it) > { > /* CREAT needs to be tested before open (both could be set) */ >diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >index cd340fc..f3b197a 100644 >--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >@@ -123,7 +123,7 @@ void ldlm_convert_policy_to_local(struct obd_export >*exp, ldlm_type_t type, > convert(wpolicy, lpolicy); > } > >-char *ldlm_it2str(int it) >+const char *ldlm_it2str(enum ldlm_intent_flags it) > { > switch (it) { > case IT_OPEN: >-- >1.6.5.6 > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From paf at cray.com Wed Oct 21 13:42:18 2015 From: paf at cray.com (Patrick Farrell) Date: Wed, 21 Oct 2015 13:42:18 +0000 Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h In-Reply-To: References: <20151020220201.GA6065@lusbld01.us.cray.com> , Message-ID: Ah, OK. Thank you, Ben, Oleg. ________________________________________ From: Ben Evans Sent: Wednesday, October 21, 2015 8:37 AM To: Patrick Farrell; Ben Evans; lustre-devel at lists.lustre.org Subject: Re: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h Yep, see the discussion here: http://review.whamcloud.com/#/c/16228/ On 10/20/15, 8:41 PM, "Patrick Farrell" wrote: >Do you know what the removed comment about being coherent with namei.h >means or once meant? I took a look and can't see anything that >corresponds now, but I'd feel more comfortable if I knew for sure what >that comment meant... > >- Patrick >________________________________________ >From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of >Ben Evans [bevans at cray.com] >Sent: Tuesday, October 20, 2015 5:02 PM >To: lustre-devel at lists.lustre.org >Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to > lustre_idl.h > >Put IT_* definitions into an enum, as they're sent over the wire, >adjust calls, print statements, etc. to use the new enum. > >Signed-off-by: Ben Evans >--- > .../lustre/lustre/include/lustre/lustre_idl.h | 18 >++++++++++++++++++ > drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- > drivers/staging/lustre/lustre/include/obd.h | 16 >---------------- > drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- > 4 files changed, 20 insertions(+), 18 deletions(-) > >diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >index ac78dbc..646c095 100644 >--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >@@ -2782,6 +2782,24 @@ union ldlm_gl_desc { > > void lustre_swab_gl_desc(union ldlm_gl_desc *); > >+enum ldlm_intent_flags { >+ IT_OPEN = 0x00000001, >+ IT_CREAT = 0x00000002, >+ IT_OPEN_CREAT = 0x00000003, >+ IT_READDIR = 0x00000004, >+ IT_GETATTR = 0x00000008, >+ IT_LOOKUP = 0x00000010, >+ IT_UNLINK = 0x00000020, >+ IT_TRUNC = 0x00000040, >+ IT_GETXATTR = 0x00000080, >+ IT_EXEC = 0x00000100, >+ IT_PIN = 0x00000200, >+ IT_LAYOUT = 0x00000400, >+ IT_QUOTA_DQACQ = 0x00000800, >+ IT_QUOTA_CONN = 0x00001000, >+ IT_SETXATTR = 0x00002000, >+}; >+ > struct ldlm_intent { > __u64 opc; > }; >diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h >b/drivers/staging/lustre/lustre/include/lustre_dlm.h >index 3552546..af46f36 100644 >--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h >+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h >@@ -1017,7 +1017,7 @@ extern struct obd_ops ldlm_obd_ops; > > extern char *ldlm_lockname[]; > extern char *ldlm_typename[]; >-char *ldlm_it2str(int it); >+const char *ldlm_it2str(enum ldlm_intent_flags it); > > /** > * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG. >diff --git a/drivers/staging/lustre/lustre/include/obd.h >b/drivers/staging/lustre/lustre/include/obd.h >index 9ad8c26..f731f51 100644 >--- a/drivers/staging/lustre/lustre/include/obd.h >+++ b/drivers/staging/lustre/lustre/include/obd.h >@@ -995,22 +995,6 @@ enum obd_cleanup_stage { > > struct lu_context; > >-/* /!\ must be coherent with include/linux/namei.h on patched kernel */ >-#define IT_OPEN (1 << 0) >-#define IT_CREAT (1 << 1) >-#define IT_READDIR (1 << 2) >-#define IT_GETATTR (1 << 3) >-#define IT_LOOKUP (1 << 4) >-#define IT_UNLINK (1 << 5) >-#define IT_TRUNC (1 << 6) >-#define IT_GETXATTR (1 << 7) >-#define IT_EXEC (1 << 8) >-#define IT_PIN (1 << 9) >-#define IT_LAYOUT (1 << 10) >-#define IT_QUOTA_DQACQ (1 << 11) >-#define IT_QUOTA_CONN (1 << 12) >-#define IT_SETXATTR (1 << 13) >- > static inline int it_to_lock_mode(struct lookup_intent *it) > { > /* CREAT needs to be tested before open (both could be set) */ >diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >index cd340fc..f3b197a 100644 >--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >@@ -123,7 +123,7 @@ void ldlm_convert_policy_to_local(struct obd_export >*exp, ldlm_type_t type, > convert(wpolicy, lpolicy); > } > >-char *ldlm_it2str(int it) >+const char *ldlm_it2str(enum ldlm_intent_flags it) > { > switch (it) { > case IT_OPEN: >-- >1.6.5.6 > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From andreas.dilger at intel.com Wed Oct 21 15:26:50 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 21 Oct 2015 15:26:50 +0000 Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h Message-ID: On 2015/10/20, 16:02, "lustre-devel on behalf of Ben Evans" wrote: >Put IT_* definitions into an enum, as they're sent over the wire, >adjust calls, print statements, etc. to use the new enum. > >Signed-off-by: Ben Evans When you push patches upstream, please include the review tags from the original patch: Reviewed-on: http://review.whamcloud.com/16228 Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin The "Tested-by:" and "Change-Id:" tags should be dropped. The Reviewed-on: tag allows readers to get more information about this patch and helps us track which patches have been upstreamed and which have not. The Reviewed-by: tag allows the upstream reviewer to see who has already approved the patch. Cheers, Andreas >--- > .../lustre/lustre/include/lustre/lustre_idl.h | 18 >++++++++++++++++++ > drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- > drivers/staging/lustre/lustre/include/obd.h | 16 >---------------- > drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- > 4 files changed, 20 insertions(+), 18 deletions(-) > >diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >index ac78dbc..646c095 100644 >--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h >@@ -2782,6 +2782,24 @@ union ldlm_gl_desc { > > void lustre_swab_gl_desc(union ldlm_gl_desc *); > >+enum ldlm_intent_flags { >+ IT_OPEN = 0x00000001, >+ IT_CREAT = 0x00000002, >+ IT_OPEN_CREAT = 0x00000003, >+ IT_READDIR = 0x00000004, >+ IT_GETATTR = 0x00000008, >+ IT_LOOKUP = 0x00000010, >+ IT_UNLINK = 0x00000020, >+ IT_TRUNC = 0x00000040, >+ IT_GETXATTR = 0x00000080, >+ IT_EXEC = 0x00000100, >+ IT_PIN = 0x00000200, >+ IT_LAYOUT = 0x00000400, >+ IT_QUOTA_DQACQ = 0x00000800, >+ IT_QUOTA_CONN = 0x00001000, >+ IT_SETXATTR = 0x00002000, >+}; >+ > struct ldlm_intent { > __u64 opc; > }; >diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h >b/drivers/staging/lustre/lustre/include/lustre_dlm.h >index 3552546..af46f36 100644 >--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h >+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h >@@ -1017,7 +1017,7 @@ extern struct obd_ops ldlm_obd_ops; > > extern char *ldlm_lockname[]; > extern char *ldlm_typename[]; >-char *ldlm_it2str(int it); >+const char *ldlm_it2str(enum ldlm_intent_flags it); > > /** > * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG. >diff --git a/drivers/staging/lustre/lustre/include/obd.h >b/drivers/staging/lustre/lustre/include/obd.h >index 9ad8c26..f731f51 100644 >--- a/drivers/staging/lustre/lustre/include/obd.h >+++ b/drivers/staging/lustre/lustre/include/obd.h >@@ -995,22 +995,6 @@ enum obd_cleanup_stage { > > struct lu_context; > >-/* /!\ must be coherent with include/linux/namei.h on patched kernel */ >-#define IT_OPEN (1 << 0) >-#define IT_CREAT (1 << 1) >-#define IT_READDIR (1 << 2) >-#define IT_GETATTR (1 << 3) >-#define IT_LOOKUP (1 << 4) >-#define IT_UNLINK (1 << 5) >-#define IT_TRUNC (1 << 6) >-#define IT_GETXATTR (1 << 7) >-#define IT_EXEC (1 << 8) >-#define IT_PIN (1 << 9) >-#define IT_LAYOUT (1 << 10) >-#define IT_QUOTA_DQACQ (1 << 11) >-#define IT_QUOTA_CONN (1 << 12) >-#define IT_SETXATTR (1 << 13) >- > static inline int it_to_lock_mode(struct lookup_intent *it) > { > /* CREAT needs to be tested before open (both could be set) */ >diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >index cd340fc..f3b197a 100644 >--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c >@@ -123,7 +123,7 @@ void ldlm_convert_policy_to_local(struct obd_export >*exp, ldlm_type_t type, > convert(wpolicy, lpolicy); > } > >-char *ldlm_it2str(int it) >+const char *ldlm_it2str(enum ldlm_intent_flags it) > { > switch (it) { > case IT_OPEN: >-- >1.6.5.6 > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From simmonsja at ornl.gov Wed Oct 21 15:34:55 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 21 Oct 2015 15:34:55 +0000 Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h In-Reply-To: References: Message-ID: <4ba96de035f147d08e5570a9ef523677@EXCHCS32.ornl.gov> >Put IT_* definitions into an enum, as they're sent over the wire, >adjust calls, print statements, etc. to use the new enum. > >Signed-off-by: Ben Evans >When you push patches upstream, please include the review tags from the >original patch: > >Reviewed-on: http://review.whamcloud.com/16228 Also please add this to your commit message: Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6746 >Reviewed-by: John L. Hammond >Reviewed-by: James Simmons >Reviewed-by: Oleg Drokin > > >The "Tested-by:" and "Change-Id:" tags should be dropped. > >The Reviewed-on: tag allows readers to get more information about this >patch and helps us track which patches have been upstreamed and which have >not. > >The Reviewed-by: tag allows the upstream reviewer to see who has already >approved the patch. From bevans at cray.com Wed Oct 21 17:43:16 2015 From: bevans at cray.com (Ben Evans) Date: Wed, 21 Oct 2015 12:43:16 -0500 Subject: [lustre-devel] [PATCH] staging/lustre: move IT_* definitions to lustre_idl.h Message-ID: <20151021174316.GA4383@lusbld01.us.cray.com> Put IT_* definitions into an enum, as they're sent over the wire, adjust calls, print statements, etc. to use the new enum. Signed-off-by: Ben Evans Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6746 Reviewed-on: http://review.whamcloud.com/16228 Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- .../lustre/lustre/include/lustre/lustre_idl.h | 18 ++++++++++++++++++ drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/obd.h | 16 ---------------- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index ac78dbc..646c095 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2782,6 +2782,24 @@ union ldlm_gl_desc { void lustre_swab_gl_desc(union ldlm_gl_desc *); +enum ldlm_intent_flags { + IT_OPEN = 0x00000001, + IT_CREAT = 0x00000002, + IT_OPEN_CREAT = 0x00000003, + IT_READDIR = 0x00000004, + IT_GETATTR = 0x00000008, + IT_LOOKUP = 0x00000010, + IT_UNLINK = 0x00000020, + IT_TRUNC = 0x00000040, + IT_GETXATTR = 0x00000080, + IT_EXEC = 0x00000100, + IT_PIN = 0x00000200, + IT_LAYOUT = 0x00000400, + IT_QUOTA_DQACQ = 0x00000800, + IT_QUOTA_CONN = 0x00001000, + IT_SETXATTR = 0x00002000, +}; + struct ldlm_intent { __u64 opc; }; diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 3552546..af46f36 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1017,7 +1017,7 @@ extern struct obd_ops ldlm_obd_ops; extern char *ldlm_lockname[]; extern char *ldlm_typename[]; -char *ldlm_it2str(int it); +const char *ldlm_it2str(enum ldlm_intent_flags it); /** * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG. diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 9ad8c26..f731f51 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -995,22 +995,6 @@ enum obd_cleanup_stage { struct lu_context; -/* /!\ must be coherent with include/linux/namei.h on patched kernel */ -#define IT_OPEN (1 << 0) -#define IT_CREAT (1 << 1) -#define IT_READDIR (1 << 2) -#define IT_GETATTR (1 << 3) -#define IT_LOOKUP (1 << 4) -#define IT_UNLINK (1 << 5) -#define IT_TRUNC (1 << 6) -#define IT_GETXATTR (1 << 7) -#define IT_EXEC (1 << 8) -#define IT_PIN (1 << 9) -#define IT_LAYOUT (1 << 10) -#define IT_QUOTA_DQACQ (1 << 11) -#define IT_QUOTA_CONN (1 << 12) -#define IT_SETXATTR (1 << 13) - static inline int it_to_lock_mode(struct lookup_intent *it) { /* CREAT needs to be tested before open (both could be set) */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index cd340fc..f3b197a 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -123,7 +123,7 @@ void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type, convert(wpolicy, lpolicy); } -char *ldlm_it2str(int it) +const char *ldlm_it2str(enum ldlm_intent_flags it) { switch (it) { case IT_OPEN: -- 1.6.5.6 From luisbg at osg.samsung.com Wed Oct 21 17:40:40 2015 From: luisbg at osg.samsung.com (Luis de Bethencourt) Date: Wed, 21 Oct 2015 18:40:40 +0100 Subject: [lustre-devel] [PATCH] staging: lustre: o2iblnd: fix misleading indentation Message-ID: <1445449240-30305-1-git-send-email-luisbg@osg.samsung.com> The code is correct, the indentation is misleading. Only the the return rc is part of the conditional statement if rc != 0. Fix a smatch warning: drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:2157 kiblnd_hdev_setup_mrs() warn: curly braces intended? Signed-off-by: Luis de Bethencourt --- Hi, This patch gives a warning in checkpatch.pl for the line: if (hdev->ibh_mrs == NULL) It would be cleaner if this was 'if (!hdev->ibh_mrs)' instead. I didn't fix this as well because the file has 41 instances of comparisons with NULL. I would be happy to do so in a patch in reply to this one if it would be good. Thanks, Luis .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index c2cc4e4..7c730e3 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2154,23 +2154,23 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) if (rc != 0) return rc; - LIBCFS_ALLOC(hdev->ibh_mrs, 1 * sizeof(*hdev->ibh_mrs)); - if (hdev->ibh_mrs == NULL) { - CERROR("Failed to allocate MRs table\n"); - return -ENOMEM; - } + LIBCFS_ALLOC(hdev->ibh_mrs, 1 * sizeof(*hdev->ibh_mrs)); + if (hdev->ibh_mrs == NULL) { + CERROR("Failed to allocate MRs table\n"); + return -ENOMEM; + } - hdev->ibh_mrs[0] = NULL; - hdev->ibh_nmrs = 1; + hdev->ibh_mrs[0] = NULL; + hdev->ibh_nmrs = 1; - mr = ib_get_dma_mr(hdev->ibh_pd, acflags); - if (IS_ERR(mr)) { - CERROR("Failed ib_get_dma_mr : %ld\n", PTR_ERR(mr)); - kiblnd_hdev_cleanup_mrs(hdev); - return PTR_ERR(mr); - } + mr = ib_get_dma_mr(hdev->ibh_pd, acflags); + if (IS_ERR(mr)) { + CERROR("Failed ib_get_dma_mr : %ld\n", PTR_ERR(mr)); + kiblnd_hdev_cleanup_mrs(hdev); + return PTR_ERR(mr); + } - hdev->ibh_mrs[0] = mr; + hdev->ibh_mrs[0] = mr; return 0; } -- 2.5.1 From jsimmons at infradead.org Thu Oct 22 01:52:39 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:39 -0400 Subject: [lustre-devel] [PATCH 01/11] staging: lustre: add a service that prints a nidlist In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-2-git-send-email-jsimmons@infradead.org> From: Gregoire Pichon The libcfs already provides services to parse a string into a nidlist and to match a nid into a nidlist. This patch implements a service that prints a nidlist into a buffer. This is required for instance to print the nosquash_nids parameter of the MDT procfs component. Additionally, this patch fixes a bug in return code of parse_addrange() routine, so that parsing of nids including a * character works fine ('*@elan' for instance). Signed-off-by: Gregoire Pichon Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1778 Reviewed-on: http://review.whamcloud.com/9221 Reviewed-by: Andreas Dilger Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_string.h | 2 + drivers/staging/lustre/include/linux/lnet/nidstr.h | 2 + .../staging/lustre/lustre/libcfs/libcfs_string.c | 71 +++++++++++- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 124 +++++++++++++++++++- 4 files changed, 193 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h index 478e958..d178e43 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h @@ -83,6 +83,8 @@ int cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res); int cfs_str2num_check(char *str, int nob, unsigned *num, unsigned min, unsigned max); int cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list); +int cfs_expr_list_print(char *buffer, int count, + struct cfs_expr_list *expr_list); int cfs_expr_list_values(struct cfs_expr_list *expr_list, int max, __u32 **values); static inline void diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index a627be9..082782b 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -69,7 +69,9 @@ int libcfs_str2anynid(lnet_nid_t *nid, const char *str); char *libcfs_id2str(lnet_process_id_t id); void cfs_free_nidlist(struct list_head *list); int cfs_parse_nidlist(char *str, int len, struct list_head *list); +int cfs_print_nidlist(char *buffer, int count, struct list_head *list); int cfs_match_nid(lnet_nid_t nid, struct list_head *list); + bool cfs_nidrange_is_contiguous(struct list_head *nidlist); void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, char *max_nid, size_t nidstr_length); diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index efe5e66..bbfef98 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -321,6 +321,73 @@ cfs_range_expr_parse(struct cfs_lstr *src, unsigned min, unsigned max, } /** + * Print the range expression \a re into specified \a buffer. + * If \a bracketed is true, expression does not need additional + * brackets. + * + * \retval number of characters written + */ +static int +cfs_range_expr_print(char *buffer, int count, struct cfs_range_expr *expr, + bool bracketed) +{ + int i; + char s[] = "["; + char e[] = "]"; + + if (bracketed) + s[0] = e[0] = '\0'; + + if (expr->re_lo == expr->re_hi) + i = scnprintf(buffer, count, "%u", expr->re_lo); + else if (expr->re_stride == 1) + i = scnprintf(buffer, count, "%s%u-%u%s", + s, expr->re_lo, expr->re_hi, e); + else + i = scnprintf(buffer, count, "%s%u-%u/%u%s", + s, expr->re_lo, expr->re_hi, + expr->re_stride, e); + return i; +} + +/** + * Print a list of range expressions (\a expr_list) into specified \a buffer. + * If the list contains several expressions, separate them with comma + * and surround the list with brackets. + * + * \retval number of characters written + */ +int +cfs_expr_list_print(char *buffer, int count, struct cfs_expr_list *expr_list) +{ + struct cfs_range_expr *expr; + int i = 0, j = 0; + int numexprs = 0; + + if (count <= 0) + return 0; + + list_for_each_entry(expr, &expr_list->el_exprs, re_link) + numexprs++; + + if (numexprs > 1) + i += scnprintf(buffer + i, count - i, "["); + + list_for_each_entry(expr, &expr_list->el_exprs, re_link) { + if (j++ != 0) + i += scnprintf(buffer + i, count - i, ","); + i += cfs_range_expr_print(buffer + i, count - i, expr, + numexprs > 1); + } + + if (numexprs > 1) + i += scnprintf(buffer + i, count - i, "]"); + + return i; +} +EXPORT_SYMBOL(cfs_expr_list_print); + +/** * Matches value (\a value) against ranges expression list \a expr_list. * * \retval 1 if \a value matches @@ -412,8 +479,8 @@ EXPORT_SYMBOL(cfs_expr_list_free); /** * Parses \ token of the syntax. * - * \retval 1 if \a str parses to \ | \ - * \retval 0 otherwise + * \retval 0 if \a str parses to \ | \ + * \retval -errno otherwise */ int cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max, diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c b/drivers/staging/lustre/lustre/libcfs/nidstrings.c index 087449f..a54594a 100644 --- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c +++ b/drivers/staging/lustre/lustre/libcfs/nidstrings.c @@ -114,6 +114,21 @@ static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) return 0; } +static int +libcfs_ip_addr_range_print(char *buffer, int count, struct list_head *list) +{ + int i = 0, j = 0; + struct cfs_expr_list *el; + + list_for_each_entry(el, list, el_link) { + LASSERT(j++ < 4); + if (i != 0) + i += scnprintf(buffer + i, count - i, "."); + i += cfs_expr_list_print(buffer + i, count - i, el); + } + return i; +} + static void libcfs_decnum_addr2str(__u32 addr, char *str) { snprintf(str, LNET_NIDSTR_SIZE, "%u", addr); @@ -164,6 +179,19 @@ libcfs_num_parse(char *str, int len, struct list_head *list) return rc; } +static int +libcfs_num_addr_range_print(char *buffer, int count, struct list_head *list) +{ + int i = 0, j = 0; + struct cfs_expr_list *el; + + list_for_each_entry(el, list, el_link) { + LASSERT(j++ < 1); + i += cfs_expr_list_print(buffer + i, count - i, el); + } + return i; +} + /* * Nf_match_addr method for networks using numeric addresses * @@ -189,6 +217,8 @@ struct netstrfns { int (*nf_str2addr)(const char *str, int nob, __u32 *addr); int (*nf_parse_addrlist)(char *str, int len, struct list_head *list); + int (*nf_print_addrlist)(char *buffer, int count, + struct list_head *list); int (*nf_match_addr)(__u32 addr, struct list_head *list); }; @@ -199,6 +229,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_decnum_addr2str, /* .nf_str2addr */ libcfs_lo_str2addr, /* .nf_parse_addr*/ libcfs_num_parse, + /* .nf_print_addrlist*/ libcfs_num_addr_range_print, /* .nf_match_addr*/ libcfs_num_match}, {/* .nf_type */ SOCKLND, /* .nf_name */ "tcp", @@ -206,6 +237,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_ip_addr2str, /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, + /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, /* .nf_match_addr*/ cfs_ip_addr_match}, {/* .nf_type */ O2IBLND, /* .nf_name */ "o2ib", @@ -213,6 +245,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_ip_addr2str, /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, + /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, /* .nf_match_addr*/ cfs_ip_addr_match}, {/* .nf_type */ CIBLND, /* .nf_name */ "cib", @@ -220,6 +253,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_ip_addr2str, /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, + /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, /* .nf_match_addr*/ cfs_ip_addr_match}, {/* .nf_type */ OPENIBLND, /* .nf_name */ "openib", @@ -227,6 +261,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_ip_addr2str, /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, + /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, /* .nf_match_addr*/ cfs_ip_addr_match}, {/* .nf_type */ IIBLND, /* .nf_name */ "iib", @@ -234,6 +269,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_ip_addr2str, /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, + /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, /* .nf_match_addr*/ cfs_ip_addr_match}, {/* .nf_type */ VIBLND, /* .nf_name */ "vib", @@ -241,6 +277,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_ip_addr2str, /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, + /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, /* .nf_match_addr*/ cfs_ip_addr_match}, {/* .nf_type */ RALND, /* .nf_name */ "ra", @@ -248,6 +285,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_ip_addr2str, /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, + /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, /* .nf_match_addr*/ cfs_ip_addr_match}, {/* .nf_type */ QSWLND, /* .nf_name */ "elan", @@ -255,6 +293,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_decnum_addr2str, /* .nf_str2addr */ libcfs_num_str2addr, /* .nf_parse_addrlist*/ libcfs_num_parse, + /* .nf_print_addrlist*/ libcfs_num_addr_range_print, /* .nf_match_addr*/ libcfs_num_match}, {/* .nf_type */ GMLND, /* .nf_name */ "gm", @@ -262,6 +301,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_hexnum_addr2str, /* .nf_str2addr */ libcfs_num_str2addr, /* .nf_parse_addrlist*/ libcfs_num_parse, + /* .nf_print_addrlist*/ libcfs_num_addr_range_print, /* .nf_match_addr*/ libcfs_num_match}, {/* .nf_type */ MXLND, /* .nf_name */ "mx", @@ -269,6 +309,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_ip_addr2str, /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, + /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, /* .nf_match_addr*/ cfs_ip_addr_match}, {/* .nf_type */ PTLLND, /* .nf_name */ "ptl", @@ -276,6 +317,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_decnum_addr2str, /* .nf_str2addr */ libcfs_num_str2addr, /* .nf_parse_addrlist*/ libcfs_num_parse, + /* .nf_print_addrlist*/ libcfs_num_addr_range_print, /* .nf_match_addr*/ libcfs_num_match}, {/* .nf_type */ GNILND, /* .nf_name */ "gni", @@ -283,6 +325,7 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_addr2str */ libcfs_decnum_addr2str, /* .nf_str2addr */ libcfs_num_str2addr, /* .nf_parse_addrlist*/ libcfs_num_parse, + /* .nf_print_addrlist*/ libcfs_num_addr_range_print, /* .nf_match_addr*/ libcfs_num_match}, /* placeholder for net0 alias. It MUST BE THE LAST ENTRY */ {/* .nf_type */ -1}, @@ -612,8 +655,8 @@ struct addrrange { * Allocates struct addrrange and links to \a nidrange via * (nidrange::nr_addrranges) * - * \retval 1 if \a src parses to '*' | \ | \ - * \retval 0 otherwise + * \retval 0 if \a src parses to '*' | \ | \ + * \retval -errno otherwise */ static int parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange) @@ -622,12 +665,12 @@ parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange) if (src->ls_len == 1 && src->ls_str[0] == '*') { nidrange->nr_all = 1; - return 1; + return 0; } LIBCFS_ALLOC(addrrange, sizeof(struct addrrange)); if (addrrange == NULL) - return 0; + return -ENOMEM; list_add_tail(&addrrange->ar_link, &nidrange->nr_addrranges); INIT_LIST_HEAD(&addrrange->ar_numaddr_ranges); @@ -840,3 +883,76 @@ int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist) return 0; } EXPORT_SYMBOL(cfs_match_nid); + +/** + * Print the network part of the nidrange \a nr into the specified \a buffer. + * + * \retval number of characters written + */ +static int +cfs_print_network(char *buffer, int count, struct nidrange *nr) +{ + struct netstrfns *nf = nr->nr_netstrfns; + + if (nr->nr_netnum == 0) + return scnprintf(buffer, count, "@%s", nf->nf_name); + else + return scnprintf(buffer, count, "@%s%u", + nf->nf_name, nr->nr_netnum); +} + +/** + * Print a list of addrrange (\a addrranges) into the specified \a buffer. + * At max \a count characters can be printed into \a buffer. + * + * \retval number of characters written + */ +static int +cfs_print_addrranges(char *buffer, int count, struct list_head *addrranges, + struct nidrange *nr) +{ + int i = 0; + struct addrrange *ar; + struct netstrfns *nf = nr->nr_netstrfns; + + list_for_each_entry(ar, addrranges, ar_link) { + if (i != 0) + i += scnprintf(buffer + i, count - i, " "); + i += nf->nf_print_addrlist(buffer + i, count - i, + &ar->ar_numaddr_ranges); + i += cfs_print_network(buffer + i, count - i, nr); + } + return i; +} + +/** + * Print a list of nidranges (\a nidlist) into the specified \a buffer. + * At max \a count characters can be printed into \a buffer. + * Nidranges are separated by a space character. + * + * \retval number of characters written + */ +int cfs_print_nidlist(char *buffer, int count, struct list_head *nidlist) +{ + int i = 0; + struct nidrange *nr; + + if (count <= 0) + return 0; + + list_for_each_entry(nr, nidlist, nr_link) { + if (i != 0) + i += scnprintf(buffer + i, count - i, " "); + + if (nr->nr_all != 0) { + LASSERT(list_empty(&nr->nr_addrranges)); + i += scnprintf(buffer + i, count - i, "*"); + i += cfs_print_network(buffer + i, count - i, nr); + } else { + i += cfs_print_addrranges(buffer + i, count - i, + &nr->nr_addrranges, nr); + } + } + return i; +} +EXPORT_SYMBOL(cfs_print_nidlist); -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:41 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:41 -0400 Subject: [lustre-devel] [PATCH 03/11] staging: lustre: remove libcfs_init_string function In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-4-git-send-email-jsimmons@infradead.org> All the function libcfs_init_string did was initialize a spinlock. We can initialize the spinlock statically instead. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 2 -- drivers/staging/lustre/lnet/lnet/nidstrings.c | 8 +------- drivers/staging/lustre/lustre/libcfs/module.c | 2 -- 3 files changed, 1 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 385ced1..4d74e8a 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -152,8 +152,6 @@ extern struct miscdevice libcfs_dev; extern char lnet_upcall[1024]; extern char lnet_debug_log_upcall[1024]; -extern void libcfs_init_nidstrings(void); - extern struct cfs_psdev_ops libcfs_psdev_ops; extern struct cfs_wi_sched *cfs_sched_rehash; diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index 81ec3a8..fdbdf06 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -61,13 +61,7 @@ static char libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE]; static int libcfs_nidstring_idx; -static spinlock_t libcfs_nidstring_lock; - -void libcfs_init_nidstrings(void) -{ - spin_lock_init(&libcfs_nidstring_lock); -} -EXPORT_SYMBOL(libcfs_init_nidstrings); +static DEFINE_SPINLOCK(libcfs_nidstring_lock); char * libcfs_next_nidstring(void) diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 0d9b223..50e8fd2 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -701,8 +701,6 @@ static int init_libcfs_module(void) { int rc; - libcfs_init_nidstrings(); - rc = libcfs_debug_init(5 * 1024 * 1024); if (rc < 0) { pr_err("LustreError: libcfs_debug_init: %d\n", rc); -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:49 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:49 -0400 Subject: [lustre-devel] [PATCH 11/11] staging: lustre: Use C99 initializers for struct netstrfns In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-12-git-send-email-jsimmons@infradead.org> Update struct netstrfns to use C99 initializers. Remove old LND types from the netstrfns table, as they are long obsolete and shouldn't be needed even for interop anymore. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6210 Reviewed-on: http://review.whamcloud.com/15088 Reviewed-by: frank zago Reviewed-by: Andreas Dilger --- drivers/staging/lustre/lnet/lnet/nidstrings.c | 188 +++++++------------------ 1 files changed, 51 insertions(+), 137 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index a5cd0ae..80f585a 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -893,12 +893,6 @@ libcfs_decnum_addr2str(__u32 addr, char *str, size_t size) snprintf(str, size, "%u", addr); } -static void -libcfs_hexnum_addr2str(__u32 addr, char *str, size_t size) -{ - snprintf(str, size, "0x%x", addr); -} - static int libcfs_num_str2addr(const char *str, int nob, __u32 *addr) { @@ -970,137 +964,57 @@ libcfs_num_match(__u32 addr, struct list_head *numaddr) return cfs_expr_list_match(addr, el); } -static struct netstrfns libcfs_netstrfns[] = { - {/* .nf_type */ LOLND, - /* .nf_name */ "lo", - /* .nf_modname */ "klolnd", - /* .nf_addr2str */ libcfs_decnum_addr2str, - /* .nf_str2addr */ libcfs_lo_str2addr, - /* .nf_parse_addr*/ libcfs_num_parse, - /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match, - /* .nf_is_contiguous */ cfs_num_is_contiguous, - /* .nf_min_max */ cfs_num_min_max}, - {/* .nf_type */ SOCKLND, - /* .nf_name */ "tcp", - /* .nf_modname */ "ksocklnd", - /* .nf_addr2str */ libcfs_ip_addr2str, - /* .nf_str2addr */ libcfs_ip_str2addr, - /* .nf_parse_addrlist*/ cfs_ip_addr_parse, - /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match, - /* .nf_is_contiguous */ cfs_ip_is_contiguous, - /* .nf_min_max */ cfs_ip_min_max}, - {/* .nf_type */ O2IBLND, - /* .nf_name */ "o2ib", - /* .nf_modname */ "ko2iblnd", - /* .nf_addr2str */ libcfs_ip_addr2str, - /* .nf_str2addr */ libcfs_ip_str2addr, - /* .nf_parse_addrlist*/ cfs_ip_addr_parse, - /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match, - /* .nf_is_contiguous */ cfs_ip_is_contiguous, - /* .nf_min_max */ cfs_ip_min_max}, - {/* .nf_type */ CIBLND, - /* .nf_name */ "cib", - /* .nf_modname */ "kciblnd", - /* .nf_addr2str */ libcfs_ip_addr2str, - /* .nf_str2addr */ libcfs_ip_str2addr, - /* .nf_parse_addrlist*/ cfs_ip_addr_parse, - /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match, - /* .nf_is_contiguous */ cfs_ip_is_contiguous, - /* .nf_min_max */ cfs_ip_min_max}, - {/* .nf_type */ OPENIBLND, - /* .nf_name */ "openib", - /* .nf_modname */ "kopeniblnd", - /* .nf_addr2str */ libcfs_ip_addr2str, - /* .nf_str2addr */ libcfs_ip_str2addr, - /* .nf_parse_addrlist*/ cfs_ip_addr_parse, - /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match, - /* .nf_is_contiguous */ cfs_ip_is_contiguous, - /* .nf_min_max */ cfs_ip_min_max}, - {/* .nf_type */ IIBLND, - /* .nf_name */ "iib", - /* .nf_modname */ "kiiblnd", - /* .nf_addr2str */ libcfs_ip_addr2str, - /* .nf_str2addr */ libcfs_ip_str2addr, - /* .nf_parse_addrlist*/ cfs_ip_addr_parse, - /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match, - /* .nf_is_contiguous */ cfs_ip_is_contiguous, - /* .nf_min_max */ cfs_ip_min_max}, - {/* .nf_type */ VIBLND, - /* .nf_name */ "vib", - /* .nf_modname */ "kviblnd", - /* .nf_addr2str */ libcfs_ip_addr2str, - /* .nf_str2addr */ libcfs_ip_str2addr, - /* .nf_parse_addrlist*/ cfs_ip_addr_parse, - /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match, - /* .nf_is_contiguous */ cfs_ip_is_contiguous, - /* .nf_min_max */ cfs_ip_min_max}, - {/* .nf_type */ RALND, - /* .nf_name */ "ra", - /* .nf_modname */ "kralnd", - /* .nf_addr2str */ libcfs_ip_addr2str, - /* .nf_str2addr */ libcfs_ip_str2addr, - /* .nf_parse_addrlist*/ cfs_ip_addr_parse, - /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match, - /* .nf_is_contiguous */ cfs_ip_is_contiguous, - /* .nf_min_max */ cfs_ip_min_max}, - {/* .nf_type */ QSWLND, - /* .nf_name */ "elan", - /* .nf_modname */ "kqswlnd", - /* .nf_addr2str */ libcfs_decnum_addr2str, - /* .nf_str2addr */ libcfs_num_str2addr, - /* .nf_parse_addrlist*/ libcfs_num_parse, - /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match, - /* .nf_is_contiguous */ cfs_num_is_contiguous, - /* .nf_min_max */ cfs_num_min_max}, - {/* .nf_type */ GMLND, - /* .nf_name */ "gm", - /* .nf_modname */ "kgmlnd", - /* .nf_addr2str */ libcfs_hexnum_addr2str, - /* .nf_str2addr */ libcfs_num_str2addr, - /* .nf_parse_addrlist*/ libcfs_num_parse, - /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match, - /* .nf_is_contiguous */ cfs_num_is_contiguous, - /* .nf_min_max */ cfs_num_min_max}, - {/* .nf_type */ MXLND, - /* .nf_name */ "mx", - /* .nf_modname */ "kmxlnd", - /* .nf_addr2str */ libcfs_ip_addr2str, - /* .nf_str2addr */ libcfs_ip_str2addr, - /* .nf_parse_addrlist*/ cfs_ip_addr_parse, - /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match, - /* .nf_is_contiguous */ cfs_ip_is_contiguous, - /* .nf_min_max */ cfs_ip_min_max}, - {/* .nf_type */ PTLLND, - /* .nf_name */ "ptl", - /* .nf_modname */ "kptllnd", - /* .nf_addr2str */ libcfs_decnum_addr2str, - /* .nf_str2addr */ libcfs_num_str2addr, - /* .nf_parse_addrlist*/ libcfs_num_parse, - /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match, - /* .nf_is_contiguous */ cfs_num_is_contiguous, - /* .nf_min_max */ cfs_num_min_max}, - {/* .nf_type */ GNILND, - /* .nf_name */ "gni", - /* .nf_modname */ "kgnilnd", - /* .nf_addr2str */ libcfs_decnum_addr2str, - /* .nf_str2addr */ libcfs_num_str2addr, - /* .nf_parse_addrlist*/ libcfs_num_parse, - /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match, - /* .nf_is_contiguous */ cfs_num_is_contiguous, - /* .nf_min_max */ cfs_num_min_max}, +static struct netstrfns libcfs_netstrfns[] = { + { .nf_type = LOLND, + .nf_name = "lo", + .nf_modname = "klolnd", + .nf_addr2str = libcfs_decnum_addr2str, + .nf_str2addr = libcfs_lo_str2addr, + .nf_parse_addrlist = libcfs_num_parse, + .nf_print_addrlist = libcfs_num_addr_range_print, + .nf_match_addr = libcfs_num_match, + .nf_is_contiguous = cfs_num_is_contiguous, + .nf_min_max = cfs_num_min_max }, + { .nf_type = SOCKLND, + .nf_name = "tcp", + .nf_modname = "ksocklnd", + .nf_addr2str = libcfs_ip_addr2str, + .nf_str2addr = libcfs_ip_str2addr, + .nf_parse_addrlist = cfs_ip_addr_parse, + .nf_print_addrlist = libcfs_ip_addr_range_print, + .nf_match_addr = cfs_ip_addr_match, + .nf_is_contiguous = cfs_ip_is_contiguous, + .nf_min_max = cfs_ip_min_max }, + { .nf_type = O2IBLND, + .nf_name = "o2ib", + .nf_modname = "ko2iblnd", + .nf_addr2str = libcfs_ip_addr2str, + .nf_str2addr = libcfs_ip_str2addr, + .nf_parse_addrlist = cfs_ip_addr_parse, + .nf_print_addrlist = libcfs_ip_addr_range_print, + .nf_match_addr = cfs_ip_addr_match, + .nf_is_contiguous = cfs_ip_is_contiguous, + .nf_min_max = cfs_ip_min_max }, + { .nf_type = GNILND, + .nf_name = "gni", + .nf_modname = "kgnilnd", + .nf_addr2str = libcfs_decnum_addr2str, + .nf_str2addr = libcfs_num_str2addr, + .nf_parse_addrlist = libcfs_num_parse, + .nf_print_addrlist = libcfs_num_addr_range_print, + .nf_match_addr = libcfs_num_match, + .nf_is_contiguous = cfs_num_is_contiguous, + .nf_min_max = cfs_num_min_max }, + { .nf_type = GNIIPLND, + .nf_name = "gip", + .nf_modname = "kgnilnd", + .nf_addr2str = libcfs_ip_addr2str, + .nf_str2addr = libcfs_ip_str2addr, + .nf_parse_addrlist = cfs_ip_addr_parse, + .nf_print_addrlist = libcfs_ip_addr_range_print, + .nf_match_addr = cfs_ip_addr_match, + .nf_is_contiguous = cfs_ip_is_contiguous, + .nf_min_max = cfs_ip_min_max }, }; static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns); -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:46 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:46 -0400 Subject: [lustre-devel] [PATCH 08/11] staging: lustre: add in NID range management for libcfs In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-9-git-send-email-jsimmons@infradead.org> From: Joshua Walgenbach This is a partial backport of the NID range management added in for nodemap. We only backport the libcfs related parts here. Signed-off-by: Joshua Walgenbach Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3527 Reviewed-on: http://review.whamcloud.com/8057 Reviewed-by: Andreas Dilger Reviewed-by: Andrew Perepechko Reviewed-by: John L. Hammond Reviewed-by: Ken Hornstein --- drivers/staging/lustre/include/linux/lnet/nidstr.h | 3 + drivers/staging/lustre/lnet/lnet/nidstrings.c | 365 +++++++++++++++++++- 2 files changed, 355 insertions(+), 13 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 1536366..4e7c9a5 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -89,6 +89,9 @@ struct netstrfns { int (*nf_print_addrlist)(char *buffer, int count, struct list_head *list); int (*nf_match_addr)(__u32 addr, struct list_head *list); + bool (*nf_is_contiguous)(struct list_head *nidlist); + void (*nf_min_max)(struct list_head *nidlist, __u32 *min_nid, + __u32 *max_nid); }; #endif /* _LNET_NIDSTRINGS_H */ diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index 1874dfe..4402b80 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -46,6 +46,8 @@ /* max value for numeric network address */ #define MAX_NUMERIC_VALUE 0xffffffff +#define IPSTRING_LENGTH 16 + /* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids * consistent in all conversion functions. Some code fragments are copied * around for the sake of clarity... @@ -456,6 +458,317 @@ int cfs_print_nidlist(char *buffer, int count, struct list_head *nidlist) } EXPORT_SYMBOL(cfs_print_nidlist); +/** + * Determines minimum and maximum addresses for a single + * numeric address range + * + * \param ar + * \param min_nid + * \param max_nid + */ +static void cfs_ip_ar_min_max(struct addrrange *ar, __u32 *min_nid, + __u32 *max_nid) +{ + struct cfs_expr_list *el; + struct cfs_range_expr *re; + __u32 tmp_ip_addr = 0; + unsigned int min_ip[4] = {0}; + unsigned int max_ip[4] = {0}; + int re_count = 0; + + list_for_each_entry(el, &ar->ar_numaddr_ranges, el_link) { + list_for_each_entry(re, &el->el_exprs, re_link) { + min_ip[re_count] = re->re_lo; + max_ip[re_count] = re->re_hi; + re_count++; + } + } + + tmp_ip_addr = ((min_ip[0] << 24) | (min_ip[1] << 16) | + (min_ip[2] << 8) | min_ip[3]); + + if (min_nid != NULL) + *min_nid = tmp_ip_addr; + + tmp_ip_addr = ((max_ip[0] << 24) | (max_ip[1] << 16) | + (max_ip[2] << 8) | max_ip[3]); + + if (max_nid != NULL) + *max_nid = tmp_ip_addr; +} + +/** + * Determines minimum and maximum addresses for a single + * numeric address range + * + * \param ar + * \param min_nid + * \param max_nid + */ +static void cfs_num_ar_min_max(struct addrrange *ar, __u32 *min_nid, + __u32 *max_nid) +{ + struct cfs_expr_list *el; + struct cfs_range_expr *re; + unsigned int min_addr = 0; + unsigned int max_addr = 0; + + list_for_each_entry(el, &ar->ar_numaddr_ranges, el_link) { + list_for_each_entry(re, &el->el_exprs, re_link) { + if (re->re_lo < min_addr || min_addr == 0) + min_addr = re->re_lo; + if (re->re_hi > max_addr) + max_addr = re->re_hi; + } + } + + if (min_nid != NULL) + *min_nid = min_addr; + if (max_nid != NULL) + *max_nid = max_addr; +} + +/** + * Determines whether an expression list in an nidrange contains exactly + * one contiguous address range. Calls the correct netstrfns for the LND + * + * \param *nidlist + * + * \retval true if contiguous + * \retval false if not contiguous + */ +bool cfs_nidrange_is_contiguous(struct list_head *nidlist) +{ + struct nidrange *nr; + struct netstrfns *nf = NULL; + char *lndname = NULL; + int netnum = -1; + + list_for_each_entry(nr, nidlist, nr_link) { + nf = nr->nr_netstrfns; + if (lndname == NULL) + lndname = nf->nf_name; + if (netnum == -1) + netnum = nr->nr_netnum; + + if (strcmp(lndname, nf->nf_name) != 0 || + netnum != nr->nr_netnum) + return false; + } + + if (nf == NULL) + return false; + + if (!nf->nf_is_contiguous(nidlist)) + return false; + + return true; +} +EXPORT_SYMBOL(cfs_nidrange_is_contiguous); + +/** + * Determines whether an expression list in an num nidrange contains exactly + * one contiguous address range. + * + * \param *nidlist + * + * \retval true if contiguous + * \retval false if not contiguous + */ +static bool cfs_num_is_contiguous(struct list_head *nidlist) +{ + struct nidrange *nr; + struct addrrange *ar; + struct cfs_expr_list *el; + struct cfs_range_expr *re; + int last_hi = 0; + __u32 last_end_nid = 0; + __u32 current_start_nid = 0; + __u32 current_end_nid = 0; + + list_for_each_entry(nr, nidlist, nr_link) { + list_for_each_entry(ar, &nr->nr_addrranges, ar_link) { + cfs_num_ar_min_max(ar, ¤t_start_nid, + ¤t_end_nid); + if (last_end_nid != 0 && + (current_start_nid - last_end_nid != 1)) + return false; + last_end_nid = current_end_nid; + list_for_each_entry(el, &ar->ar_numaddr_ranges, + el_link) { + list_for_each_entry(re, &el->el_exprs, + re_link) { + if (re->re_stride > 1) + return false; + else if (last_hi != 0 && + re->re_hi - last_hi != 1) + return false; + last_hi = re->re_hi; + } + } + } + } + + return true; +} + +/** + * Determines whether an expression list in an ip nidrange contains exactly + * one contiguous address range. + * + * \param *nidlist + * + * \retval true if contiguous + * \retval false if not contiguous + */ +static bool cfs_ip_is_contiguous(struct list_head *nidlist) +{ + struct nidrange *nr; + struct addrrange *ar; + struct cfs_expr_list *el; + struct cfs_range_expr *re; + int expr_count; + int last_hi = 255; + int last_diff = 0; + __u32 last_end_nid = 0; + __u32 current_start_nid = 0; + __u32 current_end_nid = 0; + + list_for_each_entry(nr, nidlist, nr_link) { + list_for_each_entry(ar, &nr->nr_addrranges, ar_link) { + last_hi = 255; + last_diff = 0; + cfs_ip_ar_min_max(ar, ¤t_start_nid, + ¤t_end_nid); + if (last_end_nid != 0 && + (current_start_nid - last_end_nid != 1)) + return false; + last_end_nid = current_end_nid; + list_for_each_entry(el, &ar->ar_numaddr_ranges, + el_link) { + expr_count = 0; + list_for_each_entry(re, &el->el_exprs, + re_link) { + expr_count++; + if (re->re_stride > 1 || + (last_diff > 0 && last_hi != 255) || + (last_diff > 0 && last_hi == 255 && + re->re_lo > 0)) + return false; + last_hi = re->re_hi; + last_diff = re->re_hi - re->re_lo; + } + } + } + } + + return true; +} + +/** + * Takes a linked list of nidrange expressions, determines the minimum + * and maximum nid and creates appropriate nid structures + * + * \param *nidlist + * \param *min_nid + * \param *max_nid + */ +void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, + char *max_nid, size_t nidstr_length) +{ + struct nidrange *nr; + struct netstrfns *nf = NULL; + int netnum = -1; + __u32 min_addr; + __u32 max_addr; + char *lndname = NULL; + char min_addr_str[IPSTRING_LENGTH]; + char max_addr_str[IPSTRING_LENGTH]; + + list_for_each_entry(nr, nidlist, nr_link) { + nf = nr->nr_netstrfns; + lndname = nf->nf_name; + if (netnum == -1) + netnum = nr->nr_netnum; + + nf->nf_min_max(nidlist, &min_addr, &max_addr); + } + nf->nf_addr2str(min_addr, min_addr_str); + nf->nf_addr2str(max_addr, max_addr_str); + + snprintf(min_nid, nidstr_length, "%s@%s%d", min_addr_str, lndname, + netnum); + snprintf(max_nid, nidstr_length, "%s@%s%d", max_addr_str, lndname, + netnum); +} +EXPORT_SYMBOL(cfs_nidrange_find_min_max); + +/** + * Determines the min and max NID values for num LNDs + * + * \param *nidlist + * \param *min_nid + * \param *max_nid + */ +static void cfs_num_min_max(struct list_head *nidlist, __u32 *min_nid, + __u32 *max_nid) +{ + struct nidrange *nr; + struct addrrange *ar; + unsigned int tmp_min_addr = 0; + unsigned int tmp_max_addr = 0; + unsigned int min_addr = 0; + unsigned int max_addr = 0; + + list_for_each_entry(nr, nidlist, nr_link) { + list_for_each_entry(ar, &nr->nr_addrranges, ar_link) { + cfs_num_ar_min_max(ar, &tmp_min_addr, + &tmp_max_addr); + if (tmp_min_addr < min_addr || min_addr == 0) + min_addr = tmp_min_addr; + if (tmp_max_addr > max_addr) + max_addr = tmp_min_addr; + } + } + *max_nid = max_addr; + *min_nid = min_addr; +} + +/** + * Takes an nidlist and determines the minimum and maximum + * ip addresses. + * + * \param *nidlist + * \param *min_nid + * \param *max_nid + */ +static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, + __u32 *max_nid) +{ + struct nidrange *nr; + struct addrrange *ar; + __u32 tmp_min_ip_addr = 0; + __u32 tmp_max_ip_addr = 0; + __u32 min_ip_addr = 0; + __u32 max_ip_addr = 0; + + list_for_each_entry(nr, nidlist, nr_link) { + list_for_each_entry(ar, &nr->nr_addrranges, ar_link) { + cfs_ip_ar_min_max(ar, &tmp_min_ip_addr, + &tmp_max_ip_addr); + if (tmp_min_ip_addr < min_ip_addr || min_ip_addr == 0) + min_ip_addr = tmp_min_ip_addr; + if (tmp_max_ip_addr > max_ip_addr) + max_ip_addr = tmp_max_ip_addr; + } + } + + if (min_nid != NULL) + *min_nid = min_ip_addr; + if (max_nid != NULL) + *max_nid = max_ip_addr; +} + static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr) { @@ -665,7 +978,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_lo_str2addr, /* .nf_parse_addr*/ libcfs_num_parse, /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match}, + /* .nf_match_addr*/ libcfs_num_match, + /* .nf_is_contiguous */ cfs_num_is_contiguous, + /* .nf_min_max */ cfs_num_min_max}, {/* .nf_type */ SOCKLND, /* .nf_name */ "tcp", /* .nf_modname */ "ksocklnd", @@ -673,7 +988,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match}, + /* .nf_match_addr*/ cfs_ip_addr_match, + /* .nf_is_contiguous */ cfs_ip_is_contiguous, + /* .nf_min_max */ cfs_ip_min_max}, {/* .nf_type */ O2IBLND, /* .nf_name */ "o2ib", /* .nf_modname */ "ko2iblnd", @@ -681,7 +998,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match}, + /* .nf_match_addr*/ cfs_ip_addr_match, + /* .nf_is_contiguous */ cfs_ip_is_contiguous, + /* .nf_min_max */ cfs_ip_min_max}, {/* .nf_type */ CIBLND, /* .nf_name */ "cib", /* .nf_modname */ "kciblnd", @@ -689,7 +1008,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match}, + /* .nf_match_addr*/ cfs_ip_addr_match, + /* .nf_is_contiguous */ cfs_ip_is_contiguous, + /* .nf_min_max */ cfs_ip_min_max}, {/* .nf_type */ OPENIBLND, /* .nf_name */ "openib", /* .nf_modname */ "kopeniblnd", @@ -697,7 +1018,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match}, + /* .nf_match_addr*/ cfs_ip_addr_match, + /* .nf_is_contiguous */ cfs_ip_is_contiguous, + /* .nf_min_max */ cfs_ip_min_max}, {/* .nf_type */ IIBLND, /* .nf_name */ "iib", /* .nf_modname */ "kiiblnd", @@ -705,7 +1028,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match}, + /* .nf_match_addr*/ cfs_ip_addr_match, + /* .nf_is_contiguous */ cfs_ip_is_contiguous, + /* .nf_min_max */ cfs_ip_min_max}, {/* .nf_type */ VIBLND, /* .nf_name */ "vib", /* .nf_modname */ "kviblnd", @@ -713,7 +1038,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match}, + /* .nf_match_addr*/ cfs_ip_addr_match, + /* .nf_is_contiguous */ cfs_ip_is_contiguous, + /* .nf_min_max */ cfs_ip_min_max}, {/* .nf_type */ RALND, /* .nf_name */ "ra", /* .nf_modname */ "kralnd", @@ -721,7 +1048,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match}, + /* .nf_match_addr*/ cfs_ip_addr_match, + /* .nf_is_contiguous */ cfs_ip_is_contiguous, + /* .nf_min_max */ cfs_ip_min_max}, {/* .nf_type */ QSWLND, /* .nf_name */ "elan", /* .nf_modname */ "kqswlnd", @@ -729,7 +1058,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_num_str2addr, /* .nf_parse_addrlist*/ libcfs_num_parse, /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match}, + /* .nf_match_addr*/ libcfs_num_match, + /* .nf_is_contiguous */ cfs_num_is_contiguous, + /* .nf_min_max */ cfs_num_min_max}, {/* .nf_type */ GMLND, /* .nf_name */ "gm", /* .nf_modname */ "kgmlnd", @@ -737,7 +1068,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_num_str2addr, /* .nf_parse_addrlist*/ libcfs_num_parse, /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match}, + /* .nf_match_addr*/ libcfs_num_match, + /* .nf_is_contiguous */ cfs_num_is_contiguous, + /* .nf_min_max */ cfs_num_min_max}, {/* .nf_type */ MXLND, /* .nf_name */ "mx", /* .nf_modname */ "kmxlnd", @@ -745,7 +1078,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_ip_str2addr, /* .nf_parse_addrlist*/ cfs_ip_addr_parse, /* .nf_print_addrlist*/ libcfs_ip_addr_range_print, - /* .nf_match_addr*/ cfs_ip_addr_match}, + /* .nf_match_addr*/ cfs_ip_addr_match, + /* .nf_is_contiguous */ cfs_ip_is_contiguous, + /* .nf_min_max */ cfs_ip_min_max}, {/* .nf_type */ PTLLND, /* .nf_name */ "ptl", /* .nf_modname */ "kptllnd", @@ -753,7 +1088,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_num_str2addr, /* .nf_parse_addrlist*/ libcfs_num_parse, /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match}, + /* .nf_match_addr*/ libcfs_num_match, + /* .nf_is_contiguous */ cfs_num_is_contiguous, + /* .nf_min_max */ cfs_num_min_max}, {/* .nf_type */ GNILND, /* .nf_name */ "gni", /* .nf_modname */ "kgnilnd", @@ -761,7 +1098,9 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_str2addr */ libcfs_num_str2addr, /* .nf_parse_addrlist*/ libcfs_num_parse, /* .nf_print_addrlist*/ libcfs_num_addr_range_print, - /* .nf_match_addr*/ libcfs_num_match}, + /* .nf_match_addr*/ libcfs_num_match, + /* .nf_is_contiguous */ cfs_num_is_contiguous, + /* .nf_min_max */ cfs_num_min_max}, /* placeholder for net0 alias. It MUST BE THE LAST ENTRY */ {/* .nf_type */ -1}, }; -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:48 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:48 -0400 Subject: [lustre-devel] [PATCH 10/11] staging: lustre: remove last entry of libcfs_netstrfns[] In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-11-git-send-email-jsimmons@infradead.org> From: Frederic Saunier Currently NID string handling test for the last entry, and last entry has .nf_type == (__u32) -1. If we ask for a non existent LND we hit the last entry which then calls a strlen on a NULL which causes a error. We can avoid this problem if we just remove the last entry since it is not used for anything except as a last entry marker. Signed-off-by: Frederic Saunier Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6501 Reviewed-on: http://review.whamcloud.com/15424 Reviewed-by: frank zago Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- drivers/staging/lustre/lnet/lnet/nidstrings.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index b7a65da..a5cd0ae 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -1101,8 +1101,6 @@ static struct netstrfns libcfs_netstrfns[] = { /* .nf_match_addr*/ libcfs_num_match, /* .nf_is_contiguous */ cfs_num_is_contiguous, /* .nf_min_max */ cfs_num_min_max}, - /* placeholder for net0 alias. It MUST BE THE LAST ENTRY */ - {/* .nf_type */ -1}, }; static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns); @@ -1127,8 +1125,7 @@ libcfs_namenum2netstrfns(const char *name) for (i = 0; i < libcfs_nnetstrfns; i++) { nf = &libcfs_netstrfns[i]; - if (nf->nf_type >= 0 && - !strncmp(name, nf->nf_name, strlen(nf->nf_name))) + if (!strncmp(name, nf->nf_name, strlen(nf->nf_name))) return nf; } return NULL; @@ -1140,8 +1137,7 @@ libcfs_name2netstrfns(const char *name) int i; for (i = 0; i < libcfs_nnetstrfns; i++) - if (libcfs_netstrfns[i].nf_type >= 0 && - !strcmp(libcfs_netstrfns[i].nf_name, name)) + if (!strcmp(libcfs_netstrfns[i].nf_name, name)) return &libcfs_netstrfns[i]; return NULL; @@ -1254,8 +1250,7 @@ libcfs_str2net_internal(const char *str, __u32 *net) for (i = 0; i < libcfs_nnetstrfns; i++) { nf = &libcfs_netstrfns[i]; - if (nf->nf_type >= 0 && - !strncmp(str, nf->nf_name, strlen(nf->nf_name))) + if (!strncmp(str, nf->nf_name, strlen(nf->nf_name))) break; } -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:40 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:40 -0400 Subject: [lustre-devel] [PATCH 02/11] staging: lustre: move nidstring handling to LNet layer In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-3-git-send-email-jsimmons@infradead.org> Moved the source file nidstring.c from libcfs to lnet since that is the only place it is used. With the move of nidstring to lnet some functions in libcfs need to be exported. In later patches those functions that are only used by LNet also will be moved to the LNet layer. Also add in missing MAX_NUMERIC_VALUE defination. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/Makefile | 2 +- .../{lustre/libcfs => lnet/lnet}/nidstrings.c | 13 +++++++++---- drivers/staging/lustre/lustre/libcfs/Makefile | 2 +- .../staging/lustre/lustre/libcfs/libcfs_string.c | 4 ++++ 4 files changed, 15 insertions(+), 6 deletions(-) rename drivers/staging/lustre/{lustre/libcfs => lnet/lnet}/nidstrings.c (99%) diff --git a/drivers/staging/lustre/lnet/lnet/Makefile b/drivers/staging/lustre/lnet/lnet/Makefile index 52492fb..e276fe2 100644 --- a/drivers/staging/lustre/lnet/lnet/Makefile +++ b/drivers/staging/lustre/lnet/lnet/Makefile @@ -1,6 +1,6 @@ obj-$(CONFIG_LNET) += lnet.o -lnet-y := api-ni.o config.o \ +lnet-y := api-ni.o config.o nidstrings.o \ lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o \ lib-socket.o lib-move.o module.o lo.o \ router.o router_proc.o acceptor.o peer.o diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c similarity index 99% rename from drivers/staging/lustre/lustre/libcfs/nidstrings.c rename to drivers/staging/lustre/lnet/lnet/nidstrings.c index a54594a..81ec3a8 100644 --- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -33,7 +33,7 @@ * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. * - * libcfs/libcfs/nidstrings.c + * lnet/lnet/nidstrings.c * * Author: Phil Schwan */ @@ -43,6 +43,9 @@ #include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/lnet/lnet.h" +/* max value for numeric network address */ +#define MAX_NUMERIC_VALUE 0xffffffff + /* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids * consistent in all conversion functions. Some code fragments are copied * around for the sake of clarity... @@ -64,12 +67,13 @@ void libcfs_init_nidstrings(void) { spin_lock_init(&libcfs_nidstring_lock); } +EXPORT_SYMBOL(libcfs_init_nidstrings); -static char * +char * libcfs_next_nidstring(void) { - char *str; - unsigned long flags; + char *str; + unsigned long flags; spin_lock_irqsave(&libcfs_nidstring_lock, flags); @@ -80,6 +84,7 @@ libcfs_next_nidstring(void) spin_unlock_irqrestore(&libcfs_nidstring_lock, flags); return str; } +EXPORT_SYMBOL(libcfs_next_nidstring); static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr) { diff --git a/drivers/staging/lustre/lustre/libcfs/Makefile b/drivers/staging/lustre/lustre/libcfs/Makefile index ec98f44..03d3f3d 100644 --- a/drivers/staging/lustre/lustre/libcfs/Makefile +++ b/drivers/staging/lustre/lustre/libcfs/Makefile @@ -10,7 +10,7 @@ libcfs-linux-objs += linux-mem.o libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs)) -libcfs-all-objs := debug.o fail.o nidstrings.o module.o tracefile.o \ +libcfs-all-objs := debug.o fail.o module.o tracefile.o \ libcfs_string.o hash.o kernel_user_comm.o \ prng.o workitem.o libcfs_cpu.o \ libcfs_mem.o libcfs_lock.o diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index bbfef98..896185f 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -214,6 +214,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) res->ls_len = end - res->ls_str + 1; return 1; } +EXPORT_SYMBOL(cfs_gettok); /** * Converts string to integer. @@ -242,6 +243,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num, return (*num >= min && *num <= max); } +EXPORT_SYMBOL(cfs_str2num_check); /** * Parses \ token of the syntax. If \a bracketed is false, @@ -406,6 +408,7 @@ cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list) return 0; } +EXPORT_SYMBOL(cfs_expr_list_match); /** * Convert express list (\a expr_list) to an array of all matched values @@ -558,6 +561,7 @@ cfs_expr_list_free_list(struct list_head *list) cfs_expr_list_free(el); } } +EXPORT_SYMBOL(cfs_expr_list_free_list); int cfs_ip_addr_parse(char *str, int len, struct list_head *list) -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:44 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:44 -0400 Subject: [lustre-devel] [PATCH 06/11] staging: lustre: move cfs_ip_addr_* function from kernel libcfs to LNet In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-7-git-send-email-jsimmons@infradead.org> Both of cfs_ip_addr_parse and cfs_ip_addr_match which are located in libcfs kernel module are used only for LNet so move this into the nidstring handling code where it belongs. Also create user land versions of these functions in the libcfs user land library. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/15085 Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Reviewed-by: frank zago Reviewed-by: Oleg Drokin --- .../lustre/include/linux/libcfs/libcfs_string.h | 2 - drivers/staging/lustre/include/linux/lnet/nidstr.h | 2 + drivers/staging/lustre/lnet/lnet/nidstrings.c | 60 +++++++++++++++++++ .../staging/lustre/lustre/libcfs/libcfs_string.c | 62 -------------------- 4 files changed, 62 insertions(+), 64 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h index 908efaa..d8d2e7d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h @@ -100,7 +100,5 @@ void cfs_expr_list_free(struct cfs_expr_list *expr_list); int cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max, struct cfs_expr_list **elpp); void cfs_expr_list_free_list(struct list_head *list); -int cfs_ip_addr_parse(char *str, int len, struct list_head *list); -int cfs_ip_addr_match(__u32 addr, struct list_head *list); #endif diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index b32f8cd..1536366 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -72,6 +72,8 @@ int cfs_parse_nidlist(char *str, int len, struct list_head *list); int cfs_print_nidlist(char *buffer, int count, struct list_head *list); int cfs_match_nid(lnet_nid_t nid, struct list_head *list); +int cfs_ip_addr_parse(char *str, int len, struct list_head *list); +int cfs_ip_addr_match(__u32 addr, struct list_head *list); bool cfs_nidrange_is_contiguous(struct list_head *nidlist); void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, char *max_nid, size_t nidstr_length); diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index 6a778b9..a02c1f6 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -113,6 +113,44 @@ static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) return 0; } +int +cfs_ip_addr_parse(char *str, int len, struct list_head *list) +{ + struct cfs_expr_list *el; + struct cfs_lstr src; + int rc; + int i; + + src.ls_str = str; + src.ls_len = len; + i = 0; + + while (src.ls_str != NULL) { + struct cfs_lstr res; + + if (!cfs_gettok(&src, '.', &res)) { + rc = -EINVAL; + goto out; + } + + rc = cfs_expr_list_parse(res.ls_str, res.ls_len, 0, 255, &el); + if (rc != 0) + goto out; + + list_add_tail(&el->el_link, list); + i++; + } + + if (i == 4) + return 0; + + rc = -EINVAL; +out: + cfs_expr_list_free_list(list); + + return rc; +} + static int libcfs_ip_addr_range_print(char *buffer, int count, struct list_head *list) { @@ -128,6 +166,28 @@ libcfs_ip_addr_range_print(char *buffer, int count, struct list_head *list) return i; } +/** + * Matches address (\a addr) against address set encoded in \a list. + * + * \retval 1 if \a addr matches + * \retval 0 otherwise + */ +int +cfs_ip_addr_match(__u32 addr, struct list_head *list) +{ + struct cfs_expr_list *el; + int i = 0; + + list_for_each_entry_reverse(el, list, el_link) { + if (!cfs_expr_list_match(addr & 0xff, el)) + return 0; + addr >>= 8; + i++; + } + + return i == 4; +} + static void libcfs_decnum_addr2str(__u32 addr, char *str) { snprintf(str, LNET_NIDSTR_SIZE, "%u", addr); diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index 5166961..d40be53 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -562,65 +562,3 @@ cfs_expr_list_free_list(struct list_head *list) } } EXPORT_SYMBOL(cfs_expr_list_free_list); - -int -cfs_ip_addr_parse(char *str, int len, struct list_head *list) -{ - struct cfs_expr_list *el; - struct cfs_lstr src; - int rc; - int i; - - src.ls_str = str; - src.ls_len = len; - i = 0; - - while (src.ls_str != NULL) { - struct cfs_lstr res; - - if (!cfs_gettok(&src, '.', &res)) { - rc = -EINVAL; - goto out; - } - - rc = cfs_expr_list_parse(res.ls_str, res.ls_len, 0, 255, &el); - if (rc != 0) - goto out; - - list_add_tail(&el->el_link, list); - i++; - } - - if (i == 4) - return 0; - - rc = -EINVAL; - out: - cfs_expr_list_free_list(list); - - return rc; -} -EXPORT_SYMBOL(cfs_ip_addr_parse); - -/** - * Matches address (\a addr) against address set encoded in \a list. - * - * \retval 1 if \a addr matches - * \retval 0 otherwise - */ -int -cfs_ip_addr_match(__u32 addr, struct list_head *list) -{ - struct cfs_expr_list *el; - int i = 0; - - list_for_each_entry_reverse(el, list, el_link) { - if (!cfs_expr_list_match(addr & 0xff, el)) - return 0; - addr >>= 8; - i++; - } - - return i == 4; -} -EXPORT_SYMBOL(cfs_ip_addr_match); -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:38 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:38 -0400 Subject: [lustre-devel] [PATCH 00/11] staging: lustre: update NID string handling Message-ID: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Much of the LNet network setup is managed with modprobe configuration files. Those configurations are parse with the code in nidstring.c which currently located in the libcfs layer. This patch series moves nidstring.c to the LNet layer where it belongs and we update the source with all the changes that have occured on the OpenSFS lustre development branch. Gregoire Pichon (1): staging: lustre: add a service that prints a nidlist Joshua Walgenbach (1): staging: lustre: add in NID range management for libcfs Dmitry Eremin (1): staging: lustre: provide separate buffers for libcfs_*2str() Frederic Saunier (1): staging: lustre: remove last entry of libcfs_netstrfns[] James Simmons (7): staging: lustre: move nidstring handling to LNet layer staging: lustre: remove libcfs_init_string function staging: lustre: remove cfs_ip_addr_free wrapper staging: lustre: move struct netstrfns to nidstr.h staging: lustre: move cfs_ip_addr_* function from kernel libcfs to LNet staging: lustre: Avoid nid range related forward declarations in nidstring.c staging: lustre: add in NID range management for libcfs staging: lustre: Use C99 initializers for struct netstrfns .../staging/lustre/include/linux/libcfs/libcfs.h | 2 - .../lustre/include/linux/libcfs/libcfs_string.h | 5 +- drivers/staging/lustre/include/linux/lnet/nidstr.h | 47 +- drivers/staging/lustre/lnet/lnet/Makefile | 2 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +- drivers/staging/lustre/lnet/lnet/config.c | 2 +- drivers/staging/lustre/lnet/lnet/nidstrings.c | 1260 ++++++++++++++++++++ drivers/staging/lustre/lnet/lnet/router.c | 2 +- drivers/staging/lustre/lustre/libcfs/Makefile | 2 +- .../staging/lustre/lustre/libcfs/libcfs_string.c | 144 ++-- drivers/staging/lustre/lustre/libcfs/module.c | 2 - drivers/staging/lustre/lustre/libcfs/nidstrings.c | 842 ------------- .../lustre/lustre/obdclass/lprocfs_status.c | 11 +- .../staging/lustre/lustre/obdclass/obd_config.c | 9 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 7 +- drivers/staging/lustre/lustre/osc/osc_request.c | 8 +- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 5 +- 17 files changed, 1408 insertions(+), 948 deletions(-) create mode 100644 drivers/staging/lustre/lnet/lnet/nidstrings.c delete mode 100644 drivers/staging/lustre/lustre/libcfs/nidstrings.c From jsimmons at infradead.org Thu Oct 22 01:52:42 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:42 -0400 Subject: [lustre-devel] [PATCH 04/11] staging: lustre: remove cfs_ip_addr_free wrapper In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-5-git-send-email-jsimmons@infradead.org> No need to have a one line wrapper in libcfs that only is used to delete a list which is only done once in the LNet layer. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_string.h | 1 - drivers/staging/lustre/lnet/lnet/config.c | 2 +- .../staging/lustre/lustre/libcfs/libcfs_string.c | 7 ------- 3 files changed, 1 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h index d178e43..908efaa 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h @@ -102,6 +102,5 @@ int cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max, void cfs_expr_list_free_list(struct list_head *list); int cfs_ip_addr_parse(char *str, int len, struct list_head *list); int cfs_ip_addr_match(__u32 addr, struct list_head *list); -void cfs_ip_addr_free(struct list_head *list); #endif diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index b09a438..1b3bc83 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -824,7 +824,7 @@ lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip) for (rc = i = 0; !rc && i < nip; i++) rc = cfs_ip_addr_match(ipaddrs[i], &list); - cfs_ip_addr_free(&list); + cfs_expr_list_free_list(&list); return rc; } diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index 896185f..5166961 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -624,10 +624,3 @@ cfs_ip_addr_match(__u32 addr, struct list_head *list) return i == 4; } EXPORT_SYMBOL(cfs_ip_addr_match); - -void -cfs_ip_addr_free(struct list_head *list) -{ - cfs_expr_list_free_list(list); -} -EXPORT_SYMBOL(cfs_ip_addr_free); -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:47 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:47 -0400 Subject: [lustre-devel] [PATCH 09/11] staging: lustre: provide separate buffers for libcfs_*2str() In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-10-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Provide duplicates with separate buffers for libcfs_*2str() functions. Replace libcfs_nid2str() with libcfs_nid2str_r() function in critical places. Provide buffer size for nf_addr2str functions. Use __u32 as nf_type always Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6070 Reviewed-on: http://review.whamcloud.com/13185 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger --- drivers/staging/lustre/include/linux/lnet/nidstr.h | 31 ++++- drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +- drivers/staging/lustre/lnet/lnet/nidstrings.c | 138 ++++++++++---------- drivers/staging/lustre/lnet/lnet/router.c | 2 +- .../lustre/lustre/obdclass/lprocfs_status.c | 11 +- .../staging/lustre/lustre/obdclass/obd_config.c | 9 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 7 +- drivers/staging/lustre/lustre/osc/osc_request.c | 8 +- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 5 +- 9 files changed, 121 insertions(+), 96 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 4e7c9a5..46ad914 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -57,12 +57,29 @@ struct list_head; #define LNET_NIDSTR_COUNT 1024 /* # of nidstrings */ #define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */ -int libcfs_isknown_lnd(int type); -char *libcfs_lnd2modname(int type); -char *libcfs_lnd2str(int type); +/* support decl needed by both kernel and user space */ +char *libcfs_next_nidstring(void); +int libcfs_isknown_lnd(__u32 lnd); +char *libcfs_lnd2modname(__u32 lnd); +char *libcfs_lnd2str_r(__u32 lnd, char *buf, size_t buf_size); +static inline char *libcfs_lnd2str(__u32 lnd) +{ + return libcfs_lnd2str_r(lnd, libcfs_next_nidstring(), + LNET_NIDSTR_SIZE); +} int libcfs_str2lnd(const char *str); -char *libcfs_net2str(__u32 net); -char *libcfs_nid2str(lnet_nid_t nid); +char *libcfs_net2str_r(__u32 net, char *buf, size_t buf_size); +static inline char *libcfs_net2str(__u32 net) +{ + return libcfs_net2str_r(net, libcfs_next_nidstring(), + LNET_NIDSTR_SIZE); +} +char *libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size); +static inline char *libcfs_nid2str(lnet_nid_t nid) +{ + return libcfs_nid2str_r(nid, libcfs_next_nidstring(), + LNET_NIDSTR_SIZE); +} __u32 libcfs_str2net(const char *str); lnet_nid_t libcfs_str2nid(const char *str); int libcfs_str2anynid(lnet_nid_t *nid, const char *str); @@ -79,10 +96,10 @@ void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, char *max_nid, size_t nidstr_length); struct netstrfns { - int nf_type; + __u32 nf_type; char *nf_name; char *nf_modname; - void (*nf_addr2str)(__u32 addr, char *str); + void (*nf_addr2str)(__u32 addr, char *str, size_t size); int (*nf_str2addr)(const char *str, int nob, __u32 *addr); int (*nf_parse_addrlist)(char *str, int len, struct list_head *list); diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 53ad5ef..3954126 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -263,7 +263,7 @@ static void lnet_assert_wire_constants(void) } static lnd_t * -lnet_find_lnd_by_type(int type) +lnet_find_lnd_by_type(__u32 type) { lnd_t *lnd; struct list_head *tmp; @@ -272,7 +272,7 @@ lnet_find_lnd_by_type(int type) list_for_each(tmp, &the_lnet.ln_lnds) { lnd = list_entry(tmp, lnd_t, lnd_list); - if ((int)lnd->lnd_type == type) + if (lnd->lnd_type == type) return lnd; } @@ -962,7 +962,7 @@ lnet_startup_lndnis(void) struct list_head nilist; int i; int rc = 0; - int lnd_type; + __u32 lnd_type; int nicount = 0; char *nets = lnet_get_networks(); diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index 4402b80..b7a65da 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -693,8 +693,8 @@ void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, nf->nf_min_max(nidlist, &min_addr, &max_addr); } - nf->nf_addr2str(min_addr, min_addr_str); - nf->nf_addr2str(max_addr, max_addr_str); + nf->nf_addr2str(min_addr, min_addr_str, sizeof(min_addr_str)); + nf->nf_addr2str(max_addr, max_addr_str, sizeof(max_addr_str)); snprintf(min_nid, nidstr_length, "%s@%s%d", min_addr_str, lndname, netnum); @@ -777,9 +777,9 @@ libcfs_lo_str2addr(const char *str, int nob, __u32 *addr) } static void -libcfs_ip_addr2str(__u32 addr, char *str) +libcfs_ip_addr2str(__u32 addr, char *str, size_t size) { - snprintf(str, LNET_NIDSTR_SIZE, "%u.%u.%u.%u", + snprintf(str, size, "%u.%u.%u.%u", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); } @@ -888,15 +888,15 @@ cfs_ip_addr_match(__u32 addr, struct list_head *list) } static void -libcfs_decnum_addr2str(__u32 addr, char *str) +libcfs_decnum_addr2str(__u32 addr, char *str, size_t size) { - snprintf(str, LNET_NIDSTR_SIZE, "%u", addr); + snprintf(str, size, "%u", addr); } static void -libcfs_hexnum_addr2str(__u32 addr, char *str) +libcfs_hexnum_addr2str(__u32 addr, char *str, size_t size) { - snprintf(str, LNET_NIDSTR_SIZE, "0x%x", addr); + snprintf(str, size, "0x%x", addr); } static int @@ -1105,17 +1105,16 @@ static struct netstrfns libcfs_netstrfns[] = { {/* .nf_type */ -1}, }; -static const int libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns); +static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns); static struct netstrfns * -libcfs_lnd2netstrfns(int lnd) +libcfs_lnd2netstrfns(__u32 lnd) { - int i; + int i; - if (lnd >= 0) - for (i = 0; i < libcfs_nnetstrfns; i++) - if (lnd == libcfs_netstrfns[i].nf_type) - return &libcfs_netstrfns[i]; + for (i = 0; i < libcfs_nnetstrfns; i++) + if (lnd == libcfs_netstrfns[i].nf_type) + return &libcfs_netstrfns[i]; return NULL; } @@ -1124,7 +1123,7 @@ static struct netstrfns * libcfs_namenum2netstrfns(const char *name) { struct netstrfns *nf; - int i; + int i; for (i = 0; i < libcfs_nnetstrfns; i++) { nf = &libcfs_netstrfns[i]; @@ -1149,14 +1148,14 @@ libcfs_name2netstrfns(const char *name) } int -libcfs_isknown_lnd(int type) +libcfs_isknown_lnd(__u32 lnd) { - return libcfs_lnd2netstrfns(type) != NULL; + return libcfs_lnd2netstrfns(lnd) != NULL; } EXPORT_SYMBOL(libcfs_isknown_lnd); char * -libcfs_lnd2modname(int lnd) +libcfs_lnd2modname(__u32 lnd) { struct netstrfns *nf = libcfs_lnd2netstrfns(lnd); @@ -1164,21 +1163,6 @@ libcfs_lnd2modname(int lnd) } EXPORT_SYMBOL(libcfs_lnd2modname); -char * -libcfs_lnd2str(int lnd) -{ - char *str; - struct netstrfns *nf = libcfs_lnd2netstrfns(lnd); - - if (nf != NULL) - return nf->nf_name; - - str = libcfs_next_nidstring(); - snprintf(str, LNET_NIDSTR_SIZE, "?%d?", lnd); - return str; -} -EXPORT_SYMBOL(libcfs_lnd2str); - int libcfs_str2lnd(const char *str) { @@ -1192,65 +1176,81 @@ libcfs_str2lnd(const char *str) EXPORT_SYMBOL(libcfs_str2lnd); char * -libcfs_net2str(__u32 net) +libcfs_lnd2str_r(__u32 lnd, char *buf, size_t buf_size) +{ + struct netstrfns *nf; + + nf = libcfs_lnd2netstrfns(lnd); + if (nf == NULL) + snprintf(buf, buf_size, "?%u?", lnd); + else + snprintf(buf, buf_size, "%s", nf->nf_name); + + return buf; +} +EXPORT_SYMBOL(libcfs_lnd2str_r); + +char * +libcfs_net2str_r(__u32 net, char *buf, size_t buf_size) { - int lnd = LNET_NETTYP(net); - int num = LNET_NETNUM(net); - struct netstrfns *nf = libcfs_lnd2netstrfns(lnd); - char *str = libcfs_next_nidstring(); + __u32 nnum = LNET_NETNUM(net); + __u32 lnd = LNET_NETTYP(net); + struct netstrfns *nf; + nf = libcfs_lnd2netstrfns(lnd); if (nf == NULL) - snprintf(str, LNET_NIDSTR_SIZE, "<%d:%d>", lnd, num); - else if (num == 0) - snprintf(str, LNET_NIDSTR_SIZE, "%s", nf->nf_name); + snprintf(buf, buf_size, "<%u:%u>", lnd, nnum); + else if (nnum == 0) + snprintf(buf, buf_size, "%s", nf->nf_name); else - snprintf(str, LNET_NIDSTR_SIZE, "%s%d", nf->nf_name, num); + snprintf(buf, buf_size, "%s%u", nf->nf_name, nnum); - return str; + return buf; } -EXPORT_SYMBOL(libcfs_net2str); +EXPORT_SYMBOL(libcfs_net2str_r); char * -libcfs_nid2str(lnet_nid_t nid) +libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size) { - __u32 addr = LNET_NIDADDR(nid); - __u32 net = LNET_NIDNET(nid); - int lnd = LNET_NETTYP(net); - int nnum = LNET_NETNUM(net); + __u32 addr = LNET_NIDADDR(nid); + __u32 net = LNET_NIDNET(nid); + __u32 nnum = LNET_NETNUM(net); + __u32 lnd = LNET_NETTYP(net); struct netstrfns *nf; - char *str; - int nob; - if (nid == LNET_NID_ANY) - return ""; + if (nid == LNET_NID_ANY) { + strncpy(buf, "", buf_size); + buf[buf_size - 1] = '\0'; + return buf; + } nf = libcfs_lnd2netstrfns(lnd); - str = libcfs_next_nidstring(); - if (nf == NULL) - snprintf(str, LNET_NIDSTR_SIZE, "%x@<%d:%d>", addr, lnd, nnum); + snprintf(buf, buf_size, "%x@<%u:%u>", addr, lnd, nnum); else { - nf->nf_addr2str(addr, str); - nob = strlen(str); + size_t addr_len; + + nf->nf_addr2str(addr, buf, buf_size); + addr_len = strlen(buf); if (nnum == 0) - snprintf(str + nob, LNET_NIDSTR_SIZE - nob, "@%s", + snprintf(buf + addr_len, buf_size - addr_len, "@%s", nf->nf_name); else - snprintf(str + nob, LNET_NIDSTR_SIZE - nob, "@%s%d", + snprintf(buf + addr_len, buf_size - addr_len, "@%s%u", nf->nf_name, nnum); } - return str; + return buf; } -EXPORT_SYMBOL(libcfs_nid2str); +EXPORT_SYMBOL(libcfs_nid2str_r); static struct netstrfns * libcfs_str2net_internal(const char *str, __u32 *net) { struct netstrfns *uninitialized_var(nf); - int nob; - unsigned int netnum; - int i; + int nob; + unsigned int netnum; + int i; for (i = 0; i < libcfs_nnetstrfns; i++) { nf = &libcfs_netstrfns[i]; @@ -1296,10 +1296,10 @@ EXPORT_SYMBOL(libcfs_str2net); lnet_nid_t libcfs_str2nid(const char *str) { - const char *sep = strchr(str, '@'); + const char *sep = strchr(str, '@'); struct netstrfns *nf; - __u32 net; - __u32 addr; + __u32 net; + __u32 addr; if (sep != NULL) { nf = libcfs_str2net_internal(sep + 1, &net); diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 4b56770..fe49f1b 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -235,7 +235,7 @@ lnet_find_net_locked(__u32 net) static void lnet_shuffle_seed(void) { static int seeded; - int lnd_type, seed[2]; + __u32 lnd_type, seed[2]; struct timespec64 ts; lnet_ni_t *ni; struct list_head *tmp; diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 3228fee..047ced5 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -610,6 +610,7 @@ static void obd_connect_seq_flags2str(struct seq_file *m, __u64 flags, char *sep int lprocfs_rd_import(struct seq_file *m, void *data) { + char nidstr[LNET_NIDSTR_SIZE]; struct lprocfs_counter ret; struct lprocfs_counter_header *header; struct obd_device *obd = data; @@ -647,18 +648,20 @@ int lprocfs_rd_import(struct seq_file *m, void *data) spin_lock(&imp->imp_lock); j = 0; list_for_each_entry(conn, &imp->imp_conn_list, oic_item) { - seq_printf(m, "%s%s", j ? ", " : "", - libcfs_nid2str(conn->oic_conn->c_peer.nid)); + libcfs_nid2str_r(conn->oic_conn->c_peer.nid, + nidstr, sizeof(nidstr)); + seq_printf(m, "%s%s", j ? ", " : "", nidstr); j++; } + libcfs_nid2str_r(imp->imp_connection->c_peer.nid, + nidstr, sizeof(nidstr)); seq_printf(m, "]\n" " current_connection: %s\n" " connection_attempts: %u\n" " generation: %u\n" " in-progress_invalidations: %u\n", - imp->imp_connection == NULL ? "" : - libcfs_nid2str(imp->imp_connection->c_peer.nid), + imp->imp_connection == NULL ? "" : nidstr, imp->imp_conn_cnt, imp->imp_generation, atomic_read(&imp->imp_inval_count)); diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 38e5e13..64753b3 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1316,10 +1316,13 @@ static int class_config_parse_rec(struct llog_rec_hdr *rec, char *buf, if (lcfg->lcfg_num) ptr += snprintf(ptr, end-ptr, "num=%#08x ", lcfg->lcfg_num); - if (lcfg->lcfg_nid) + if (lcfg->lcfg_nid) { + char nidstr[LNET_NIDSTR_SIZE]; + + libcfs_nid2str_r(lcfg->lcfg_nid, nidstr, sizeof(nidstr)); ptr += snprintf(ptr, end-ptr, "nid=%s(%#llx)\n ", - libcfs_nid2str(lcfg->lcfg_nid), - lcfg->lcfg_nid); + nidstr, lcfg->lcfg_nid); + } if (lcfg->lcfg_command == LCFG_MARKER) { struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1); diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 149c838..48003d5 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -209,9 +209,10 @@ int lustre_start_mgc(struct super_block *sb) struct obd_uuid *uuid; class_uuid_t uuidc; lnet_nid_t nid; + char nidstr[LNET_NIDSTR_SIZE]; char *mgcname = NULL, *niduuid = NULL, *mgssec = NULL; char *ptr; - int rc = 0, i = 0, j, len; + int rc = 0, i = 0, j; LASSERT(lsi->lsi_lmd); @@ -226,9 +227,9 @@ int lustre_start_mgc(struct super_block *sb) mutex_lock(&mgc_start_lock); - len = strlen(LUSTRE_MGC_OBDNAME) + strlen(libcfs_nid2str(nid)) + 1; + libcfs_nid2str_r(nid, nidstr, sizeof(nidstr)); mgcname = kasprintf(GFP_NOFS, - "%s%s", LUSTRE_MGC_OBDNAME, libcfs_nid2str(nid)); + "%s%s", LUSTRE_MGC_OBDNAME, nidstr); niduuid = kasprintf(GFP_NOFS, "%s_%x", mgcname, i); if (!mgcname || !niduuid) { rc = -ENOMEM; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 32c9713..0d3878a 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1547,8 +1547,8 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) if (body->oa.o_valid & OBD_MD_FLCKSUM) { static int cksum_counter; __u32 server_cksum = body->oa.o_cksum; - char *via; - char *router; + char *via = ""; + char *router = ""; cksum_type_t cksum_type; cksum_type = cksum_type_unpack(body->oa.o_valid&OBD_MD_FLFLAGS ? @@ -1557,9 +1557,7 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) aa->aa_ppga, OST_READ, cksum_type); - if (peer->nid == req->rq_bulk->bd_sender) { - via = router = ""; - } else { + if (peer->nid != req->rq_bulk->bd_sender) { via = " via "; router = libcfs_nid2str(req->rq_bulk->bd_sender); } diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 415817c..bc5437e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -909,8 +909,11 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) rc = ptlrpc_lprocfs_svc_req_history_seek(svcpt, srhi, srhi->srhi_seq); if (rc == 0) { + char nidstr[LNET_NIDSTR_SIZE]; + req = srhi->srhi_req; + libcfs_nid2str_r(req->rq_self, nidstr, sizeof(nidstr)); /* Print common req fields. * CAVEAT EMPTOR: we're racing with the service handler * here. The request could contain any old crap, so you @@ -918,7 +921,7 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) * parser. Currently I only print stuff here I know is OK * to look at coz it was set up in request_in_callback()!!! */ seq_printf(s, "%lld:%s:%s:x%llu:%d:%s:%lld:%lds(%+lds) ", - req->rq_history_seq, libcfs_nid2str(req->rq_self), + req->rq_history_seq, nidstr, libcfs_id2str(req->rq_peer), req->rq_xid, req->rq_reqlen, ptlrpc_rqphase2str(req), (s64)req->rq_arrival_time.tv_sec, -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:43 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:43 -0400 Subject: [lustre-devel] [PATCH 05/11] staging: lustre: move struct netstrfns to nidstr.h In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-6-git-send-email-jsimmons@infradead.org> The reason struct netstrfns exist in nidstrings.c was to avoid forward decleration errors. The best way to handle this instead is to move this structure to a header file. Since this structure is used in the userland utilities as well so we place it in nidstr.h which is exposed to userland. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/15083 Reviewed-by: Dmitry Eremin Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- drivers/staging/lustre/include/linux/lnet/nidstr.h | 13 +++++++++++++ drivers/staging/lustre/lnet/lnet/nidstrings.c | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 082782b..b32f8cd 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -76,4 +76,17 @@ bool cfs_nidrange_is_contiguous(struct list_head *nidlist); void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, char *max_nid, size_t nidstr_length); +struct netstrfns { + int nf_type; + char *nf_name; + char *nf_modname; + void (*nf_addr2str)(__u32 addr, char *str); + int (*nf_str2addr)(const char *str, int nob, __u32 *addr); + int (*nf_parse_addrlist)(char *str, int len, + struct list_head *list); + int (*nf_print_addrlist)(char *buffer, int count, + struct list_head *list); + int (*nf_match_addr)(__u32 addr, struct list_head *list); +}; + #endif /* _LNET_NIDSTRINGS_H */ diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index fdbdf06..6a778b9 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -208,19 +208,6 @@ libcfs_num_match(__u32 addr, struct list_head *numaddr) return cfs_expr_list_match(addr, el); } -struct netstrfns { - int nf_type; - char *nf_name; - char *nf_modname; - void (*nf_addr2str)(__u32 addr, char *str); - int (*nf_str2addr)(const char *str, int nob, __u32 *addr); - int (*nf_parse_addrlist)(char *str, int len, - struct list_head *list); - int (*nf_print_addrlist)(char *buffer, int count, - struct list_head *list); - int (*nf_match_addr)(__u32 addr, struct list_head *list); -}; - static struct netstrfns libcfs_netstrfns[] = { {/* .nf_type */ LOLND, /* .nf_name */ "lo", -- 1.7.1 From jsimmons at infradead.org Thu Oct 22 01:52:45 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 21 Oct 2015 21:52:45 -0400 Subject: [lustre-devel] [PATCH 07/11] staging: lustre: Avoid nid range related forward declarations in nidstring.c In-Reply-To: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> References: <1445478769-21203-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445478769-21203-8-git-send-email-jsimmons@infradead.org> Since forward declarations are frowned on upstream we move the NID range handling to near the start of the nidstring.c file. Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/15086 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-by: Dmitry Eremin Reviewed-by: Bob Glossman Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- drivers/staging/lustre/lnet/lnet/nidstrings.c | 782 +++++++++++++------------ 1 files changed, 395 insertions(+), 387 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index a02c1f6..1874dfe 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -63,6 +63,8 @@ static int libcfs_nidstring_idx; static DEFINE_SPINLOCK(libcfs_nidstring_lock); +static struct netstrfns *libcfs_namenum2netstrfns(const char *name); + char * libcfs_next_nidstring(void) { @@ -80,20 +82,403 @@ libcfs_next_nidstring(void) } EXPORT_SYMBOL(libcfs_next_nidstring); -static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr) +/** + * Nid range list syntax. + * \verbatim + * + * :== [ ' ' ] + * :== '@' + * :== '*' | + * | + * + * :== ... + * + * :== | + * + * :== '[' [ ',' ] ']' + * :== | + * '-' | + * '-' '/' + * :== | + * :== "lo" | "tcp" | "o2ib" | "cib" | "openib" | "iib" | + * "vib" | "ra" | "elan" | "mx" | "ptl" + * \endverbatim + */ + +/** + * Structure to represent \ token of the syntax. + * + * One of this is created for each \ parsed. + */ +struct nidrange { + /** + * Link to list of this structures which is built on nid range + * list parsing. + */ + struct list_head nr_link; + /** + * List head for addrrange::ar_link. + */ + struct list_head nr_addrranges; + /** + * Flag indicating that *@ is found. + */ + int nr_all; + /** + * Pointer to corresponding element of libcfs_netstrfns. + */ + struct netstrfns *nr_netstrfns; + /** + * Number of network. E.g. 5 if \ is "elan5". + */ + int nr_netnum; +}; + +/** + * Structure to represent \ token of the syntax. + */ +struct addrrange { + /** + * Link to nidrange::nr_addrranges. + */ + struct list_head ar_link; + /** + * List head for cfs_expr_list::el_list. + */ + struct list_head ar_numaddr_ranges; +}; + +/** + * Parses \ token on the syntax. + * + * Allocates struct addrrange and links to \a nidrange via + * (nidrange::nr_addrranges) + * + * \retval 0 if \a src parses to '*' | \ | \ + * \retval -errno otherwise + */ +static int +parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange) +{ + struct addrrange *addrrange; + + if (src->ls_len == 1 && src->ls_str[0] == '*') { + nidrange->nr_all = 1; + return 0; + } + + LIBCFS_ALLOC(addrrange, sizeof(struct addrrange)); + if (addrrange == NULL) + return -ENOMEM; + list_add_tail(&addrrange->ar_link, &nidrange->nr_addrranges); + INIT_LIST_HEAD(&addrrange->ar_numaddr_ranges); + + return nidrange->nr_netstrfns->nf_parse_addrlist(src->ls_str, + src->ls_len, + &addrrange->ar_numaddr_ranges); +} + +/** + * Finds or creates struct nidrange. + * + * Checks if \a src is a valid network name, looks for corresponding + * nidrange on the ist of nidranges (\a nidlist), creates new struct + * nidrange if it is not found. + * + * \retval pointer to struct nidrange matching network specified via \a src + * \retval NULL if \a src does not match any network + */ +static struct nidrange * +add_nidrange(const struct cfs_lstr *src, + struct list_head *nidlist) +{ + struct netstrfns *nf; + struct nidrange *nr; + int endlen; + unsigned netnum; + + if (src->ls_len >= LNET_NIDSTR_SIZE) + return NULL; + + nf = libcfs_namenum2netstrfns(src->ls_str); + if (nf == NULL) + return NULL; + endlen = src->ls_len - strlen(nf->nf_name); + if (endlen == 0) + /* network name only, e.g. "elan" or "tcp" */ + netnum = 0; + else { + /* e.g. "elan25" or "tcp23", refuse to parse if + * network name is not appended with decimal or + * hexadecimal number */ + if (!cfs_str2num_check(src->ls_str + strlen(nf->nf_name), + endlen, &netnum, 0, MAX_NUMERIC_VALUE)) + return NULL; + } + + list_for_each_entry(nr, nidlist, nr_link) { + if (nr->nr_netstrfns != nf) + continue; + if (nr->nr_netnum != netnum) + continue; + return nr; + } + + LIBCFS_ALLOC(nr, sizeof(struct nidrange)); + if (nr == NULL) + return NULL; + list_add_tail(&nr->nr_link, nidlist); + INIT_LIST_HEAD(&nr->nr_addrranges); + nr->nr_netstrfns = nf; + nr->nr_all = 0; + nr->nr_netnum = netnum; + + return nr; +} + +/** + * Parses \ token of the syntax. + * + * \retval 1 if \a src parses to \ '@' \ + * \retval 0 otherwise + */ +static int +parse_nidrange(struct cfs_lstr *src, struct list_head *nidlist) +{ + struct cfs_lstr addrrange; + struct cfs_lstr net; + struct cfs_lstr tmp; + struct nidrange *nr; + + tmp = *src; + if (cfs_gettok(src, '@', &addrrange) == 0) + goto failed; + + if (cfs_gettok(src, '@', &net) == 0 || src->ls_str != NULL) + goto failed; + + nr = add_nidrange(&net, nidlist); + if (nr == NULL) + goto failed; + + if (parse_addrange(&addrrange, nr) != 0) + goto failed; + + return 1; +failed: + CWARN("can't parse nidrange: \"%.*s\"\n", tmp.ls_len, tmp.ls_str); + return 0; +} + +/** + * Frees addrrange structures of \a list. + * + * For each struct addrrange structure found on \a list it frees + * cfs_expr_list list attached to it and frees the addrrange itself. + * + * \retval none + */ +static void +free_addrranges(struct list_head *list) +{ + while (!list_empty(list)) { + struct addrrange *ar; + + ar = list_entry(list->next, struct addrrange, ar_link); + + cfs_expr_list_free_list(&ar->ar_numaddr_ranges); + list_del(&ar->ar_link); + LIBCFS_FREE(ar, sizeof(struct addrrange)); + } +} + +/** + * Frees nidrange strutures of \a list. + * + * For each struct nidrange structure found on \a list it frees + * addrrange list attached to it and frees the nidrange itself. + * + * \retval none + */ +void +cfs_free_nidlist(struct list_head *list) +{ + struct list_head *pos, *next; + struct nidrange *nr; + + list_for_each_safe(pos, next, list) { + nr = list_entry(pos, struct nidrange, nr_link); + free_addrranges(&nr->nr_addrranges); + list_del(pos); + LIBCFS_FREE(nr, sizeof(struct nidrange)); + } +} +EXPORT_SYMBOL(cfs_free_nidlist); + +/** + * Parses nid range list. + * + * Parses with rigorous syntax and overflow checking \a str into + * \ [ ' ' \ ], compiles \a str into set of + * structures and links that structure to \a nidlist. The resulting + * list can be used to match a NID againts set of NIDS defined by \a + * str. + * \see cfs_match_nid + * + * \retval 1 on success + * \retval 0 otherwise + */ +int +cfs_parse_nidlist(char *str, int len, struct list_head *nidlist) +{ + struct cfs_lstr src; + struct cfs_lstr res; + int rc; + + src.ls_str = str; + src.ls_len = len; + INIT_LIST_HEAD(nidlist); + while (src.ls_str) { + rc = cfs_gettok(&src, ' ', &res); + if (rc == 0) { + cfs_free_nidlist(nidlist); + return 0; + } + rc = parse_nidrange(&res, nidlist); + if (rc == 0) { + cfs_free_nidlist(nidlist); + return 0; + } + } + return 1; +} +EXPORT_SYMBOL(cfs_parse_nidlist); + +/** + * Matches a nid (\a nid) against the compiled list of nidranges (\a nidlist). + * + * \see cfs_parse_nidlist() + * + * \retval 1 on match + * \retval 0 otherwises + */ +int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist) +{ + struct nidrange *nr; + struct addrrange *ar; + + list_for_each_entry(nr, nidlist, nr_link) { + if (nr->nr_netstrfns->nf_type != LNET_NETTYP(LNET_NIDNET(nid))) + continue; + if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid))) + continue; + if (nr->nr_all) + return 1; + list_for_each_entry(ar, &nr->nr_addrranges, ar_link) + if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid), + &ar->ar_numaddr_ranges)) + return 1; + } + return 0; +} +EXPORT_SYMBOL(cfs_match_nid); + +/** + * Print the network part of the nidrange \a nr into the specified \a buffer. + * + * \retval number of characters written + */ +static int +cfs_print_network(char *buffer, int count, struct nidrange *nr) +{ + struct netstrfns *nf = nr->nr_netstrfns; + + if (nr->nr_netnum == 0) + return scnprintf(buffer, count, "@%s", nf->nf_name); + else + return scnprintf(buffer, count, "@%s%u", + nf->nf_name, nr->nr_netnum); +} + +/** + * Print a list of addrrange (\a addrranges) into the specified \a buffer. + * At max \a count characters can be printed into \a buffer. + * + * \retval number of characters written + */ +static int +cfs_print_addrranges(char *buffer, int count, struct list_head *addrranges, + struct nidrange *nr) +{ + int i = 0; + struct addrrange *ar; + struct netstrfns *nf = nr->nr_netstrfns; + + list_for_each_entry(ar, addrranges, ar_link) { + if (i != 0) + i += scnprintf(buffer + i, count - i, " "); + i += nf->nf_print_addrlist(buffer + i, count - i, + &ar->ar_numaddr_ranges); + i += cfs_print_network(buffer + i, count - i, nr); + } + return i; +} + +/** + * Print a list of nidranges (\a nidlist) into the specified \a buffer. + * At max \a count characters can be printed into \a buffer. + * Nidranges are separated by a space character. + * + * \retval number of characters written + */ +int cfs_print_nidlist(char *buffer, int count, struct list_head *nidlist) +{ + int i = 0; + struct nidrange *nr; + + if (count <= 0) + return 0; + + list_for_each_entry(nr, nidlist, nr_link) { + if (i != 0) + i += scnprintf(buffer + i, count - i, " "); + + if (nr->nr_all != 0) { + LASSERT(list_empty(&nr->nr_addrranges)); + i += scnprintf(buffer + i, count - i, "*"); + i += cfs_print_network(buffer + i, count - i, nr); + } else { + i += cfs_print_addrranges(buffer + i, count - i, + &nr->nr_addrranges, nr); + } + } + return i; +} +EXPORT_SYMBOL(cfs_print_nidlist); + +static int +libcfs_lo_str2addr(const char *str, int nob, __u32 *addr) { *addr = 0; return 1; } -static void libcfs_ip_addr2str(__u32 addr, char *str) +static void +libcfs_ip_addr2str(__u32 addr, char *str) { snprintf(str, LNET_NIDSTR_SIZE, "%u.%u.%u.%u", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); } -static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) +/* CAVEAT EMPTOR XscanfX + * I use "%n" at the end of a sscanf format to detect trailing junk. However + * sscanf may return immediately if it sees the terminating '0' in a string, so + * I initialise the %n variable to the expected length. If sscanf sets it; + * fine, if it doesn't, then the scan ended at the end of the string, which is + * fine too :) */ +static int +libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) { unsigned int a; unsigned int b; @@ -113,6 +498,7 @@ static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) return 0; } +/* Used by lnet/config.c so it can't be static */ int cfs_ip_addr_parse(char *str, int len, struct list_head *list) { @@ -188,17 +574,20 @@ cfs_ip_addr_match(__u32 addr, struct list_head *list) return i == 4; } -static void libcfs_decnum_addr2str(__u32 addr, char *str) +static void +libcfs_decnum_addr2str(__u32 addr, char *str) { snprintf(str, LNET_NIDSTR_SIZE, "%u", addr); } -static void libcfs_hexnum_addr2str(__u32 addr, char *str) +static void +libcfs_hexnum_addr2str(__u32 addr, char *str) { snprintf(str, LNET_NIDSTR_SIZE, "0x%x", addr); } -static int libcfs_num_str2addr(const char *str, int nob, __u32 *addr) +static int +libcfs_num_str2addr(const char *str, int nob, __u32 *addr) { int n; @@ -379,13 +768,6 @@ static struct netstrfns libcfs_netstrfns[] = { static const int libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns); -/* CAVEAT EMPTOR XscanfX - * I use "%n" at the end of a sscanf format to detect trailing junk. However - * sscanf may return immediately if it sees the terminating '0' in a string, so - * I initialise the %n variable to the expected length. If sscanf sets it; - * fine, if it doesn't, then the scan ended at the end of the string, which is - * fine too :) */ - static struct netstrfns * libcfs_lnd2netstrfns(int lnd) { @@ -628,377 +1010,3 @@ libcfs_str2anynid(lnet_nid_t *nidp, const char *str) return *nidp != LNET_NID_ANY; } EXPORT_SYMBOL(libcfs_str2anynid); - -/** - * Nid range list syntax. - * \verbatim - * - * :== [ ' ' ] - * :== '@' - * :== '*' | - * | - * - * :== ... - * - * :== | - * - * :== '[' [ ',' ] ']' - * :== | - * '-' | - * '-' '/' - * :== | - * :== "lo" | "tcp" | "o2ib" | "cib" | "openib" | "iib" | - * "vib" | "ra" | "elan" | "mx" | "ptl" - * \endverbatim - */ - -/** - * Structure to represent \ token of the syntax. - * - * One of this is created for each \ parsed. - */ -struct nidrange { - /** - * Link to list of this structures which is built on nid range - * list parsing. - */ - struct list_head nr_link; - /** - * List head for addrrange::ar_link. - */ - struct list_head nr_addrranges; - /** - * Flag indicating that *@ is found. - */ - int nr_all; - /** - * Pointer to corresponding element of libcfs_netstrfns. - */ - struct netstrfns *nr_netstrfns; - /** - * Number of network. E.g. 5 if \ is "elan5". - */ - int nr_netnum; -}; - -/** - * Structure to represent \ token of the syntax. - */ -struct addrrange { - /** - * Link to nidrange::nr_addrranges. - */ - struct list_head ar_link; - /** - * List head for cfs_expr_list::el_list. - */ - struct list_head ar_numaddr_ranges; -}; - -/** - * Parses \ token on the syntax. - * - * Allocates struct addrrange and links to \a nidrange via - * (nidrange::nr_addrranges) - * - * \retval 0 if \a src parses to '*' | \ | \ - * \retval -errno otherwise - */ -static int -parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange) -{ - struct addrrange *addrrange; - - if (src->ls_len == 1 && src->ls_str[0] == '*') { - nidrange->nr_all = 1; - return 0; - } - - LIBCFS_ALLOC(addrrange, sizeof(struct addrrange)); - if (addrrange == NULL) - return -ENOMEM; - list_add_tail(&addrrange->ar_link, &nidrange->nr_addrranges); - INIT_LIST_HEAD(&addrrange->ar_numaddr_ranges); - - return nidrange->nr_netstrfns->nf_parse_addrlist(src->ls_str, - src->ls_len, - &addrrange->ar_numaddr_ranges); -} - -/** - * Finds or creates struct nidrange. - * - * Checks if \a src is a valid network name, looks for corresponding - * nidrange on the ist of nidranges (\a nidlist), creates new struct - * nidrange if it is not found. - * - * \retval pointer to struct nidrange matching network specified via \a src - * \retval NULL if \a src does not match any network - */ -static struct nidrange * -add_nidrange(const struct cfs_lstr *src, - struct list_head *nidlist) -{ - struct netstrfns *nf; - struct nidrange *nr; - int endlen; - unsigned netnum; - - if (src->ls_len >= LNET_NIDSTR_SIZE) - return NULL; - - nf = libcfs_namenum2netstrfns(src->ls_str); - if (nf == NULL) - return NULL; - endlen = src->ls_len - strlen(nf->nf_name); - if (endlen == 0) - /* network name only, e.g. "elan" or "tcp" */ - netnum = 0; - else { - /* e.g. "elan25" or "tcp23", refuse to parse if - * network name is not appended with decimal or - * hexadecimal number */ - if (!cfs_str2num_check(src->ls_str + strlen(nf->nf_name), - endlen, &netnum, 0, MAX_NUMERIC_VALUE)) - return NULL; - } - - list_for_each_entry(nr, nidlist, nr_link) { - if (nr->nr_netstrfns != nf) - continue; - if (nr->nr_netnum != netnum) - continue; - return nr; - } - - LIBCFS_ALLOC(nr, sizeof(struct nidrange)); - if (nr == NULL) - return NULL; - list_add_tail(&nr->nr_link, nidlist); - INIT_LIST_HEAD(&nr->nr_addrranges); - nr->nr_netstrfns = nf; - nr->nr_all = 0; - nr->nr_netnum = netnum; - - return nr; -} - -/** - * Parses \ token of the syntax. - * - * \retval 1 if \a src parses to \ '@' \ - * \retval 0 otherwise - */ -static int -parse_nidrange(struct cfs_lstr *src, struct list_head *nidlist) -{ - struct cfs_lstr addrrange; - struct cfs_lstr net; - struct cfs_lstr tmp; - struct nidrange *nr; - - tmp = *src; - if (cfs_gettok(src, '@', &addrrange) == 0) - goto failed; - - if (cfs_gettok(src, '@', &net) == 0 || src->ls_str != NULL) - goto failed; - - nr = add_nidrange(&net, nidlist); - if (nr == NULL) - goto failed; - - if (parse_addrange(&addrrange, nr) != 0) - goto failed; - - return 1; - failed: - CWARN("can't parse nidrange: \"%.*s\"\n", tmp.ls_len, tmp.ls_str); - return 0; -} - -/** - * Frees addrrange structures of \a list. - * - * For each struct addrrange structure found on \a list it frees - * cfs_expr_list list attached to it and frees the addrrange itself. - * - * \retval none - */ -static void -free_addrranges(struct list_head *list) -{ - while (!list_empty(list)) { - struct addrrange *ar; - - ar = list_entry(list->next, struct addrrange, ar_link); - - cfs_expr_list_free_list(&ar->ar_numaddr_ranges); - list_del(&ar->ar_link); - LIBCFS_FREE(ar, sizeof(struct addrrange)); - } -} - -/** - * Frees nidrange strutures of \a list. - * - * For each struct nidrange structure found on \a list it frees - * addrrange list attached to it and frees the nidrange itself. - * - * \retval none - */ -void -cfs_free_nidlist(struct list_head *list) -{ - struct list_head *pos, *next; - struct nidrange *nr; - - list_for_each_safe(pos, next, list) { - nr = list_entry(pos, struct nidrange, nr_link); - free_addrranges(&nr->nr_addrranges); - list_del(pos); - LIBCFS_FREE(nr, sizeof(struct nidrange)); - } -} -EXPORT_SYMBOL(cfs_free_nidlist); - -/** - * Parses nid range list. - * - * Parses with rigorous syntax and overflow checking \a str into - * \ [ ' ' \ ], compiles \a str into set of - * structures and links that structure to \a nidlist. The resulting - * list can be used to match a NID againts set of NIDS defined by \a - * str. - * \see cfs_match_nid - * - * \retval 1 on success - * \retval 0 otherwise - */ -int -cfs_parse_nidlist(char *str, int len, struct list_head *nidlist) -{ - struct cfs_lstr src; - struct cfs_lstr res; - int rc; - - src.ls_str = str; - src.ls_len = len; - INIT_LIST_HEAD(nidlist); - while (src.ls_str) { - rc = cfs_gettok(&src, ' ', &res); - if (rc == 0) { - cfs_free_nidlist(nidlist); - return 0; - } - rc = parse_nidrange(&res, nidlist); - if (rc == 0) { - cfs_free_nidlist(nidlist); - return 0; - } - } - return 1; -} -EXPORT_SYMBOL(cfs_parse_nidlist); - -/** - * Matches a nid (\a nid) against the compiled list of nidranges (\a nidlist). - * - * \see cfs_parse_nidlist() - * - * \retval 1 on match - * \retval 0 otherwises - */ -int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist) -{ - struct nidrange *nr; - struct addrrange *ar; - - list_for_each_entry(nr, nidlist, nr_link) { - if (nr->nr_netstrfns->nf_type != LNET_NETTYP(LNET_NIDNET(nid))) - continue; - if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid))) - continue; - if (nr->nr_all) - return 1; - list_for_each_entry(ar, &nr->nr_addrranges, ar_link) - if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid), - &ar->ar_numaddr_ranges)) - return 1; - } - return 0; -} -EXPORT_SYMBOL(cfs_match_nid); - -/** - * Print the network part of the nidrange \a nr into the specified \a buffer. - * - * \retval number of characters written - */ -static int -cfs_print_network(char *buffer, int count, struct nidrange *nr) -{ - struct netstrfns *nf = nr->nr_netstrfns; - - if (nr->nr_netnum == 0) - return scnprintf(buffer, count, "@%s", nf->nf_name); - else - return scnprintf(buffer, count, "@%s%u", - nf->nf_name, nr->nr_netnum); -} - -/** - * Print a list of addrrange (\a addrranges) into the specified \a buffer. - * At max \a count characters can be printed into \a buffer. - * - * \retval number of characters written - */ -static int -cfs_print_addrranges(char *buffer, int count, struct list_head *addrranges, - struct nidrange *nr) -{ - int i = 0; - struct addrrange *ar; - struct netstrfns *nf = nr->nr_netstrfns; - - list_for_each_entry(ar, addrranges, ar_link) { - if (i != 0) - i += scnprintf(buffer + i, count - i, " "); - i += nf->nf_print_addrlist(buffer + i, count - i, - &ar->ar_numaddr_ranges); - i += cfs_print_network(buffer + i, count - i, nr); - } - return i; -} - -/** - * Print a list of nidranges (\a nidlist) into the specified \a buffer. - * At max \a count characters can be printed into \a buffer. - * Nidranges are separated by a space character. - * - * \retval number of characters written - */ -int cfs_print_nidlist(char *buffer, int count, struct list_head *nidlist) -{ - int i = 0; - struct nidrange *nr; - - if (count <= 0) - return 0; - - list_for_each_entry(nr, nidlist, nr_link) { - if (i != 0) - i += scnprintf(buffer + i, count - i, " "); - - if (nr->nr_all != 0) { - LASSERT(list_empty(&nr->nr_addrranges)); - i += scnprintf(buffer + i, count - i, "*"); - i += cfs_print_network(buffer + i, count - i, nr); - } else { - i += cfs_print_addrranges(buffer + i, count - i, - &nr->nr_addrranges, nr); - } - } - return i; -} -EXPORT_SYMBOL(cfs_print_nidlist); -- 1.7.1 From bevans at cray.com Thu Oct 22 14:50:54 2015 From: bevans at cray.com (Ben Evans) Date: Thu, 22 Oct 2015 14:50:54 +0000 Subject: [lustre-devel] syncronous liblustreapi calls Message-ID: Is there some architectural reason behind a lack of synchronous calls to set values? As an example, the changelog_clear operation does some preliminary checking in liblustreapi for things like non-negative ranges, and that the changelog user is formatted correctly (not that the user actually exists). If everything checks out, it sends off an async request and tells the user everything is fine. On the MDS, many things may go wrong (such as the range being invalid, or the user not existing), and that gets written to the logs on the MDS, but there doesn’t seem to be a way of telling the user that something went wrong. Is there some backstory on this, or is it just an architectural consequence of the way Lustre works? -Ben Evans -------------- next part -------------- An HTML attachment was scrubbed... URL: From bevans at cray.com Thu Oct 22 15:58:23 2015 From: bevans at cray.com (Ben Evans) Date: Thu, 22 Oct 2015 15:58:23 +0000 Subject: [lustre-devel] layout.c capsule dumps Message-ID: Are these completely unused at this point? As far as I can tell, the main mechanism to dump info, req_capsule_(client|server)_dump are completely unreferenced by anything. Would it make sense to remove all this as dead code, or am I missing something? -Ben Evans -------------- next part -------------- An HTML attachment was scrubbed... URL: From lkp at intel.com Thu Oct 22 15:59:12 2015 From: lkp at intel.com (kbuild test robot) Date: Thu, 22 Oct 2015 23:59:12 +0800 Subject: [lustre-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait() In-Reply-To: Message-ID: <201510222318.nNtSfkKO%fengguang.wu@intel.com> Hi Benjamin, [auto build test ERROR on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848 config: x86_64-allnoconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): In file included from include/linux/cgroup.h:17:0, from include/linux/memcontrol.h:22, from include/linux/swap.h:8, from include/linux/suspend.h:4, from arch/x86/kernel/asm-offsets.c:12: >> include/linux/fs.h:1234:19: error: redefinition of 'locks_lock_file_wait' static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) ^ include/linux/fs.h:1181:19: note: previous definition of 'locks_lock_file_wait' was here static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) ^ include/linux/fs.h: In function 'locks_lock_file_wait': >> include/linux/fs.h:1236:9: error: implicit declaration of function 'locks_lock_inode_wait' [-Werror=implicit-function-declaration] return locks_lock_inode_wait(file_inode(filp), fl); ^ cc1: some warnings being treated as errors make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors. make[1]: *** [prepare0] Error 2 make[1]: Target 'prepare' not remade because of errors. make: *** [sub-make] Error 2 vim +/locks_lock_file_wait +1234 include/linux/fs.h 1228 1229 static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl) 1230 { 1231 return flock_lock_inode_wait(file_inode(filp), fl); 1232 } 1233 > 1234 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) 1235 { > 1236 return locks_lock_inode_wait(file_inode(filp), fl); 1237 } 1238 1239 struct fasync_struct { --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/octet-stream Size: 6030 bytes Desc: not available URL: From andreas.dilger at intel.com Thu Oct 22 16:10:22 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Thu, 22 Oct 2015 16:10:22 +0000 Subject: [lustre-devel] layout.c capsule dumps In-Reply-To: References: Message-ID: <6BD451EE-8F63-4343-BA8B-1CDB87462270@intel.com> They are only for debugging. Probably best to put them under CONFIG_DEBUG_LUSTRE_EXPENSIVE_CHECKS or some new CONFIG option. Cheers, Andreas > On Oct 22, 2015, at 09:58, Ben Evans wrote: > > Are these completely unused at this point? As far as I can tell, the main mechanism to dump info, req_capsule_(client|server)_dump are completely unreferenced by anything. > > Would it make sense to remove all this as dead code, or am I missing something? > > -Ben Evans > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From lkp at intel.com Thu Oct 22 16:36:55 2015 From: lkp at intel.com (kbuild test robot) Date: Fri, 23 Oct 2015 00:36:55 +0800 Subject: [lustre-devel] [RFC PATCH] locks: posix_lock_inode_wait() can be static In-Reply-To: References: <201510230020.vZvDxsE7%fengguang.wu@intel.com> Message-ID: <20151022163655.GA111096@roam> Signed-off-by: Fengguang Wu --- locks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index daf4664..0d2b326 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1173,7 +1173,7 @@ EXPORT_SYMBOL(posix_lock_file); * * Apply a POSIX style lock request to an inode. */ -int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl) +static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl) { int error; might_sleep (); @@ -1860,7 +1860,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg) * * Apply a FLOCK style lock request to an inode. */ -int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) +static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) { int error; might_sleep(); From lkp at intel.com Thu Oct 22 16:36:55 2015 From: lkp at intel.com (kbuild test robot) Date: Fri, 23 Oct 2015 00:36:55 +0800 Subject: [lustre-devel] [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait In-Reply-To: Message-ID: <201510230020.vZvDxsE7%fengguang.wu@intel.com> Hi Benjamin, [auto build test WARNING on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) >> fs/locks.c:1176:5: sparse: symbol 'posix_lock_inode_wait' was not declared. Should it be static? >> fs/locks.c:1863:5: sparse: symbol 'flock_lock_inode_wait' was not declared. Should it be static? Please review and possibly fold the followup patch. --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation From dan.carpenter at oracle.com Thu Oct 22 19:48:19 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 22 Oct 2015 22:48:19 +0300 Subject: [lustre-devel] [PATCH] staging: lustre: o2iblnd: fix misleading indentation In-Reply-To: <1445449240-30305-1-git-send-email-luisbg@osg.samsung.com> References: <1445449240-30305-1-git-send-email-luisbg@osg.samsung.com> Message-ID: <20151022194819.GR7340@mwanda> On Wed, Oct 21, 2015 at 06:40:40PM +0100, Luis de Bethencourt wrote: > The code is correct, the indentation is misleading. Only the the return rc > is part of the conditional statement if rc != 0. > > Fix a smatch warning: > drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:2157 > kiblnd_hdev_setup_mrs() warn: curly braces intended? > > Signed-off-by: Luis de Bethencourt > --- > > Hi, > > This patch gives a warning in checkpatch.pl for the line: > if (hdev->ibh_mrs == NULL) > > It would be cleaner if this was 'if (!hdev->ibh_mrs)' instead. I didn't fix > this as well because the file has 41 instances of comparisons with NULL. I > would be happy to do so in a patch in reply to this one if it would be good. > You did the right thing. One thing per patch. regards, dan carpenter From shraddha.6596 at gmail.com Fri Oct 23 09:57:57 2015 From: shraddha.6596 at gmail.com (Shraddha Barke) Date: Fri, 23 Oct 2015 15:27:57 +0530 Subject: [lustre-devel] [PATCH] Staging: lustre: obdclass: Remove unused header files Message-ID: <1445594277-14421-1-git-send-email-shraddha.6596@gmail.com> Remove unused header files that are already included in 'lu_object.h' and 'obd.h' Signed-off-by: Shraddha Barke --- drivers/staging/lustre/lustre/obdclass/lu_object.c | 1 - drivers/staging/lustre/lustre/obdclass/lu_ref.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 0d15bd5..549df95 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -55,7 +55,6 @@ #include "../include/lustre_disk.h" #include "../include/lustre_fid.h" #include "../include/lu_object.h" -#include "../include/lu_ref.h" #include static void lu_object_free(const struct lu_env *env, struct lu_object *o); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_ref.c b/drivers/staging/lustre/lustre/obdclass/lu_ref.c index 993697b..df2d8b9 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_ref.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_ref.c @@ -47,4 +47,3 @@ #include "../include/obd.h" #include "../include/obd_class.h" #include "../include/obd_support.h" -#include "../include/lu_ref.h" -- 2.1.4 From julia.lawall at lip6.fr Fri Oct 23 09:59:41 2015 From: julia.lawall at lip6.fr (Julia Lawall) Date: Fri, 23 Oct 2015 11:59:41 +0200 (CEST) Subject: [lustre-devel] [Outreachy kernel] [PATCH] Staging: lustre: obdclass: Remove unused header files In-Reply-To: <1445594277-14421-1-git-send-email-shraddha.6596@gmail.com> References: <1445594277-14421-1-git-send-email-shraddha.6596@gmail.com> Message-ID: On Fri, 23 Oct 2015, Shraddha Barke wrote: > Remove unused header files that are already included in 'lu_object.h' > and 'obd.h' > > Signed-off-by: Shraddha Barke > --- > drivers/staging/lustre/lustre/obdclass/lu_object.c | 1 - > drivers/staging/lustre/lustre/obdclass/lu_ref.c | 1 - > 2 files changed, 2 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c > index 0d15bd5..549df95 100644 > --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c > +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c > @@ -55,7 +55,6 @@ > #include "../include/lustre_disk.h" > #include "../include/lustre_fid.h" > #include "../include/lu_object.h" > -#include "../include/lu_ref.h" If things from lu_ref.h are directly referred to in the .c file, it may be better to keep the include, rather than relying on some other include file (that could change in the future) to include it. julia > #include > > static void lu_object_free(const struct lu_env *env, struct lu_object *o); > diff --git a/drivers/staging/lustre/lustre/obdclass/lu_ref.c b/drivers/staging/lustre/lustre/obdclass/lu_ref.c > index 993697b..df2d8b9 100644 > --- a/drivers/staging/lustre/lustre/obdclass/lu_ref.c > +++ b/drivers/staging/lustre/lustre/obdclass/lu_ref.c > @@ -47,4 +47,3 @@ > #include "../include/obd.h" > #include "../include/obd_class.h" > #include "../include/obd_support.h" > -#include "../include/lu_ref.h" > -- > 2.1.4 > > -- > 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 outreachy-kernel+unsubscribe at googlegroups.com. > To post to this group, send email to outreachy-kernel at googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1445594277-14421-1-git-send-email-shraddha.6596%40gmail.com. > For more options, visit https://groups.google.com/d/optout. > From bcodding at redhat.com Thu Oct 22 15:35:54 2015 From: bcodding at redhat.com (Benjamin Coddington) Date: Thu, 22 Oct 2015 11:35:54 -0400 Subject: [lustre-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait() In-Reply-To: References: Message-ID: Users of the locks API commonly call either posix_lock_file_wait() or flock_lock_file_wait() depending upon the lock type. Add a new function locks_lock_inode_wait() which will check and call the correct function for the type of lock passed in. Signed-off-by: Benjamin Coddington --- fs/locks.c | 24 ++++++++++++++++++++++++ include/linux/fs.h | 11 +++++++++++ 2 files changed, 35 insertions(+), 0 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index 2a54c80..68b1784 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) EXPORT_SYMBOL(flock_lock_inode_wait); /** + * locks_lock_inode_wait - Apply a lock to an inode + * @inode: inode of the file to apply to + * @fl: The lock to be applied + * + * Apply a POSIX or FLOCK style lock request to an inode. + */ +int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl) +{ + int res = 0; + switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { + case FL_POSIX: + res = posix_lock_inode_wait(inode, fl); + break; + case FL_FLOCK: + res = flock_lock_inode_wait(inode, fl); + break; + default: + BUG(); + } + return res; +} +EXPORT_SYMBOL(locks_lock_inode_wait); + +/** * sys_flock: - flock() system call. * @fd: the file descriptor to lock. * @cmd: the type of lock to apply. diff --git a/include/linux/fs.h b/include/linux/fs.h index 72d8a84..2e283b7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *); extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl); +extern int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl); extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); extern void lease_get_mtime(struct inode *, struct timespec *time); extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); @@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode, return -ENOLCK; } +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) +{ + return -ENOLCK; +} + static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type) { return 0; @@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl) return flock_lock_inode_wait(file_inode(filp), fl); } +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) +{ + return locks_lock_inode_wait(file_inode(filp), fl); +} + struct fasync_struct { spinlock_t fa_lock; int magic; -- 1.7.1 From bcodding at redhat.com Thu Oct 22 15:35:56 2015 From: bcodding at redhat.com (Benjamin Coddington) Date: Thu, 22 Oct 2015 11:35:56 -0400 Subject: [lustre-devel] [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait In-Reply-To: References: Message-ID: All callers use locks_lock_inode_wait() instead. Signed-off-by: Benjamin Coddington --- fs/locks.c | 5 +---- include/linux/fs.h | 24 ------------------------ 2 files changed, 1 insertions(+), 28 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index 94d50d3..b6f3c92 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1167,8 +1167,7 @@ EXPORT_SYMBOL(posix_lock_file); * @inode: inode of file to which lock request should be applied * @fl: The lock to be applied * - * Variant of posix_lock_file_wait that does not take a filp, and so can be - * used after the filp has already been torn down. + * Apply a POSIX style lock request to an inode. */ int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl) { @@ -1187,7 +1186,6 @@ int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl) } return error; } -EXPORT_SYMBOL(posix_lock_inode_wait); /** * locks_mandatory_locked - Check for an active lock @@ -1873,7 +1871,6 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) } return error; } -EXPORT_SYMBOL(flock_lock_inode_wait); /** * locks_lock_inode_wait - Apply a lock to an inode diff --git a/include/linux/fs.h b/include/linux/fs.h index 2e283b7..05b07c9 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1053,12 +1053,10 @@ extern void locks_remove_file(struct file *); extern void locks_release_private(struct file_lock *); extern void posix_test_lock(struct file *, struct file_lock *); extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); -extern int posix_lock_inode_wait(struct inode *, struct file_lock *); extern int posix_unblock_lock(struct file_lock *); extern int vfs_test_lock(struct file *, struct file_lock *); extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); -extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl); extern int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl); extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); extern void lease_get_mtime(struct inode *, struct timespec *time); @@ -1145,12 +1143,6 @@ static inline int posix_lock_file(struct file *filp, struct file_lock *fl, return -ENOLCK; } -static inline int posix_lock_inode_wait(struct inode *inode, - struct file_lock *fl) -{ - return -ENOLCK; -} - static inline int posix_unblock_lock(struct file_lock *waiter) { return -ENOENT; @@ -1172,12 +1164,6 @@ static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl) return 0; } -static inline int flock_lock_inode_wait(struct inode *inode, - struct file_lock *request) -{ - return -ENOLCK; -} - static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) { return -ENOLCK; @@ -1221,16 +1207,6 @@ static inline struct inode *file_inode(const struct file *f) return f->f_inode; } -static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl) -{ - return posix_lock_inode_wait(file_inode(filp), fl); -} - -static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl) -{ - return flock_lock_inode_wait(file_inode(filp), fl); -} - static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) { return locks_lock_inode_wait(file_inode(filp), fl); -- 1.7.1 From bcodding at redhat.com Thu Oct 22 16:21:44 2015 From: bcodding at redhat.com (Benjamin Coddington) Date: Thu, 22 Oct 2015 12:21:44 -0400 (EDT) Subject: [lustre-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait() In-Reply-To: References: Message-ID: On Thu, 22 Oct 2015, Benjamin Coddington wrote: > Users of the locks API commonly call either posix_lock_file_wait() or > flock_lock_file_wait() depending upon the lock type. Add a new function > locks_lock_inode_wait() which will check and call the correct function for > the type of lock passed in. > > Signed-off-by: Benjamin Coddington > --- > fs/locks.c | 24 ++++++++++++++++++++++++ > include/linux/fs.h | 11 +++++++++++ > 2 files changed, 35 insertions(+), 0 deletions(-) > > diff --git a/fs/locks.c b/fs/locks.c > index 2a54c80..68b1784 100644 > --- a/fs/locks.c > +++ b/fs/locks.c > @@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) > EXPORT_SYMBOL(flock_lock_inode_wait); > > /** > + * locks_lock_inode_wait - Apply a lock to an inode > + * @inode: inode of the file to apply to > + * @fl: The lock to be applied > + * > + * Apply a POSIX or FLOCK style lock request to an inode. > + */ > +int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl) > +{ > + int res = 0; > + switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { > + case FL_POSIX: > + res = posix_lock_inode_wait(inode, fl); > + break; > + case FL_FLOCK: > + res = flock_lock_inode_wait(inode, fl); > + break; > + default: > + BUG(); > + } > + return res; > +} > +EXPORT_SYMBOL(locks_lock_inode_wait); > + > +/** > * sys_flock: - flock() system call. > * @fd: the file descriptor to lock. > * @cmd: the type of lock to apply. > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 72d8a84..2e283b7 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *); > extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); > extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); > extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl); > +extern int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl); > extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); > extern void lease_get_mtime(struct inode *, struct timespec *time); > extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); > @@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode, > return -ENOLCK; > } > > +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) > +{ > + return -ENOLCK; > +} > + So, this is obviously wrong - thank you 0-day robot. Yes, I did build and test against these patches, but went back and added this after I realized it should work w/o CONFIG_FILE_LOCKING. I'll re-send. Ben > static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type) > { > return 0; > @@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl) > return flock_lock_inode_wait(file_inode(filp), fl); > } > > +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl) > +{ > + return locks_lock_inode_wait(file_inode(filp), fl); > +} > + > struct fasync_struct { > spinlock_t fa_lock; > int magic; > -- > 1.7.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > From bcodding at redhat.com Thu Oct 22 15:35:53 2015 From: bcodding at redhat.com (Benjamin Coddington) Date: Thu, 22 Oct 2015 11:35:53 -0400 Subject: [lustre-devel] [PATCH 0/3] Minor cleanup for locks API Message-ID: NFS has recently been moving things around to cope with the situation where a struct file may not be available during an unlock. That work has presented an opportunity to do a minor cleanup on the locks API. Users of posix_lock_file_wait() (for FL_POSIX style locks) and flock_lock_file_wait() (for FL_FLOCK style locks) can instead call locks_lock_file_wait() for both lock types. Because the passed-in file_lock specifies its own type, the correct function can be selected on behalf of the user. This work allows further cleanup within NFS and lockd which will be submitted separately. Benjamin Coddington (3): locks: introduce locks_lock_inode_wait() Move locks API users to locks_lock_inode_wait() locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait drivers/staging/lustre/lustre/llite/file.c | 8 +----- fs/9p/vfs_file.c | 4 +- fs/ceph/locks.c | 4 +- fs/cifs/file.c | 2 +- fs/dlm/plock.c | 4 +- fs/fuse/file.c | 2 +- fs/gfs2/file.c | 8 +++--- fs/lockd/clntproc.c | 13 +---------- fs/locks.c | 31 +++++++++++++++++++++++---- fs/nfs/file.c | 13 +---------- fs/nfs/nfs4proc.c | 13 +---------- fs/ocfs2/locks.c | 8 +++--- include/linux/fs.h | 21 +++--------------- 13 files changed, 51 insertions(+), 80 deletions(-) From bcodding at redhat.com Thu Oct 22 15:35:55 2015 From: bcodding at redhat.com (Benjamin Coddington) Date: Thu, 22 Oct 2015 11:35:55 -0400 Subject: [lustre-devel] [PATCH 2/3] Move locks API users to locks_lock_inode_wait() In-Reply-To: References: Message-ID: Instead of having users check for FL_POSIX or FL_FLOCK to call the correct locks API function, use the check within locks_lock_inode_wait(). This allows for some later cleanup. Signed-off-by: Benjamin Coddington --- drivers/staging/lustre/lustre/llite/file.c | 8 ++------ fs/9p/vfs_file.c | 4 ++-- fs/ceph/locks.c | 4 ++-- fs/cifs/file.c | 2 +- fs/dlm/plock.c | 4 ++-- fs/fuse/file.c | 2 +- fs/gfs2/file.c | 8 ++++---- fs/lockd/clntproc.c | 13 +------------ fs/locks.c | 2 +- fs/nfs/file.c | 13 +------------ fs/nfs/nfs4proc.c | 13 +------------ fs/ocfs2/locks.c | 8 ++++---- 12 files changed, 22 insertions(+), 59 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index dcd0c6d..4edbf46 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2763,13 +2763,9 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL, op_data, &lockh, &flock, 0, NULL /* req */, flags); - if ((file_lock->fl_flags & FL_FLOCK) && - (rc == 0 || file_lock->fl_type == F_UNLCK)) - rc2 = flock_lock_file_wait(file, file_lock); - if ((file_lock->fl_flags & FL_POSIX) && - (rc == 0 || file_lock->fl_type == F_UNLCK) && + if ((rc == 0 || file_lock->fl_type == F_UNLCK) && !(flags & LDLM_FL_TEST_LOCK)) - rc2 = posix_lock_file_wait(file, file_lock); + rc2 = locks_lock_file_wait(file, file_lock); if (rc2 && file_lock->fl_type != F_UNLCK) { einfo.ei_mode = LCK_NL; diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 3abc447..f23fd86 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -161,7 +161,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) if ((fl->fl_flags & FL_POSIX) != FL_POSIX) BUG(); - res = posix_lock_file_wait(filp, fl); + res = locks_lock_file_wait(filp, fl); if (res < 0) goto out; @@ -231,7 +231,7 @@ out_unlock: if (res < 0 && fl->fl_type != F_UNLCK) { fl_type = fl->fl_type; fl->fl_type = F_UNLCK; - res = posix_lock_file_wait(filp, fl); + res = locks_lock_file_wait(filp, fl); fl->fl_type = fl_type; } out: diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c index 6706bde..a2cb0c2 100644 --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c @@ -228,12 +228,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK, file, lock_cmd, wait, fl); if (!err) { - err = flock_lock_file_wait(file, fl); + err = locks_lock_file_wait(file, fl); if (err) { ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK, file, CEPH_LOCK_UNLOCK, 0, fl); - dout("got %d on flock_lock_file_wait, undid lock", err); + dout("got %d on locks_lock_file_wait, undid lock", err); } } return err; diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e2a6af1..6afdad7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1553,7 +1553,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, out: if (flock->fl_flags & FL_POSIX && !rc) - rc = posix_lock_file_wait(file, flock); + rc = locks_lock_file_wait(file, flock); return rc; } diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index 5532f09..3585cc0 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c @@ -172,7 +172,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file, rv = op->info.rv; if (!rv) { - if (posix_lock_file_wait(file, fl) < 0) + if (locks_lock_file_wait(file, fl) < 0) log_error(ls, "dlm_posix_lock: vfs lock error %llx", (unsigned long long)number); } @@ -262,7 +262,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, /* cause the vfs unlock to return ENOENT if lock is not found */ fl->fl_flags |= FL_EXISTS; - rv = posix_lock_file_wait(file, fl); + rv = locks_lock_file_wait(file, fl); if (rv == -ENOENT) { rv = 0; goto out_free; diff --git a/fs/fuse/file.c b/fs/fuse/file.c index f523f2f..e0faf8f 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2189,7 +2189,7 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl) int err; if (fc->no_flock) { - err = flock_lock_file_wait(file, fl); + err = locks_lock_file_wait(file, fl); } else { struct fuse_file *ff = file->private_data; diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index cf4ab89..9287a2d 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -1000,7 +1000,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) } if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) { if (fl->fl_type == F_UNLCK) - posix_lock_file_wait(file, fl); + locks_lock_file_wait(file, fl); return -EIO; } if (IS_GETLK(cmd)) @@ -1031,7 +1031,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) if (gl) { if (fl_gh->gh_state == state) goto out; - flock_lock_file_wait(file, + locks_lock_file_wait(file, &(struct file_lock){.fl_type = F_UNLCK}); gfs2_glock_dq(fl_gh); gfs2_holder_reinit(state, flags, fl_gh); @@ -1056,7 +1056,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) if (error == GLR_TRYFAILED) error = -EAGAIN; } else { - error = flock_lock_file_wait(file, fl); + error = locks_lock_file_wait(file, fl); gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error); } @@ -1071,7 +1071,7 @@ static void do_unflock(struct file *file, struct file_lock *fl) struct gfs2_holder *fl_gh = &fp->f_fl_gh; mutex_lock(&fp->f_fl_mutex); - flock_lock_file_wait(file, fl); + locks_lock_file_wait(file, fl); if (fl_gh->gh_gl) { gfs2_glock_dq(fl_gh); gfs2_holder_uninit(fl_gh); diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index acd3947..1129520 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c @@ -474,18 +474,7 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho static int do_vfs_lock(struct file_lock *fl) { - int res = 0; - switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { - case FL_POSIX: - res = posix_lock_file_wait(fl->fl_file, fl); - break; - case FL_FLOCK: - res = flock_lock_file_wait(fl->fl_file, fl); - break; - default: - BUG(); - } - return res; + return locks_lock_file_wait(fl->fl_file, fl); } /* diff --git a/fs/locks.c b/fs/locks.c index 68b1784..94d50d3 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1955,7 +1955,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) (can_sleep) ? F_SETLKW : F_SETLK, lock); else - error = flock_lock_file_wait(f.file, lock); + error = locks_lock_file_wait(f.file, lock); out_free: locks_free_lock(lock); diff --git a/fs/nfs/file.c b/fs/nfs/file.c index c0f9b1e..37f639d 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -738,18 +738,7 @@ out_noconflict: static int do_vfs_lock(struct file *file, struct file_lock *fl) { - int res = 0; - switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { - case FL_POSIX: - res = posix_lock_file_wait(file, fl); - break; - case FL_FLOCK: - res = flock_lock_file_wait(file, fl); - break; - default: - BUG(); - } - return res; + return locks_lock_file_wait(file, fl); } static int diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 5133bb1..0e5ff69 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -5513,18 +5513,7 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock * static int do_vfs_lock(struct inode *inode, struct file_lock *fl) { - int res = 0; - switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { - case FL_POSIX: - res = posix_lock_inode_wait(inode, fl); - break; - case FL_FLOCK: - res = flock_lock_inode_wait(inode, fl); - break; - default: - BUG(); - } - return res; + return locks_lock_inode_wait(inode, fl); } struct nfs4_unlockdata { diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c index 6b6d092..652ece4 100644 --- a/fs/ocfs2/locks.c +++ b/fs/ocfs2/locks.c @@ -66,7 +66,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode, * level. */ - flock_lock_file_wait(file, + locks_lock_file_wait(file, &(struct file_lock){.fl_type = F_UNLCK}); ocfs2_file_unlock(file); @@ -81,7 +81,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode, goto out; } - ret = flock_lock_file_wait(file, fl); + ret = locks_lock_file_wait(file, fl); if (ret) ocfs2_file_unlock(file); @@ -98,7 +98,7 @@ static int ocfs2_do_funlock(struct file *file, int cmd, struct file_lock *fl) mutex_lock(&fp->fp_mutex); ocfs2_file_unlock(file); - ret = flock_lock_file_wait(file, fl); + ret = locks_lock_file_wait(file, fl); mutex_unlock(&fp->fp_mutex); return ret; @@ -119,7 +119,7 @@ int ocfs2_flock(struct file *file, int cmd, struct file_lock *fl) if ((osb->s_mount_opt & OCFS2_MOUNT_LOCALFLOCKS) || ocfs2_mount_local(osb)) - return flock_lock_file_wait(file, fl); + return locks_lock_file_wait(file, fl); if (fl->fl_type == F_UNLCK) return ocfs2_do_funlock(file, cmd, fl); -- 1.7.1 From jsimmons at infradead.org Fri Oct 23 19:59:13 2015 From: jsimmons at infradead.org (James Simmons) Date: Fri, 23 Oct 2015 15:59:13 -0400 Subject: [lustre-devel] [PATCH 1/5] staging:lustre: kg_sem semaphore handling is incorrectly In-Reply-To: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> References: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445630357-27149-2-git-send-email-jsimmons@infradead.org> During the removal of the cfs wrappers the kg_sem semaphore was handled incorrectly. We need to take a write lock when writing data to the kkuc_groups. The libcfs_kkuc_group_foreach needs to only take a read lock. This makes use match the OpenSFS development branch. Signed-off-by: James Simmons --- .../lustre/lustre/libcfs/kernel_user_comm.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c index d9b7c6b..48df275 100644 --- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c @@ -184,7 +184,7 @@ int libcfs_kkuc_group_put(int group, void *payload) int rc = 0; int one_success = 0; - down_read(&kg_sem); + down_write(&kg_sem); list_for_each_entry(reg, &kkuc_groups[group], kr_chain) { if (reg->kr_fp != NULL) { rc = libcfs_kkuc_msg_put(reg->kr_fp, payload); @@ -196,7 +196,7 @@ int libcfs_kkuc_group_put(int group, void *payload) } } } - up_read(&kg_sem); + up_write(&kg_sem); /* don't return an error if the message has been delivered * at least to one agent */ @@ -228,12 +228,12 @@ int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func, if (kkuc_groups[group].next == NULL) return 0; - down_write(&kg_sem); + down_read(&kg_sem); list_for_each_entry(reg, &kkuc_groups[group], kr_chain) { if (reg->kr_fp != NULL) rc = cb_func(reg->kr_data, cb_arg); } - up_write(&kg_sem); + up_read(&kg_sem); return rc; } -- 1.7.1 From jsimmons at infradead.org Fri Oct 23 19:59:12 2015 From: jsimmons at infradead.org (James Simmons) Date: Fri, 23 Oct 2015 15:59:12 -0400 Subject: [lustre-devel] [PATCH 0/5] staging:lustre: split kernel comm between user and kernel Message-ID: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> The kernel communication code used for HSM and changelog is entangled. Move the user space bits into the liblustreapi. This will also help for a possible relicensing. The kernel portion is also moved from libcfs to obdclass. The original libcfs_kernelcomm.h header is split into three parts: * lustre_kernelcomm.h, a new header for the kernel parts; * uapi_kernelcomm.h, a new header for the data structures shared between userspace and kernelspace; * lustreapi_internal.h receives the private liblustreapi prototypes. The original code in kernel_user_comm.c is split into two parts: * obdclass/kernelcomm.c for the kernel part. filp_user_write() was moved there, and linux-fs.c deleted; * liblustreapi_kernelconn.c for the user part. The calls to CDEBUG have been removed, and calls to CERROR have been transformed to llapi_err_noerrno. The type lustre_kernelcomm has been removed and replace by struct lustre_kernelcomm. Various names and filenames have been harmonized to *kernelcomm*. The unused symbol KUC_FL_BLOCK has been removed. Signed-off-by: frank zago Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/14270 Reviewed-by: Nathan Rutman Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Henri Doreau (1): staging:lustre: Prevent duplicate CT registrations James Simmons (1): staging:lustre: kg_sem semaphore handling is incorrectly frank zago (3): staging:lustre: move kernel_user_comm.c from libcfs to lustre staging:lustre: split kernel comm between user and kernel staging:lustre: Update license and copyright for kernel comm .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - .../staging/lustre/lustre/include/lustre_export.h | 7 +++ .../lustre/lustre/include/lustre_kernelcomm.h | 56 ++++++++++++++++++++ .../include/uapi_kernelcomm.h} | 52 +++++-------------- drivers/staging/lustre/lustre/libcfs/Makefile | 5 +- drivers/staging/lustre/lustre/llite/dir.c | 1 + drivers/staging/lustre/lustre/lmv/lmv_obd.c | 43 +++++++++++----- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 2 + drivers/staging/lustre/lustre/mdc/mdc_request.c | 23 +++++--- drivers/staging/lustre/lustre/obdclass/Makefile | 7 ++- drivers/staging/lustre/lustre/obdclass/genops.c | 1 + .../kernel_user_comm.c => obdclass/kernelcomm.c} | 40 +++++++------- 12 files changed, 150 insertions(+), 88 deletions(-) create mode 100644 drivers/staging/lustre/lustre/include/lustre_kernelcomm.h rename drivers/staging/lustre/{include/linux/libcfs/libcfs_kernelcomm.h => lustre/include/uapi_kernelcomm.h} (61%) rename drivers/staging/lustre/lustre/{libcfs/kernel_user_comm.c => obdclass/kernelcomm.c} (88%) From jsimmons at infradead.org Fri Oct 23 19:59:15 2015 From: jsimmons at infradead.org (James Simmons) Date: Fri, 23 Oct 2015 15:59:15 -0400 Subject: [lustre-devel] [PATCH] staging:lustre: move kernel_user_comm.c from libcfs to lustre In-Reply-To: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> References: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445630357-27149-4-git-send-email-jsimmons@infradead.org> From: frank zago Move the kernel portion from libcfs to obdclass. This code is only used by lustre. This is broken out of the original patch 14270. The part covered by this change is as follows: The original code in kernel_user_comm.c is split into two parts: * obdclass/kernelcomm.c for the kernel part. filp_user_write() was moved there, and linux-fs.c deleted; * liblustreapi_kernelconn.c for the user part. The calls to CDEBUG have been removed, and calls to CERROR have been transformed to llapi_err_noerrno. The type lustre_kernelcomm has been removed and replace by struct lustre_kernelcomm. Various names and filenames have been harmonized to *kernelcomm*. Signed-off-by: frank zago Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/14270 Reviewed-by: Nathan Rutman Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/libcfs/Makefile | 5 ++--- drivers/staging/lustre/lustre/obdclass/Makefile | 10 +++++----- .../kernel_user_comm.c => obdclass/kernelcomm.c} | 0 3 files changed, 7 insertions(+), 8 deletions(-) rename drivers/staging/lustre/lustre/{libcfs/kernel_user_comm.c => obdclass/kernelcomm.c} (100%) diff --git a/drivers/staging/lustre/lustre/libcfs/Makefile b/drivers/staging/lustre/lustre/libcfs/Makefile index 03d3f3d..277c123 100644 --- a/drivers/staging/lustre/lustre/libcfs/Makefile +++ b/drivers/staging/lustre/lustre/libcfs/Makefile @@ -11,8 +11,7 @@ libcfs-linux-objs += linux-mem.o libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs)) libcfs-all-objs := debug.o fail.o module.o tracefile.o \ - libcfs_string.o hash.o kernel_user_comm.o \ - prng.o workitem.o libcfs_cpu.o \ - libcfs_mem.o libcfs_lock.o + libcfs_string.o hash.o prng.o workitem.o \ + libcfs_cpu.o libcfs_mem.o libcfs_lock.o libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs) diff --git a/drivers/staging/lustre/lustre/obdclass/Makefile b/drivers/staging/lustre/lustre/obdclass/Makefile index acc6857..c404eb3 100644 --- a/drivers/staging/lustre/lustre/obdclass/Makefile +++ b/drivers/staging/lustre/lustre/obdclass/Makefile @@ -2,8 +2,8 @@ obj-$(CONFIG_LUSTRE_FS) += obdclass.o obdclass-y := linux/linux-module.o linux/linux-obdo.o linux/linux-sysctl.o \ llog.o llog_cat.o llog_obd.o llog_swab.o class_obd.o debug.o \ - genops.o uuid.o lprocfs_status.o \ - lustre_handles.o lustre_peer.o \ - statfs_pack.o obdo.o obd_config.o obd_mount.o \ - lu_object.o cl_object.o \ - cl_page.o cl_lock.o cl_io.o lu_ref.o acl.o lprocfs_counters.o + genops.o uuid.o lprocfs_status.o lprocfs_counters.o \ + lustre_handles.o lustre_peer.o statfs_pack.o \ + obdo.o obd_config.o obd_mount.o lu_object.o lu_ref.o \ + cl_object.o cl_page.o cl_lock.o cl_io.o \ + acl.o kernelcomm.o diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c similarity index 100% rename from drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c rename to drivers/staging/lustre/lustre/obdclass/kernelcomm.c -- 1.7.1 From jsimmons at infradead.org Fri Oct 23 19:59:14 2015 From: jsimmons at infradead.org (James Simmons) Date: Fri, 23 Oct 2015 15:59:14 -0400 Subject: [lustre-devel] [PATCH] staging:lustre: Prevent duplicate CT registrations In-Reply-To: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> References: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445630357-27149-3-git-send-email-jsimmons@infradead.org> From: Henri Doreau Associate copytool registration to a given MDC import so that multiple mounts of the same filesystem do not lead to having the copytool registered multiple time. Signed-off-by: Henri Doreau Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3882 Reviewed-on: http://review.whamcloud.com/7612 Reviewed-by: John L. Hammond Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../include/linux/libcfs/libcfs_kernelcomm.h | 6 ++-- .../staging/lustre/lustre/include/lustre_export.h | 7 ++++ .../lustre/lustre/libcfs/kernel_user_comm.c | 15 +++++--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 39 +++++++++++++++----- drivers/staging/lustre/lustre/mdc/mdc_request.c | 22 +++++++---- 5 files changed, 62 insertions(+), 27 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index a989d26..7323ca6 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -77,7 +77,7 @@ enum kuc_generic_message_type { }; /* prototype for callback function on kuc groups */ -typedef int (*libcfs_kkuc_cb_t)(__u32 data, void *cb_arg); +typedef int (*libcfs_kkuc_cb_t)(void *data, void *cb_arg); /* KUC Broadcast Groups. This determines which userspace process hears which * messages. Mutliple transports may be used within a group, or multiple @@ -92,8 +92,8 @@ typedef int (*libcfs_kkuc_cb_t)(__u32 data, void *cb_arg); int libcfs_kkuc_msg_put(struct file *fp, void *payload); int libcfs_kkuc_group_put(int group, void *payload); int libcfs_kkuc_group_add(struct file *fp, int uid, int group, - __u32 data); -int libcfs_kkuc_group_rem(int uid, int group); + void *data); +int libcfs_kkuc_group_rem(int uid, int group, void **pdata); int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func, void *cb_arg); diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 1daf4c5..e0a5171 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -338,6 +338,13 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp) struct obd_export *class_conn2export(struct lustre_handle *conn); +#define KKUC_CT_DATA_MAGIC 0x092013cea +struct kkuc_ct_data { + __u32 kcd_magic; + struct obd_uuid kcd_uuid; + __u32 kcd_archive; +}; + /** @} export */ #endif /* __EXPORT_H */ diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c index 862d920..04c6d2d 100644 --- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c @@ -95,10 +95,10 @@ EXPORT_SYMBOL(libcfs_kkuc_msg_put); * group from any fs */ /** A single group registration has a uid and a file pointer */ struct kkuc_reg { - struct list_head kr_chain; - int kr_uid; + struct list_head kr_chain; + int kr_uid; struct file *kr_fp; - __u32 kr_data; + void *kr_data; }; static struct list_head kkuc_groups[KUC_GRP_MAX+1] = {}; @@ -109,8 +109,9 @@ static DECLARE_RWSEM(kg_sem); * @param filp pipe to write into * @param uid identifier for this receiver * @param group group number + * @param data user data */ -int libcfs_kkuc_group_add(struct file *filp, int uid, int group, __u32 data) +int libcfs_kkuc_group_add(struct file *filp, int uid, int group, void *data) { struct kkuc_reg *reg; @@ -144,7 +145,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, int group, __u32 data) } EXPORT_SYMBOL(libcfs_kkuc_group_add); -int libcfs_kkuc_group_rem(int uid, int group) +int libcfs_kkuc_group_rem(int uid, int group, void **pdata) { struct kkuc_reg *reg, *next; @@ -170,6 +171,8 @@ int libcfs_kkuc_group_rem(int uid, int group) reg->kr_uid, reg->kr_fp, group); if (reg->kr_fp != NULL) fput(reg->kr_fp); + if (pdata != NULL) + *pdata = reg->kr_data; kfree(reg); } } @@ -212,7 +215,7 @@ EXPORT_SYMBOL(libcfs_kkuc_group_put); * Calls a callback function for each link of the given kuc group. * @param group the group to call the function on. * @param cb_func the function to be called. - * @param cb_arg iextra argument to be passed to the callback function. + * @param cb_arg extra argument to be passed to the callback function. */ int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func, void *cb_arg) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 635a93c..d6d70d8 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -794,7 +794,9 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv, static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len, struct lustre_kernelcomm *lk, void *uarg) { - int i, rc = 0; + struct kkuc_ct_data *kcd = NULL; + int rc = 0; + __u32 i; /* unregister request (call from llapi_hsm_copytool_fini) */ for (i = 0; i < lmv->desc.ld_tgt_count; i++) { @@ -807,17 +809,21 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len, * Unreached coordinators will get EPIPE on next requests * and will unregister automatically. */ - rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group); + rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group, (void**)&kcd); + if (kcd != NULL) + kfree(kcd); + return rc; } static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, struct lustre_kernelcomm *lk, void *uarg) { - struct file *filp; - int i, j, err; - int rc = 0; - bool any_set = false; + struct file *filp; + __u32 i, j; + int err, rc = 0; + bool any_set = false; + struct kkuc_ct_data *kcd; /* All or nothing: try to register to all MDS. * In case of failure, unregister from previous MDS, @@ -854,12 +860,25 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, /* at least one registration done, with no failure */ filp = fget(lk->lk_wfd); - if (filp == NULL) { + if (filp == NULL) return -EBADF; - } - rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group, lk->lk_data); - if (rc != 0 && filp != NULL) + + kcd = kzalloc(sizeof(*kcd), GFP_NOFS); + if (kcd == NULL) { fput(filp); + return -ENOMEM; + } + kcd->kcd_magic = KKUC_CT_DATA_MAGIC; + kcd->kcd_uuid = lmv->cluuid; + kcd->kcd_archive = lk->lk_data; + + rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group, kcd); + if (rc != 0) { + if (filp != NULL) + fput(filp); + kfree(kcd); + } + return rc; } diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 16a5a10..ee9381c 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2018,21 +2018,27 @@ static int mdc_hsm_copytool_send(int len, void *val) /** * callback function passed to kuc for re-registering each HSM copytool * running on MDC, after MDT shutdown/recovery. - * @param data archive id served by the copytool + * @param data copytool registration data * @param cb_arg callback argument (obd_import) */ -static int mdc_hsm_ct_reregister(__u32 data, void *cb_arg) +static int mdc_hsm_ct_reregister(void *data, void *cb_arg) { + struct kkuc_ct_data *kcd = data; struct obd_import *imp = (struct obd_import *)cb_arg; - __u32 archive = data; int rc; - CDEBUG(D_HA, "recover copytool registration to MDT (archive=%#x)\n", - archive); - rc = mdc_ioc_hsm_ct_register(imp, archive); + if (kcd == NULL || kcd->kcd_magic != KKUC_CT_DATA_MAGIC) + return -EPROTO; + + if (!obd_uuid_equals(&kcd->kcd_uuid, &imp->imp_obd->obd_uuid)) + return 0; + + CDEBUG(D_HA, "%s: recover copytool registration to MDT (archive=%#x)\n", + imp->imp_obd->obd_name, kcd->kcd_archive); + rc = mdc_ioc_hsm_ct_register(imp, kcd->kcd_archive); /* ignore error if the copytool is already registered */ - return ((rc != 0) && (rc != -EEXIST)) ? rc : 0; + return (rc == -EEXIST) ? 0 : rc; } /** @@ -2382,7 +2388,7 @@ static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) case OBD_CLEANUP_EXPORTS: /* Failsafe, ok if racy */ if (obd->obd_type->typ_refcnt <= 1) - libcfs_kkuc_group_rem(0, KUC_GRP_HSM); + libcfs_kkuc_group_rem(0, KUC_GRP_HSM, NULL); obd_cleanup_client_import(obd); ptlrpc_lprocfs_unregister_obd(obd); -- 1.7.1 From jsimmons at infradead.org Fri Oct 23 19:59:16 2015 From: jsimmons at infradead.org (James Simmons) Date: Fri, 23 Oct 2015 15:59:16 -0400 Subject: [lustre-devel] [PATCH 4/5] staging:lustre: split kernel comm between user and kernel In-Reply-To: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> References: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445630357-27149-5-git-send-email-jsimmons@infradead.org> From: frank zago Split the kernel comm header in libcfs into two new headers to handle both kernel space and user space for the lustre layer. This is broken out of the original patch 14270. The part covered by this change is as follows: The original libcfs_kernelcomm.h header is split into three parts: * lustre_kernelcomm.h, a new header for the kernel parts; * uapi_kernelcomm.h, a new header for the data structures shared between userspace and kernelspace; * lustreapi_internal.h receives the private liblustreapi prototypes. Various names and filenames have been harmonized to *kernelcomm*. The unused symbol KUC_FL_BLOCK has been removed. Signed-off-by: frank zago Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/14270 Reviewed-by: Nathan Rutman Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../staging/lustre/include/linux/libcfs/libcfs.h | 1 - .../lustre/lustre/include/lustre_kernelcomm.h | 56 ++++++++++++++++++++ .../include/uapi_kernelcomm.h} | 50 ++++------------- drivers/staging/lustre/lustre/llite/dir.c | 1 + drivers/staging/lustre/lustre/lmv/lmv_obd.c | 1 + drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 2 + drivers/staging/lustre/lustre/mdc/mdc_request.c | 1 + drivers/staging/lustre/lustre/obdclass/genops.c | 1 + .../staging/lustre/lustre/obdclass/kernelcomm.c | 5 +- 9 files changed, 76 insertions(+), 42 deletions(-) create mode 100644 drivers/staging/lustre/lustre/include/lustre_kernelcomm.h rename drivers/staging/lustre/{include/linux/libcfs/libcfs_kernelcomm.h => lustre/include/uapi_kernelcomm.h} (62%) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 5dd9cdf..1117310 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -125,7 +125,6 @@ void cfs_get_random_bytes(void *buf, int size); #include "libcfs_prim.h" #include "libcfs_time.h" #include "libcfs_string.h" -#include "libcfs_kernelcomm.h" #include "libcfs_workitem.h" #include "libcfs_hash.h" #include "libcfs_fail.h" diff --git a/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h new file mode 100644 index 0000000..a5baa80 --- /dev/null +++ b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h @@ -0,0 +1,56 @@ +/* + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.gnu.org/licenses/gpl-2.0.html + * + * GPL HEADER END + */ +/* + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2013, Intel Corporation. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * + * Author: Nathan Rutman + * + * Kernel <-> userspace communication routines. + * The definitions below are used in the kernel and userspace. + */ + +#ifndef __LUSTRE_KERNELCOMM_H__ +#define __LUSTRE_KERNELCOMM_H__ + +/* For declarations shared with userspace */ +#include "uapi_kernelcomm.h" + +/* prototype for callback function on kuc groups */ +typedef int (*libcfs_kkuc_cb_t)(void *data, void *cb_arg); + +/* Kernel methods */ +int libcfs_kkuc_msg_put(struct file *fp, void *payload); +int libcfs_kkuc_group_put(int group, void *payload); +int libcfs_kkuc_group_add(struct file *fp, int uid, int group, + void *data); +int libcfs_kkuc_group_rem(int uid, int group, void **pdata); +int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func, + void *cb_arg); + +#endif /* __LUSTRE_KERNELCOMM_H__ */ + diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h similarity index 62% rename from drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h rename to drivers/staging/lustre/lustre/include/uapi_kernelcomm.h index 7323ca6..5e0b8de 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h @@ -15,37 +15,29 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2013, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. * * Author: Nathan Rutman * - * libcfs/include/libcfs/libcfs_kernelcomm.h - * * Kernel <-> userspace communication routines. * The definitions below are used in the kernel and userspace. - * */ -#ifndef __LIBCFS_KERNELCOMM_H__ -#define __LIBCFS_KERNELCOMM_H__ +#ifndef __UAPI_KERNELCOMM_H__ +#define __UAPI_KERNELCOMM_H__ -#ifndef __LIBCFS_LIBCFS_H__ -#error Do not #include this file directly. #include instead -#endif +#include /* KUC message header. * All current and future KUC messages should use this header. @@ -63,7 +55,6 @@ struct kuc_hdr { #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE) #define KUC_MAGIC 0x191C /*Lustre9etLinC */ -#define KUC_FL_BLOCK 0x01 /* Wait for send */ /* kuc_msgtype values are defined in each transport */ enum kuc_transport_type { @@ -76,43 +67,26 @@ enum kuc_generic_message_type { KUC_MSG_SHUTDOWN = 1, }; -/* prototype for callback function on kuc groups */ -typedef int (*libcfs_kkuc_cb_t)(void *data, void *cb_arg); - /* KUC Broadcast Groups. This determines which userspace process hears which * messages. Mutliple transports may be used within a group, or multiple * groups may use the same transport. Broadcast * groups need not be used if e.g. a UID is specified instead; * use group 0 to signify unicast. */ -#define KUC_GRP_HSM 0x02 -#define KUC_GRP_MAX KUC_GRP_HSM - -/* Kernel methods */ -int libcfs_kkuc_msg_put(struct file *fp, void *payload); -int libcfs_kkuc_group_put(int group, void *payload); -int libcfs_kkuc_group_add(struct file *fp, int uid, int group, - void *data); -int libcfs_kkuc_group_rem(int uid, int group, void **pdata); -int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func, - void *cb_arg); +#define KUC_GRP_HSM 0x02 +#define KUC_GRP_MAX KUC_GRP_HSM #define LK_FLG_STOP 0x01 +#define LK_NOFD -1U /* kernelcomm control structure, passed from userspace to kernel */ -typedef struct lustre_kernelcomm { +struct lustre_kernelcomm { __u32 lk_wfd; __u32 lk_rfd; __u32 lk_uid; __u32 lk_group; __u32 lk_data; __u32 lk_flags; -} __packed lustre_kernelcomm; - -/* Userspace methods */ -int libcfs_ukuc_start(lustre_kernelcomm *l, int groups); -int libcfs_ukuc_stop(lustre_kernelcomm *l); -int libcfs_ukuc_msg_get(lustre_kernelcomm *l, char *buf, int maxsize, - int transport); +} __packed; -#endif /* __LIBCFS_KERNELCOMM_H__ */ +#endif /* __UAPI_KERNELCOMM_H__ */ diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 3d746a9..6b2834d 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -55,6 +55,7 @@ #include "../include/lustre_lite.h" #include "../include/lustre_dlm.h" #include "../include/lustre_fid.h" +#include "../include/lustre_kernelcomm.h" #include "llite_internal.h" /* diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 50eccb1..ee16236 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -53,6 +53,7 @@ #include "../include/lprocfs_status.h" #include "../include/lustre_lite.h" #include "../include/lustre_fid.h" +#include "../include/lustre_kernelcomm.h" #include "lmv_internal.h" static void lmv_activate_target(struct lmv_obd *lmv, diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c index 1c95f87..7d7b671 100644 --- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c +++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c @@ -38,6 +38,8 @@ #include #include "../include/obd_class.h" #include "../include/lprocfs_status.h" +/* temporary for testing */ +#include "../include/lustre_kernelcomm.h" #include "mdc_internal.h" static ssize_t max_rpcs_in_flight_show(struct kobject *kobj, diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index dc98239..4aa48e4 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -48,6 +48,7 @@ #include "../include/lprocfs_status.h" #include "../include/lustre_param.h" #include "../include/lustre_log.h" +#include "../include/lustre_kernelcomm.h" #include "mdc_internal.h" diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 978c3c5..6181826 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -42,6 +42,7 @@ #define DEBUG_SUBSYSTEM S_CLASS #include "../include/obd_class.h" #include "../include/lprocfs_status.h" +#include "../include/lustre_kernelcomm.h" spinlock_t obd_types_lock; diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c index 04c6d2d..70bd729 100644 --- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c +++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c @@ -42,9 +42,8 @@ #define DEBUG_SUBSYSTEM S_CLASS #define D_KUC D_OTHER -#include "../../include/linux/libcfs/libcfs.h" - -/* This is the kernel side (liblustre as well). */ +#include "../include/obd_support.h" +#include "../include/lustre_kernelcomm.h" /** * libcfs_kkuc_msg_put - send an message from kernel to userspace -- 1.7.1 From jsimmons at infradead.org Fri Oct 23 19:59:17 2015 From: jsimmons at infradead.org (James Simmons) Date: Fri, 23 Oct 2015 15:59:17 -0400 Subject: [lustre-devel] [PATCH 5/5] staging:lustre: Update license and copyright for kernel comm In-Reply-To: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> References: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> Message-ID: <1445630357-27149-6-git-send-email-jsimmons@infradead.org> From: frank zago Point to the right place for GNU license. Update Intel copyright. Update Nathan Rutmans email address. This was broken out of the original patch 14270. Signed-off-by: frank zago Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/14270 Reviewed-by: Nathan Rutman Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre_kernelcomm.h | 2 +- .../lustre/lustre/include/uapi_kernelcomm.h | 2 +- .../staging/lustre/lustre/obdclass/kernelcomm.c | 11 +++-------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h index a5baa80..a61263f 100644 --- a/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h +++ b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h @@ -28,7 +28,7 @@ /* * This file is part of Lustre, http://www.lustre.org/ * - * Author: Nathan Rutman + * Author: Nathan Rutman * * Kernel <-> userspace communication routines. * The definitions below are used in the kernel and userspace. diff --git a/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h index 5e0b8de..ad608b7 100644 --- a/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h +++ b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h @@ -28,7 +28,7 @@ /* * This file is part of Lustre, http://www.lustre.org/ * - * Author: Nathan Rutman + * Author: Nathan Rutman * * Kernel <-> userspace communication routines. * The definitions below are used in the kernel and userspace. diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c index 70bd729..978191a 100644 --- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c +++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,13 +23,12 @@ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. * - * Author: Nathan Rutman + * Author: Nathan Rutman * * Kernel <-> userspace communication routines. * Using pipes for all arches. -- 1.7.1 From lkp at intel.com Sat Oct 24 23:04:17 2015 From: lkp at intel.com (kbuild test robot) Date: Sun, 25 Oct 2015 07:04:17 +0800 Subject: [lustre-devel] [PATCH 7/7] staging: lustre: remove container_of0 and __container_of In-Reply-To: <78ef63421d4d50eb583b22944816720eda8d4717.1444774232.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <201510250700.EYBFVNfz%fengguang.wu@intel.com> Hi Aya, [auto build test ERROR on staging/staging-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Aya-Mahfouz/staging-lustre-remove-uses-and-definition-of-container_of0/20151014-062751 config: x86_64-randconfig-s2-10250612 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): In file included from drivers/staging/lustre/lustre/fid/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/fid/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/fid/../include/obd.h:52, from drivers/staging/lustre/lustre/fid/fid_request.c:48: drivers/staging/lustre/lustre/fid/../include/lu_object.h: In function 'lu_object_top': >> drivers/staging/lustre/lustre/fid/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ >> drivers/staging/lustre/lustre/fid/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/fid/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/fid/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lustre/fld/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/fld/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/fld/../include/obd.h:52, from drivers/staging/lustre/lustre/fld/fld_request.c:49: drivers/staging/lustre/lustre/fld/../include/lu_object.h: In function 'lu_object_top': >> drivers/staging/lustre/lustre/fld/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ >> drivers/staging/lustre/lustre/fld/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/fld/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/fld/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lustre/llite/../include/linux/../lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/linux/../obd_class.h:41, from drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:47, from drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from drivers/staging/lustre/lustre/llite/dcache.c:44: drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h: In function 'lu_object_top': >> drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ >> drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/dcache.c:48: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_dev': >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lustre/llite/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/obd_class.h:41, from drivers/staging/lustre/lustre/llite/dir.c:52: drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_top': >> drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ >> drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/dir.c:58: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_dev': >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lustre/llite/../include/linux/../lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/linux/../obd_class.h:41, from drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:47, from drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from drivers/staging/lustre/lustre/llite/llite_nfs.c:45: drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h: In function 'lu_object_top': >> drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ >> drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../include/linux/../lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/llite_nfs.c:46: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_dev': >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ In file included from include/linux/list.h:8:0, from include/linux/wait.h:6, from include/linux/fs.h:5, from drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:44, from drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from drivers/staging/lustre/lustre/llite/llite_nfs.c:45: drivers/staging/lustre/lustre/llite/llite_nfs.c: In function 'll_nfs_get_name_filldir': include/linux/kernel.h:811:48: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/staging/lustre/lustre/llite/llite_nfs.c:213:26: note: in expansion of macro 'container_of' struct lu_dirent *lde = container_of(name, struct lu_dirent, lde_name); ^ include/linux/kernel.h:811:48: note: (near initialization for 'lde') const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/staging/lustre/lustre/llite/llite_nfs.c:213:26: note: in expansion of macro 'container_of' struct lu_dirent *lde = container_of(name, struct lu_dirent, lde_name); ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lustre/llite/../lclient/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../lclient/../include/obd_class.h:41, from drivers/staging/lustre/lustre/llite/../lclient/glimpse.c:44: drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h: In function 'lu_object_top': >> drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ >> drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/../lclient/glimpse.c:54:0: drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_dev': >> drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lustre/llite/../lclient/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../lclient/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/llite/../lclient/../include/obd.h:52, from drivers/staging/lustre/lustre/llite/../lclient/lcommon_cl.c:53: drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h: In function 'lu_object_top': >> drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ >> drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../lclient/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/../lclient/lcommon_cl.c:60:0: drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_dev': >> drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_dev': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2658:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../lclient/../include/cl_object.h:2675:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- In file included from drivers/staging/lustre/lustre/llite/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/llite/../include/obd.h:52, from drivers/staging/lustre/lustre/llite/vvp_dev.c:43: drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_top': >> drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:9: error: implicit declaration of function 'container_of0' [-Werror=implicit-function-declaration] return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ >> drivers/staging/lustre/lustre/llite/../include/lu_object.h:737:43: error: expected expression before 'struct' return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); ^ drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_next': drivers/staging/lustre/lustre/llite/../include/lu_object.h:745:43: error: expected expression before 'struct' return container_of0(o->lo_linkage.next, struct lu_object, lo_linkage); ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/vvp_dev.c:45: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_dev': >> drivers/staging/lustre/lustre/llite/../include/cl_object.h:2657:26: error: expected expression before 'struct' return container_of0(d, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2668:26: error: expected expression before 'struct' return container_of0(o, struct cl_object, co_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl_conf': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2674:29: error: expected expression before 'struct' return container_of0(conf, struct cl_object_conf, coc_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'cl_object_device': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2685:40: error: expected expression before 'struct' return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2690:26: error: expected expression before 'struct' return container_of0(h, struct cl_object_header, coh_lu); ^ drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'lu2cl': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2669:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/llite/../include/lustre_net.h:65:0, from drivers/staging/lustre/lustre/llite/../include/lustre_lib.h:64, from drivers/staging/lustre/lustre/llite/../include/obd.h:52, from drivers/staging/lustre/lustre/llite/vvp_dev.c:43: drivers/staging/lustre/lustre/llite/../include/lu_object.h: In function 'lu_object_top': drivers/staging/lustre/lustre/llite/../include/lu_object.h:738:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ In file included from drivers/staging/lustre/lustre/llite/llite_internal.h:45:0, from drivers/staging/lustre/lustre/llite/vvp_dev.c:45: drivers/staging/lustre/lustre/llite/../include/cl_object.h: In function 'luh2coh': drivers/staging/lustre/lustre/llite/../include/cl_object.h:2691:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors .. vim +/container_of0 +737 drivers/staging/lustre/lustre/fid/../include/lu_object.h d7e09d039 Peng Tao 2013-05-02 731 /** d7e09d039 Peng Tao 2013-05-02 732 * First (topmost) sub-object of given compound object d7e09d039 Peng Tao 2013-05-02 733 */ d7e09d039 Peng Tao 2013-05-02 734 static inline struct lu_object *lu_object_top(struct lu_object_header *h) d7e09d039 Peng Tao 2013-05-02 735 { d7e09d039 Peng Tao 2013-05-02 736 LASSERT(!list_empty(&h->loh_layers)); d7e09d039 Peng Tao 2013-05-02 @737 return container_of0(h->loh_layers.next, struct lu_object, lo_linkage); d7e09d039 Peng Tao 2013-05-02 738 } d7e09d039 Peng Tao 2013-05-02 739 d7e09d039 Peng Tao 2013-05-02 740 /** :::::: The code at line 737 was first introduced by commit :::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system client support :::::: TO: Peng Tao :::::: CC: Greg Kroah-Hartman --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/octet-stream Size: 26634 bytes Desc: not available URL: From andreas.dilger at intel.com Sun Oct 25 07:44:43 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Sun, 25 Oct 2015 07:44:43 +0000 Subject: [lustre-devel] syncronous liblustreapi calls Message-ID: For lctl conf_param commands, this was tricky to implement with synchronous calls, since the configuration needs to be set on the MGS (where the log is stored), but only the client (or server, depending on the parameter) knows whether that parameter is valid since the MGS won't have a mounted client for e.g. "llite" tunables, nor a mounted server for e.g. "obdfilter" tunables. Also, there is an added complexity in whether "wait until completion" means "written to disk on the MGS" or "applied to one, some, or all clients or servers"? I'm not saying that the current interface is good - some tests needs polling of /proc to check that conf_param parameter updates have completed. I'm open to suggestions that solve this in a manner that doesn't allow arbitrary clients to modify global filesystem tunables... Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division On 2015/10/22, 08:50, "lustre-devel on behalf of Ben Evans" on behalf of bevans at cray.com> wrote: Is there some architectural reason behind a lack of synchronous calls to set values? As an example, the changelog_clear operation does some preliminary checking in liblustreapi for things like non-negative ranges, and that the changelog user is formatted correctly (not that the user actually exists). If everything checks out, it sends off an async request and tells the user everything is fine. On the MDS, many things may go wrong (such as the range being invalid, or the user not existing), and that gets written to the logs on the MDS, but there doesn’t seem to be a way of telling the user that something went wrong. Is there some backstory on this, or is it just an architectural consequence of the way Lustre works? -Ben Evans From gregkh at linuxfoundation.org Sun Oct 25 01:56:23 2015 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Sat, 24 Oct 2015 18:56:23 -0700 Subject: [lustre-devel] [PATCH 0/5] staging:lustre: split kernel comm between user and kernel In-Reply-To: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> References: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> Message-ID: <20151025015623.GB14640@kroah.com> On Fri, Oct 23, 2015 at 03:59:12PM -0400, James Simmons wrote: > The kernel communication code used for HSM and changelog is > entangled. Move the user space bits into the liblustreapi. This will > also help for a possible relicensing. The kernel portion is also moved > from libcfs to obdclass. > > The original libcfs_kernelcomm.h header is split into three parts: > > * lustre_kernelcomm.h, a new header for the kernel parts; > * uapi_kernelcomm.h, a new header for the data structures shared > between userspace and kernelspace; > * lustreapi_internal.h receives the private liblustreapi prototypes. > > The original code in kernel_user_comm.c is split into two parts: > > * obdclass/kernelcomm.c for the kernel part. filp_user_write() was > moved there, and linux-fs.c deleted; > * liblustreapi_kernelconn.c for the user part. The calls to CDEBUG > have been removed, and calls to CERROR have been transformed to > llapi_err_noerrno. The type lustre_kernelcomm has been removed and > replace by struct lustre_kernelcomm. > > Various names and filenames have been harmonized to *kernelcomm*. > > The unused symbol KUC_FL_BLOCK has been removed. > > Signed-off-by: frank zago > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 > Reviewed-on: http://review.whamcloud.com/14270 > Reviewed-by: Nathan Rutman > Reviewed-by: James Simmons > Reviewed-by: Dmitry Eremin > Reviewed-by: John L. Hammond > Reviewed-by: Oleg Drokin The series didn't all have numbers on them, so I don't know what order to apply them in :( Please resend them with the proper numbering on them so I know what to do here. thanks, greg k-h From dan.carpenter at oracle.com Mon Oct 26 08:52:49 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 26 Oct 2015 11:52:49 +0300 Subject: [lustre-devel] [PATCH] staging:lustre: Prevent duplicate CT registrations In-Reply-To: <1445630357-27149-3-git-send-email-jsimmons@infradead.org> References: <1445630357-27149-1-git-send-email-jsimmons@infradead.org> <1445630357-27149-3-git-send-email-jsimmons@infradead.org> Message-ID: <20151026085249.GW7340@mwanda> On Fri, Oct 23, 2015 at 03:59:14PM -0400, James Simmons wrote: > diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c > index 635a93c..d6d70d8 100644 > --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c > +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c > @@ -794,7 +794,9 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv, > static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len, > struct lustre_kernelcomm *lk, void *uarg) > { > - int i, rc = 0; > + struct kkuc_ct_data *kcd = NULL; > + int rc = 0; > + __u32 i; We have been introducing a lot of new __u32 types here and I just assumed there was a reason for it but this one is clearly wrong. The new code implies that ->ld_tgt_count can overflow INT_MAX which is not true and that this is code shared with userspace which might be true but it's not described in the changelog. Is this a static checker fix? Stop using that broken static checker, because the correct type here is int. Anyway, stop making gratuitous unrelated changes (like the white space changes to local declarations). I feel like I have held off commenting on this for a while and shown great restraint. :P > - rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group); > + rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group, (void**)&kcd); > + if (kcd != NULL) > + kfree(kcd); NULL check not needed. > + > return rc; > } > > static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, > struct lustre_kernelcomm *lk, void *uarg) > { > - struct file *filp; > - int i, j, err; > - int rc = 0; > - bool any_set = false; > + struct file *filp; > + __u32 i, j; > + int err, rc = 0; > + bool any_set = false; > + struct kkuc_ct_data *kcd; > > /* All or nothing: try to register to all MDS. > * In case of failure, unregister from previous MDS, > @@ -854,12 +860,25 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, > > /* at least one registration done, with no failure */ > filp = fget(lk->lk_wfd); > - if (filp == NULL) { > + if (filp == NULL) > return -EBADF; > - } > - rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group, lk->lk_data); > - if (rc != 0 && filp != NULL) > + > + kcd = kzalloc(sizeof(*kcd), GFP_NOFS); > + if (kcd == NULL) { > fput(filp); > + return -ENOMEM; > + } > + kcd->kcd_magic = KKUC_CT_DATA_MAGIC; > + kcd->kcd_uuid = lmv->cluuid; > + kcd->kcd_archive = lk->lk_data; > + > + rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group, kcd); > + if (rc != 0) { These double negatives are a pet peev of mine. "if (rc) {" Comparing with zero like this is idiomatic when you're talking about the number zero or strcmp(). Can we use a goto for unwinding? goto free_kcd; > + if (filp != NULL) The earlier NULL check means this can't happen. > + fput(filp); > + kfree(kcd); > + } > + > return rc; return 0; free_kcd: kfree(kcd); put_filp: fput(filp); return rc; regards, dan carpenter From xose.vazquez at gmail.com Mon Oct 26 10:49:01 2015 From: xose.vazquez at gmail.com (Xose Vazquez Perez) Date: Mon, 26 Oct 2015 11:49:01 +0100 Subject: [lustre-devel] [PATCH 5/5] staging:lustre: Update license and copyright for kernel comm Message-ID: <562E051D.6030807@gmail.com> James Simmons wrote: > From: frank zago > > Point to the right place for GNU license. Update Intel copyright. > Update Nathan Rutmans email address. This was broken out of the > original patch 14270. > > [...] > > - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf > - * > - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, > - * CA 95054 USA or visit www.sun.com if you need additional information or > - * have any questions. That text is in every files. You should kill all references. -thanks- From mahfouz.saif.elyazal at gmail.com Tue Oct 27 17:41:05 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Tue, 27 Oct 2015 19:41:05 +0200 Subject: [lustre-devel] [RESEND PATCH v2 0/5] Remove uses and definition of IS_PO2 Message-ID: Concerned with the removal of IS_PO2 by replacing its uses with is_power_of_2 and then removing the definition. This is the second version of the patch set. The commit messages were changed and a new patch was added for a use of IS_PO2 indicated by kbuild test robot. Aya Mahfouz (5): staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2 staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2 staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- drivers/staging/lustre/lnet/selftest/selftest.h | 4 +++- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++- drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 5 files changed, 13 insertions(+), 11 deletions(-) -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 27 17:42:08 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Tue, 27 Oct 2015 19:42:08 +0200 Subject: [lustre-devel] [RESEND PATCH v2 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <8231e028c575cc4ab2e34601b92d3a66f11559ff.1445967419.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Signed-off-by: Aya Mahfouz --- v2: -changed commit message drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index c787888..d994ce0 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -50,6 +50,9 @@ */ #define DEBUG_SUBSYSTEM S_LDLM + +#include + #include "../../include/linux/libcfs/libcfs.h" #include "../include/lustre_dlm.h" #include "../include/obd_support.h" @@ -149,7 +152,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode) int index; LASSERT(mode != 0); - LASSERT(IS_PO2(mode)); + LASSERT(is_power_of_2(mode)); for (index = -1; mode; index++) mode >>= 1; LASSERT(index < LCK_MODE_NUM); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 27 17:43:34 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Tue, 27 Oct 2015 19:43:34 +0200 Subject: [lustre-devel] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <36db1862a6b63ac07f3b1ed3a1f7f39a772399c6.1445967419.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Reviewed-by: Andreas Dilger Signed-off-by: Aya Mahfouz --- v2: -changed commit message -added Andreas Reviewed by tag drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 6f4c7d4..4b5e79a 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -109,6 +109,8 @@ #include "../../include/linux/libcfs/libcfs.h" #include +#include + #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 static unsigned int warn_on_depth = 8; @@ -1785,7 +1787,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) for (i = 2; cfs_hash_is_rehashing(hs); i++) { cfs_hash_unlock(hs, 1); /* raise console warning while waiting too long */ - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, "hash %s is still rehashing, rescheded %d\n", hs->hs_name, i - 1); cond_resched(); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 27 17:44:28 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Tue, 27 Oct 2015 19:44:28 +0200 Subject: [lustre-devel] [RESEND PATCH v2 3/5] staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <95a2cc9e085f09d4a4abe39b71eae7b77300beed.1445967419.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Reviewed-by: Andreas Dilger Signed-off-by: Aya Mahfouz --- v2: -changed commit message -added Andreas Reviewed by tag drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index e1143a5..377e1ea 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -41,6 +41,8 @@ #define DEBUG_SUBSYSTEM S_LNET +#include + #include "../../include/linux/libcfs/libcfs.h" #define CFS_WS_NAME_LEN 16 @@ -325,7 +327,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) spin_lock(&cfs_wi_data.wi_glock); while (sched->ws_nthreads > 0) { - CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, + CDEBUG(is_power_of_2(++i) ? D_WARNING : D_NET, "waiting for %d threads of WI sched[%s] to terminate\n", sched->ws_nthreads, sched->ws_name); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 27 17:45:22 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Tue, 27 Oct 2015 19:45:22 +0200 Subject: [lustre-devel] [RESEND PATCH v2 4/5] staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <6424e67b55e713cc71a479e1dc19325ca7f5934f.1445967419.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Signed-off-by: Aya Mahfouz --- v2: -added new patch in patch set for selftest.h drivers/staging/lustre/lnet/selftest/selftest.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 8a77d3f..2846f26 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -43,6 +43,8 @@ #define LNET_ONLY +#include + #include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/lnet/lnet.h" #include "../../include/linux/lnet/lib-lnet.h" @@ -585,7 +587,7 @@ swi_state2str (int state) do { \ int __I = 2; \ while (!(cond)) { \ - CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ + CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET, \ fmt, ## __VA_ARGS__); \ spin_unlock(&(lock)); \ \ -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Tue Oct 27 17:46:02 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Tue, 27 Oct 2015 19:46:02 +0200 Subject: [lustre-devel] [RESEND PATCH v2 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 In-Reply-To: References: Message-ID: <2be65729af52a59e9070f9c9dbd1ff72927ace0a.1445967419.git.mahfouz.saif.elyazal@gmail.com> Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have been replaced by is_power_of_2 Signed-off-by: Aya Mahfouz --- v2: -became patch number 5 in the series drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 4d74e8a..7f76b20 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -42,13 +42,6 @@ #include "curproc.h" -static inline int __is_po2(unsigned long long val) -{ - return !(val & (val - 1)); -} - -#define IS_PO2(val) __is_po2((unsigned long long)(val)) - #define LOWEST_BIT_SET(x) ((x) & ~((x) - 1)) /* -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From sudipm.mukherjee at gmail.com Wed Oct 28 06:41:59 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Wed, 28 Oct 2015 12:11:59 +0530 Subject: [lustre-devel] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 In-Reply-To: <36db1862a6b63ac07f3b1ed3a1f7f39a772399c6.1445967419.git.mahfouz.saif.elyazal@gmail.com> References: <36db1862a6b63ac07f3b1ed3a1f7f39a772399c6.1445967419.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <20151028064159.GB3649@sudip-pc> On Tue, Oct 27, 2015 at 07:43:34PM +0200, Aya Mahfouz wrote: > Replaces IS_PO2 by is_power_of_2. It is more accurate to use > is_power_of_2 since it returns 1 for numbers that are powers > of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are > powers of 2. > > Reviewed-by: Andreas Dilger > Signed-off-by: Aya Mahfouz > --- > v2: > -changed commit message > -added Andreas Reviewed by tag > > drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c > index 6f4c7d4..4b5e79a 100644 > --- a/drivers/staging/lustre/lustre/libcfs/hash.c > +++ b/drivers/staging/lustre/lustre/libcfs/hash.c > @@ -109,6 +109,8 @@ > > #include "../../include/linux/libcfs/libcfs.h" > #include > +#include > + This extra blank line will introduce new checkpatch error of "multiple blank lines" regards sudip From sudipm.mukherjee at gmail.com Wed Oct 28 06:44:57 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Wed, 28 Oct 2015 12:14:57 +0530 Subject: [lustre-devel] [RESEND PATCH v2 4/5] staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2 In-Reply-To: <6424e67b55e713cc71a479e1dc19325ca7f5934f.1445967419.git.mahfouz.saif.elyazal@gmail.com> References: <6424e67b55e713cc71a479e1dc19325ca7f5934f.1445967419.git.mahfouz.saif.elyazal@gmail.com> Message-ID: <20151028064457.GC3649@sudip-pc> On Tue, Oct 27, 2015 at 07:45:22PM +0200, Aya Mahfouz wrote: > Replaces IS_PO2 by is_power_of_2. It is more accurate to use > is_power_of_2 since it returns 1 for numbers that are powers > of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are > powers of 2. > > Signed-off-by: Aya Mahfouz > --- > v2: > -added new patch in patch set for selftest.h > > drivers/staging/lustre/lnet/selftest/selftest.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h > index 8a77d3f..2846f26 100644 > --- a/drivers/staging/lustre/lnet/selftest/selftest.h > +++ b/drivers/staging/lustre/lnet/selftest/selftest.h > @@ -43,6 +43,8 @@ > > #define LNET_ONLY > > +#include > + > #include "../../include/linux/libcfs/libcfs.h" > #include "../../include/linux/lnet/lnet.h" > #include "../../include/linux/lnet/lib-lnet.h" > @@ -585,7 +587,7 @@ swi_state2str (int state) > do { \ > int __I = 2; \ > while (!(cond)) { \ > - CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ > + CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET, \ An extra tab here broke the alignent of those '\'. regards sudip From jsimmons at infradead.org Wed Oct 28 16:54:21 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:21 -0400 Subject: [lustre-devel] [PATCH 00/10] staging: lustre: cleanup up libcfs hash code for upstream Message-ID: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> From: James Simmons This patch brings the libcfs hash handling up to linux kernel coding style. Various typedefs and macros have been removed. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/14624 Reviewed-by: Bob Glossman Reviewed-by: frank zago Reviewed-by: Oleg Drokin James Simmons (10): staging: lustre: change cfs_hash_lock_ops_t to struct staging: lustre: change cfs_hash_hlist_ops_t to struct staging: lustre: change cfs_hash_ops_t to struct staging: lustre: change cfs_hash_dhead*_t to struct staging: lustre: change cfs_hash_head*_t to struct staging: lustre: convert last typedef data types in hash.c staging: lustre: cleanup over 80 characters in libcfs_hash.h staging: lustre: remove white space in libcfs_hash.h staging: lustre: fix remaining checkpatch issues for libcfs_hash.h staging: lustre: remove white space in hash.c .../lustre/include/linux/libcfs/libcfs_hash.h | 350 +++++++++------- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 18 +- drivers/staging/lustre/lustre/libcfs/hash.c | 447 ++++++++++---------- drivers/staging/lustre/lustre/lov/lov_internal.h | 2 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 6 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +- .../staging/lustre/lustre/obdclass/obd_config.c | 8 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/connection.c | 8 +- 10 files changed, 451 insertions(+), 402 deletions(-) From jsimmons at infradead.org Wed Oct 28 16:54:29 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:29 -0400 Subject: [lustre-devel] [PATCH 08/10] staging: lustre: remove white space in libcfs_hash.h In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-9-git-send-email-jsimmons@infradead.org> From: James Simmons Cleanup all the unneeded white space in libcfs_hash.h. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 147 ++++++++++---------- 1 files changed, 73 insertions(+), 74 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 70b8b29..5df8ba2 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -41,6 +41,9 @@ #ifndef __LIBCFS_HASH_H__ #define __LIBCFS_HASH_H__ + +#include + /* * Knuth recommends primes in approximately golden ratio to the maximum * integer representable by a machine word for multiplicative hashing. @@ -56,22 +59,13 @@ /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ #define CFS_GOLDEN_RATIO_PRIME_64 0x9e37fffffffc0001ULL -/* - * Ideally we would use HAVE_HASH_LONG for this, but on linux we configure - * the linux kernel and user space at the same time, so we need to differentiate - * between them explicitly. If this is not needed on other architectures, then - * we'll need to move the functions to architecture specific headers. - */ - -#include - /** disable debug */ -#define CFS_HASH_DEBUG_NONE 0 +#define CFS_HASH_DEBUG_NONE 0 /** record hash depth and output to console when it's too deep, * computing overhead is low but consume more memory */ -#define CFS_HASH_DEBUG_1 1 +#define CFS_HASH_DEBUG_1 1 /** expensive, check key validation */ -#define CFS_HASH_DEBUG_2 2 +#define CFS_HASH_DEBUG_2 2 #define CFS_HASH_DEBUG_LEVEL CFS_HASH_DEBUG_NONE @@ -108,16 +102,18 @@ struct cfs_hash_bucket { * cfs_hash bucket descriptor, it's normally in stack of caller */ struct cfs_hash_bd { - struct cfs_hash_bucket *bd_bucket; /**< address of bucket */ - unsigned int bd_offset; /**< offset in bucket */ + /**< address of bucket */ + struct cfs_hash_bucket *bd_bucket; + /**< offset in bucket */ + unsigned int bd_offset; }; -#define CFS_HASH_NAME_LEN 16 /**< default name length */ -#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ +#define CFS_HASH_NAME_LEN 16 /**< default name length */ +#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ -#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ -#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ -#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS +#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ +#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ +#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS /** * common hash attributes. @@ -133,41 +129,41 @@ enum cfs_hash_tag { */ CFS_HASH_NO_LOCK = 1 << 0, /** no bucket lock, use one spinlock to protect the whole hash */ - CFS_HASH_NO_BKTLOCK = 1 << 1, + CFS_HASH_NO_BKTLOCK = 1 << 1, /** rwlock to protect bucket */ - CFS_HASH_RW_BKTLOCK = 1 << 2, + CFS_HASH_RW_BKTLOCK = 1 << 2, /** spinlock to protect bucket */ - CFS_HASH_SPIN_BKTLOCK = 1 << 3, + CFS_HASH_SPIN_BKTLOCK = 1 << 3, /** always add new item to tail */ - CFS_HASH_ADD_TAIL = 1 << 4, + CFS_HASH_ADD_TAIL = 1 << 4, /** hash-table doesn't have refcount on item */ - CFS_HASH_NO_ITEMREF = 1 << 5, + CFS_HASH_NO_ITEMREF = 1 << 5, /** big name for param-tree */ CFS_HASH_BIGNAME = 1 << 6, /** track global count */ CFS_HASH_COUNTER = 1 << 7, /** rehash item by new key */ - CFS_HASH_REHASH_KEY = 1 << 8, + CFS_HASH_REHASH_KEY = 1 << 8, /** Enable dynamic hash resizing */ - CFS_HASH_REHASH = 1 << 9, + CFS_HASH_REHASH = 1 << 9, /** can shrink hash-size */ - CFS_HASH_SHRINK = 1 << 10, + CFS_HASH_SHRINK = 1 << 10, /** assert hash is empty on exit */ - CFS_HASH_ASSERT_EMPTY = 1 << 11, + CFS_HASH_ASSERT_EMPTY = 1 << 11, /** record hlist depth */ - CFS_HASH_DEPTH = 1 << 12, + CFS_HASH_DEPTH = 1 << 12, /** * rehash is always scheduled in a different thread, so current * change on hash table is non-blocking */ - CFS_HASH_NBLK_CHANGE = 1 << 13, + CFS_HASH_NBLK_CHANGE = 1 << 13, /** NB, we typed hs_flags as __u16, please change it * if you need to extend >=16 flags */ }; /** most used attributes */ -#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ - CFS_HASH_COUNTER | CFS_HASH_REHASH) +#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ + CFS_HASH_COUNTER | CFS_HASH_REHASH) /** * cfs_hash is a hash-table implementation for general purpose, it can support: @@ -211,7 +207,7 @@ enum cfs_hash_tag { struct cfs_hash { /** serialize with rehash, or serialize all operations if * the hash-table has CFS_HASH_NO_BKTLOCK */ - union cfs_hash_lock hs_lock; + union cfs_hash_lock hs_lock; /** hash operations */ struct cfs_hash_ops *hs_ops; /** hash lock operations */ @@ -219,57 +215,57 @@ struct cfs_hash { /** hash list operations */ struct cfs_hash_hlist_ops *hs_hops; /** hash buckets-table */ - struct cfs_hash_bucket **hs_buckets; + struct cfs_hash_bucket **hs_buckets; /** total number of items on this hash-table */ - atomic_t hs_count; + atomic_t hs_count; /** hash flags, see cfs_hash_tag for detail */ - __u16 hs_flags; + __u16 hs_flags; /** # of extra-bytes for bucket, for user saving extended attributes */ - __u16 hs_extra_bytes; + __u16 hs_extra_bytes; /** wants to iterate */ - __u8 hs_iterating; + __u8 hs_iterating; /** hash-table is dying */ - __u8 hs_exiting; + __u8 hs_exiting; /** current hash bits */ - __u8 hs_cur_bits; + __u8 hs_cur_bits; /** min hash bits */ - __u8 hs_min_bits; + __u8 hs_min_bits; /** max hash bits */ - __u8 hs_max_bits; + __u8 hs_max_bits; /** bits for rehash */ - __u8 hs_rehash_bits; + __u8 hs_rehash_bits; /** bits for each bucket */ - __u8 hs_bkt_bits; + __u8 hs_bkt_bits; /** resize min threshold */ - __u16 hs_min_theta; + __u16 hs_min_theta; /** resize max threshold */ - __u16 hs_max_theta; + __u16 hs_max_theta; /** resize count */ - __u32 hs_rehash_count; + __u32 hs_rehash_count; /** # of iterators (caller of cfs_hash_for_each_*) */ - __u32 hs_iterators; + __u32 hs_iterators; /** rehash workitem */ - cfs_workitem_t hs_rehash_wi; + cfs_workitem_t hs_rehash_wi; /** refcount on this hash table */ - atomic_t hs_refcount; + atomic_t hs_refcount; /** rehash buckets-table */ - struct cfs_hash_bucket **hs_rehash_buckets; + struct cfs_hash_bucket **hs_rehash_buckets; #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 /** serialize debug members */ spinlock_t hs_dep_lock; /** max depth */ - unsigned int hs_dep_max; + unsigned int hs_dep_max; /** id of the deepest bucket */ - unsigned int hs_dep_bkt; + unsigned int hs_dep_bkt; /** offset in the deepest bucket */ - unsigned int hs_dep_off; + unsigned int hs_dep_off; /** bits when we found the max depth */ - unsigned int hs_dep_bits; + unsigned int hs_dep_bits; /** workitem to output max depth */ - cfs_workitem_t hs_dep_wi; + cfs_workitem_t hs_dep_wi; #endif /** name of htable */ - char hs_name[0]; + char hs_name[0]; }; struct cfs_hash_lock_ops { @@ -324,11 +320,11 @@ struct cfs_hash_ops { }; /** total number of buckets in @hs */ -#define CFS_HASH_NBKT(hs) \ +#define CFS_HASH_NBKT(hs) \ (1U << ((hs)->hs_cur_bits - (hs)->hs_bkt_bits)) /** total number of buckets in @hs while rehashing */ -#define CFS_HASH_RH_NBKT(hs) \ +#define CFS_HASH_RH_NBKT(hs) \ (1U << ((hs)->hs_rehash_bits - (hs)->hs_bkt_bits)) /** number of hlist for in bucket */ @@ -433,19 +429,22 @@ cfs_hash_with_nblk_change(struct cfs_hash *hs) static inline int cfs_hash_is_exiting(struct cfs_hash *hs) -{ /* cfs_hash_destroy is called */ +{ + /* cfs_hash_destroy is called */ return hs->hs_exiting; } static inline int cfs_hash_is_rehashing(struct cfs_hash *hs) -{ /* rehash is launched */ +{ + /* rehash is launched */ return hs->hs_rehash_bits != 0; } static inline int cfs_hash_is_iterating(struct cfs_hash *hs) -{ /* someone is calling cfs_hash_for_each_* */ +{ + /* someone is calling cfs_hash_for_each_* */ return hs->hs_iterating || hs->hs_iterators != 0; } @@ -758,7 +757,7 @@ static inline void cfs_hash_bucket_validate(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - struct cfs_hash_bd bds[2]; + struct cfs_hash_bd bds[2]; cfs_hash_dual_bd_get(hs, cfs_hash_key(hs, hnode), bds); LASSERT(bds[0].bd_bucket == bd->bd_bucket || @@ -777,9 +776,9 @@ cfs_hash_bucket_validate(struct cfs_hash *hs, struct cfs_hash_bd *bd, #endif /* CFS_HASH_DEBUG_LEVEL */ -#define CFS_HASH_THETA_BITS 10 -#define CFS_HASH_MIN_THETA (1U << (CFS_HASH_THETA_BITS - 1)) -#define CFS_HASH_MAX_THETA (1U << (CFS_HASH_THETA_BITS + 1)) +#define CFS_HASH_THETA_BITS 10 +#define CFS_HASH_MIN_THETA (1U << (CFS_HASH_THETA_BITS - 1)) +#define CFS_HASH_MAX_THETA (1U << (CFS_HASH_THETA_BITS + 1)) /* Return integer component of theta */ static inline int __cfs_hash_theta_int(int theta) @@ -848,20 +847,20 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask) } /** iterate over all buckets in @bds (array of struct cfs_hash_bd) */ -#define cfs_hash_for_each_bd(bds, n, i) \ +#define cfs_hash_for_each_bd(bds, n, i) \ for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++) /** iterate over all buckets of @hs */ -#define cfs_hash_for_each_bucket(hs, bd, pos) \ - for (pos = 0; \ - pos < CFS_HASH_NBKT(hs) && \ +#define cfs_hash_for_each_bucket(hs, bd, pos) \ + for (pos = 0; \ + pos < CFS_HASH_NBKT(hs) && \ ((bd)->bd_bucket = (hs)->hs_buckets[pos]) != NULL; pos++) /** iterate over all hlist of bucket @bd */ -#define cfs_hash_bd_for_each_hlist(hs, bd, hlist) \ - for ((bd)->bd_offset = 0; \ - (bd)->bd_offset < CFS_HASH_BKT_NHLIST(hs) && \ - (hlist = cfs_hash_bd_hhead(hs, bd)) != NULL; \ +#define cfs_hash_bd_for_each_hlist(hs, bd, hlist) \ + for ((bd)->bd_offset = 0; \ + (bd)->bd_offset < CFS_HASH_BKT_NHLIST(hs) && \ + (hlist = cfs_hash_bd_hhead(hs, bd)) != NULL; \ (bd)->bd_offset++) /* !__LIBCFS__HASH_H__ */ -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:31 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:31 -0400 Subject: [lustre-devel] [PATCH 10/10] staging: lustre: remove white space in hash.c In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-11-git-send-email-jsimmons@infradead.org> From: James Simmons Cleanup all the unneeded white space in hash.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/libcfs/hash.c | 336 ++++++++++++++------------- 1 files changed, 174 insertions(+), 162 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 0308744..c5921f7 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -106,9 +106,9 @@ * Now we support both locked iteration & lockless iteration of hash * table. Also, user can break the iteration by return 1 in callback. */ +#include #include "../../include/linux/libcfs/libcfs.h" -#include #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 static unsigned int warn_on_depth = 8; @@ -161,49 +161,49 @@ cfs_hash_rw_unlock(union cfs_hash_lock *lock, int exclusive) /** No lock hash */ static struct cfs_hash_lock_ops cfs_hash_nl_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_nl_lock, - .hs_bkt_unlock = cfs_hash_nl_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_nl_lock, + .hs_bkt_unlock = cfs_hash_nl_unlock, }; /** no bucket lock, one spinlock to protect everything */ static struct cfs_hash_lock_ops cfs_hash_nbl_lops = { .hs_lock = cfs_hash_spin_lock, - .hs_unlock = cfs_hash_spin_unlock, - .hs_bkt_lock = cfs_hash_nl_lock, - .hs_bkt_unlock = cfs_hash_nl_unlock, + .hs_unlock = cfs_hash_spin_unlock, + .hs_bkt_lock = cfs_hash_nl_lock, + .hs_bkt_unlock = cfs_hash_nl_unlock, }; /** spin bucket lock, rehash is enabled */ static struct cfs_hash_lock_ops cfs_hash_bkt_spin_lops = { .hs_lock = cfs_hash_rw_lock, - .hs_unlock = cfs_hash_rw_unlock, - .hs_bkt_lock = cfs_hash_spin_lock, - .hs_bkt_unlock = cfs_hash_spin_unlock, + .hs_unlock = cfs_hash_rw_unlock, + .hs_bkt_lock = cfs_hash_spin_lock, + .hs_bkt_unlock = cfs_hash_spin_unlock, }; /** rw bucket lock, rehash is enabled */ static struct cfs_hash_lock_ops cfs_hash_bkt_rw_lops = { .hs_lock = cfs_hash_rw_lock, - .hs_unlock = cfs_hash_rw_unlock, - .hs_bkt_lock = cfs_hash_rw_lock, - .hs_bkt_unlock = cfs_hash_rw_unlock, + .hs_unlock = cfs_hash_rw_unlock, + .hs_bkt_lock = cfs_hash_rw_lock, + .hs_bkt_unlock = cfs_hash_rw_unlock, }; /** spin bucket lock, rehash is disabled */ static struct cfs_hash_lock_ops cfs_hash_nr_bkt_spin_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_spin_lock, - .hs_bkt_unlock = cfs_hash_spin_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_spin_lock, + .hs_bkt_unlock = cfs_hash_spin_unlock, }; /** rw bucket lock, rehash is disabled */ static struct cfs_hash_lock_ops cfs_hash_nr_bkt_rw_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_rw_lock, - .hs_bkt_unlock = cfs_hash_rw_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_rw_lock, + .hs_bkt_unlock = cfs_hash_rw_unlock, }; static void @@ -280,7 +280,7 @@ cfs_hash_hh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_head_dep { struct hlist_head hd_head; /**< entries list */ - unsigned int hd_depth; /**< list length */ + unsigned int hd_depth; /**< list length */ }; static int @@ -328,7 +328,7 @@ cfs_hash_hd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_dhead { struct hlist_head dh_head; /**< entries list */ - struct hlist_node *dh_tail; /**< the last entry */ + struct hlist_node *dh_tail; /**< the last entry */ }; static int @@ -384,8 +384,8 @@ cfs_hash_dh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_dhead_dep { struct hlist_head dd_head; /**< entries list */ - struct hlist_node *dd_tail; /**< the last entry */ - unsigned int dd_depth; /**< list length */ + struct hlist_node *dd_tail; /**< the last entry */ + unsigned int dd_depth; /**< list length */ }; static int @@ -436,31 +436,31 @@ cfs_hash_dd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, } static struct cfs_hash_hlist_ops cfs_hash_hh_hops = { - .hop_hhead = cfs_hash_hh_hhead, - .hop_hhead_size = cfs_hash_hh_hhead_size, - .hop_hnode_add = cfs_hash_hh_hnode_add, - .hop_hnode_del = cfs_hash_hh_hnode_del, + .hop_hhead = cfs_hash_hh_hhead, + .hop_hhead_size = cfs_hash_hh_hhead_size, + .hop_hnode_add = cfs_hash_hh_hnode_add, + .hop_hnode_del = cfs_hash_hh_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_hd_hops = { - .hop_hhead = cfs_hash_hd_hhead, - .hop_hhead_size = cfs_hash_hd_hhead_size, - .hop_hnode_add = cfs_hash_hd_hnode_add, - .hop_hnode_del = cfs_hash_hd_hnode_del, + .hop_hhead = cfs_hash_hd_hhead, + .hop_hhead_size = cfs_hash_hd_hhead_size, + .hop_hnode_add = cfs_hash_hd_hnode_add, + .hop_hnode_del = cfs_hash_hd_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_dh_hops = { - .hop_hhead = cfs_hash_dh_hhead, - .hop_hhead_size = cfs_hash_dh_hhead_size, - .hop_hnode_add = cfs_hash_dh_hnode_add, - .hop_hnode_del = cfs_hash_dh_hnode_del, + .hop_hhead = cfs_hash_dh_hhead, + .hop_hhead_size = cfs_hash_dh_hhead_size, + .hop_hnode_add = cfs_hash_dh_hnode_add, + .hop_hnode_del = cfs_hash_dh_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_dd_hops = { - .hop_hhead = cfs_hash_dd_hhead, - .hop_hhead_size = cfs_hash_dd_hhead_size, - .hop_hnode_add = cfs_hash_dd_hnode_add, - .hop_hnode_del = cfs_hash_dd_hnode_del, + .hop_hhead = cfs_hash_dd_hhead, + .hop_hhead_size = cfs_hash_dd_hhead_size, + .hop_hnode_add = cfs_hash_dd_hnode_add, + .hop_hnode_del = cfs_hash_dd_hnode_del, }; static void @@ -529,7 +529,7 @@ void cfs_hash_bd_add_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - int rc; + int rc; rc = hs->hs_hops->hop_hnode_add(hs, bd, hnode); cfs_hash_bd_dep_record(hs, bd, rc); @@ -572,7 +572,7 @@ cfs_hash_bd_move_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd_old, { struct cfs_hash_bucket *obkt = bd_old->bd_bucket; struct cfs_hash_bucket *nbkt = bd_new->bd_bucket; - int rc; + int rc; if (cfs_hash_bd_compare(bd_old, bd_new) == 0) return; @@ -597,30 +597,30 @@ EXPORT_SYMBOL(cfs_hash_bd_move_locked); enum { /** always set, for sanity (avoid ZERO intent) */ - CFS_HS_LOOKUP_MASK_FIND = BIT(0), + CFS_HS_LOOKUP_MASK_FIND = BIT(0), /** return entry with a ref */ - CFS_HS_LOOKUP_MASK_REF = BIT(1), + CFS_HS_LOOKUP_MASK_REF = BIT(1), /** add entry if not existing */ - CFS_HS_LOOKUP_MASK_ADD = BIT(2), + CFS_HS_LOOKUP_MASK_ADD = BIT(2), /** delete entry, ignore other masks */ - CFS_HS_LOOKUP_MASK_DEL = BIT(3), + CFS_HS_LOOKUP_MASK_DEL = BIT(3), }; enum cfs_hash_lookup_intent { /** return item w/o refcount */ - CFS_HS_LOOKUP_IT_PEEK = CFS_HS_LOOKUP_MASK_FIND, + CFS_HS_LOOKUP_IT_PEEK = CFS_HS_LOOKUP_MASK_FIND, /** return item with refcount */ - CFS_HS_LOOKUP_IT_FIND = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_REF), + CFS_HS_LOOKUP_IT_FIND = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_REF), /** return item w/o refcount if existed, otherwise add */ - CFS_HS_LOOKUP_IT_ADD = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_ADD), + CFS_HS_LOOKUP_IT_ADD = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_ADD), /** return item with refcount if existed, otherwise add */ - CFS_HS_LOOKUP_IT_FINDADD = (CFS_HS_LOOKUP_IT_FIND | - CFS_HS_LOOKUP_MASK_ADD), + CFS_HS_LOOKUP_IT_FINDADD = (CFS_HS_LOOKUP_IT_FIND | + CFS_HS_LOOKUP_MASK_ADD), /** delete if existed */ - CFS_HS_LOOKUP_IT_FINDDEL = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_DEL) + CFS_HS_LOOKUP_IT_FINDDEL = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_DEL) }; static struct hlist_node * @@ -665,7 +665,8 @@ cfs_hash_bd_lookup_intent(struct cfs_hash *hs, struct cfs_hash_bd *bd, } struct hlist_node * -cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const void *key) +cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key) { return cfs_hash_bd_lookup_intent(hs, bd, key, NULL, CFS_HS_LOOKUP_IT_FIND); @@ -673,7 +674,8 @@ cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const voi EXPORT_SYMBOL(cfs_hash_bd_lookup_locked); struct hlist_node * -cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const void *key) +cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key) { return cfs_hash_bd_lookup_intent(hs, bd, key, NULL, CFS_HS_LOOKUP_IT_PEEK); @@ -706,7 +708,7 @@ cfs_hash_multi_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, int excl) { struct cfs_hash_bucket *prev = NULL; - int i; + int i; /** * bds must be ascendantly ordered by bd->bd_bucket->hsb_index. @@ -729,7 +731,7 @@ cfs_hash_multi_bd_unlock(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, int excl) { struct cfs_hash_bucket *prev = NULL; - int i; + int i; cfs_hash_for_each_bd(bds, n, i) { if (prev != bds[i].bd_bucket) { @@ -743,8 +745,8 @@ static struct hlist_node * cfs_hash_multi_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, const void *key) { - struct hlist_node *ehnode; - unsigned i; + struct hlist_node *ehnode; + unsigned i; cfs_hash_for_each_bd(bds, n, i) { ehnode = cfs_hash_bd_lookup_intent(hs, &bds[i], key, NULL, @@ -756,13 +758,13 @@ cfs_hash_multi_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, } static struct hlist_node * -cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bds, unsigned n, const void *key, +cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, + unsigned n, const void *key, struct hlist_node *hnode, int noref) { - struct hlist_node *ehnode; - int intent; - unsigned i; + struct hlist_node *ehnode; + int intent; + unsigned i; LASSERT(hnode != NULL); intent = (!noref * CFS_HS_LOOKUP_MASK_REF) | CFS_HS_LOOKUP_IT_PEEK; @@ -777,7 +779,7 @@ cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, if (i == 1) { /* only one bucket */ cfs_hash_bd_add_locked(hs, &bds[0], hnode); } else { - struct cfs_hash_bd mybd; + struct cfs_hash_bd mybd; cfs_hash_bd_get(hs, key, &mybd); cfs_hash_bd_add_locked(hs, &mybd, hnode); @@ -791,8 +793,8 @@ cfs_hash_multi_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, const void *key, struct hlist_node *hnode) { - struct hlist_node *ehnode; - unsigned i; + struct hlist_node *ehnode; + unsigned int i; cfs_hash_for_each_bd(bds, n, i) { ehnode = cfs_hash_bd_lookup_intent(hs, &bds[i], key, hnode, @@ -806,7 +808,7 @@ cfs_hash_multi_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, static void cfs_hash_bd_order(struct cfs_hash_bd *bd1, struct cfs_hash_bd *bd2) { - int rc; + int rc; if (bd2->bd_bucket == NULL) return; @@ -831,7 +833,8 @@ cfs_hash_bd_order(struct cfs_hash_bd *bd1, struct cfs_hash_bd *bd2) } void -cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, struct cfs_hash_bd *bds) +cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, + struct cfs_hash_bd *bds) { /* NB: caller should hold hs_lock.rw if REHASH is set */ cfs_hash_bd_from_key(hs, hs->hs_buckets, @@ -894,7 +897,7 @@ static void cfs_hash_buckets_free(struct cfs_hash_bucket **buckets, int bkt_size, int prev_size, int size) { - int i; + int i; for (i = prev_size; i < size; i++) { if (buckets[i] != NULL) @@ -914,7 +917,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, unsigned int old_size, unsigned int new_size) { struct cfs_hash_bucket **new_bkts; - int i; + int i; LASSERT(old_size == 0 || old_bkts != NULL); @@ -932,7 +935,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, for (i = old_size; i < new_size; i++) { struct hlist_head *hhead; - struct cfs_hash_bd bd; + struct cfs_hash_bd bd; LIBCFS_ALLOC(new_bkts[i], cfs_hash_bkt_size(hs)); if (new_bkts[i] == NULL) { @@ -969,7 +972,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, * @max_bits - Maximum allowed hash table resize, in bits * @ops - Registered hash table operations * @flags - CFS_HASH_REHASH enable synamic hash resizing - * - CFS_HASH_SORT enable chained hash sort + * - CFS_HASH_SORT enable chained hash sort */ static int cfs_hash_rehash_worker(cfs_workitem_t *wi); @@ -977,10 +980,10 @@ static int cfs_hash_rehash_worker(cfs_workitem_t *wi); static int cfs_hash_dep_print(cfs_workitem_t *wi) { struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_dep_wi); - int dep; - int bkt; - int off; - int bits; + int dep; + int bkt; + int off; + int bits; spin_lock(&hs->hs_dep_lock); dep = hs->hs_dep_max; @@ -1031,7 +1034,7 @@ cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, struct cfs_hash_ops *ops, unsigned flags) { struct cfs_hash *hs; - int len; + int len; CLASSERT(CFS_HASH_THETA_BITS < 15); @@ -1077,7 +1080,7 @@ cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, hs->hs_max_bits = (__u8)max_bits; hs->hs_bkt_bits = (__u8)bkt_bits; - hs->hs_ops = ops; + hs->hs_ops = ops; hs->hs_extra_bytes = extra_bytes; hs->hs_rehash_bits = 0; cfs_wi_init(&hs->hs_rehash_wi, hs, cfs_hash_rehash_worker); @@ -1102,10 +1105,10 @@ EXPORT_SYMBOL(cfs_hash_create); static void cfs_hash_destroy(struct cfs_hash *hs) { - struct hlist_node *hnode; - struct hlist_node *pos; - struct cfs_hash_bd bd; - int i; + struct hlist_node *hnode; + struct hlist_node *pos; + struct cfs_hash_bd bd; + int i; LASSERT(hs != NULL); LASSERT(!cfs_hash_is_exiting(hs) && @@ -1223,8 +1226,8 @@ cfs_hash_rehash_inline(struct cfs_hash *hs) void cfs_hash_add(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) { - struct cfs_hash_bd bd; - int bits; + struct cfs_hash_bd bd; + int bits; LASSERT(hlist_unhashed(hnode)); @@ -1248,8 +1251,8 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, struct hlist_node *hnode, int noref) { struct hlist_node *ehnode; - struct cfs_hash_bd bds[2]; - int bits = 0; + struct cfs_hash_bd bds[2]; + int bits = 0; LASSERT(hlist_unhashed(hnode)); @@ -1261,7 +1264,7 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, hnode, noref); cfs_hash_dual_bd_unlock(hs, bds, 1); - if (ehnode == hnode) /* new item added */ + if (ehnode == hnode) /* new item added */ bits = cfs_hash_rehash_bits(hs); cfs_hash_unlock(hs, 0); if (bits > 0) @@ -1276,7 +1279,8 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, * Returns 0 on success or -EALREADY on key collisions. */ int -cfs_hash_add_unique(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) +cfs_hash_add_unique(struct cfs_hash *hs, const void *key, + struct hlist_node *hnode) { return cfs_hash_find_or_add(hs, key, hnode, 1) != hnode ? -EALREADY : 0; @@ -1309,9 +1313,9 @@ EXPORT_SYMBOL(cfs_hash_findadd_unique); void * cfs_hash_del(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) { - void *obj = NULL; - int bits = 0; - struct cfs_hash_bd bds[2]; + void *obj = NULL; + int bits = 0; + struct cfs_hash_bd bds[2]; cfs_hash_lock(hs, 0); cfs_hash_dual_bd_get_and_lock(hs, key, bds, 1); @@ -1364,9 +1368,9 @@ EXPORT_SYMBOL(cfs_hash_del_key); void * cfs_hash_lookup(struct cfs_hash *hs, const void *key) { - void *obj = NULL; - struct hlist_node *hnode; - struct cfs_hash_bd bds[2]; + void *obj = NULL; + struct hlist_node *hnode; + struct cfs_hash_bd bds[2]; cfs_hash_lock(hs, 0); cfs_hash_dual_bd_get_and_lock(hs, key, bds, 0); @@ -1383,7 +1387,8 @@ cfs_hash_lookup(struct cfs_hash *hs, const void *key) EXPORT_SYMBOL(cfs_hash_lookup); static void -cfs_hash_for_each_enter(struct cfs_hash *hs) { +cfs_hash_for_each_enter(struct cfs_hash *hs) +{ LASSERT(!cfs_hash_is_exiting(hs)); if (!cfs_hash_with_rehash(hs)) @@ -1408,7 +1413,8 @@ cfs_hash_for_each_enter(struct cfs_hash *hs) { } static void -cfs_hash_for_each_exit(struct cfs_hash *hs) { +cfs_hash_for_each_exit(struct cfs_hash *hs) +{ int remained; int bits; @@ -1439,14 +1445,15 @@ cfs_hash_for_each_exit(struct cfs_hash *hs) { */ static __u64 cfs_hash_for_each_tight(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, - void *data, int remove_safe) { - struct hlist_node *hnode; - struct hlist_node *pos; - struct cfs_hash_bd bd; - __u64 count = 0; - int excl = !!remove_safe; - int loop = 0; - int i; + void *data, int remove_safe) +{ + struct hlist_node *hnode; + struct hlist_node *pos; + struct cfs_hash_bd bd; + __u64 count = 0; + int excl = !!remove_safe; + int loop = 0; + int i; cfs_hash_for_each_enter(hs); @@ -1514,8 +1521,8 @@ void cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, void *data) { struct cfs_hash_cond_arg arg = { - .func = func, - .arg = data, + .func = func, + .arg = data, }; cfs_hash_for_each_tight(hs, cfs_hash_cond_del_locked, &arg, 1); @@ -1523,16 +1530,17 @@ cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, void *data) EXPORT_SYMBOL(cfs_hash_cond_del); void -cfs_hash_for_each(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) +cfs_hash_for_each(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) { cfs_hash_for_each_tight(hs, func, data, 0); } EXPORT_SYMBOL(cfs_hash_for_each); void -cfs_hash_for_each_safe(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { +cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ cfs_hash_for_each_tight(hs, func, data, 1); } EXPORT_SYMBOL(cfs_hash_for_each_safe); @@ -1581,15 +1589,16 @@ EXPORT_SYMBOL(cfs_hash_size_get); */ static int cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, - void *data) { + void *data) +{ struct hlist_node *hnode; struct hlist_node *tmp; - struct cfs_hash_bd bd; - __u32 version; - int count = 0; - int stop_on_change; - int rc; - int i; + struct cfs_hash_bd bd; + __u32 version; + int count = 0; + int stop_on_change; + int rc; + int i; stop_on_change = cfs_hash_with_rehash_key(hs) || !cfs_hash_with_no_itemref(hs) || @@ -1645,8 +1654,9 @@ cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, } int -cfs_hash_for_each_nolock(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { +cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ if (cfs_hash_with_no_lock(hs) || cfs_hash_with_rehash_key(hs) || !cfs_hash_with_no_itemref(hs)) @@ -1677,9 +1687,10 @@ EXPORT_SYMBOL(cfs_hash_for_each_nolock); * the required locking is in place to prevent concurrent insertions. */ int -cfs_hash_for_each_empty(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { - unsigned i = 0; +cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ + unsigned i = 0; if (cfs_hash_with_no_lock(hs)) return -EOPNOTSUPP; @@ -1703,9 +1714,9 @@ void cfs_hash_hlist_for_each(struct cfs_hash *hs, unsigned hindex, cfs_hash_for_each_cb_t func, void *data) { - struct hlist_head *hhead; - struct hlist_node *hnode; - struct cfs_hash_bd bd; + struct hlist_head *hhead; + struct hlist_node *hnode; + struct cfs_hash_bd bd; cfs_hash_for_each_enter(hs); cfs_hash_lock(hs, 0); @@ -1721,7 +1732,7 @@ cfs_hash_hlist_for_each(struct cfs_hash *hs, unsigned hindex, break; } cfs_hash_bd_unlock(hs, &bd, 0); - out: +out: cfs_hash_unlock(hs, 0); cfs_hash_for_each_exit(hs); } @@ -1736,10 +1747,11 @@ EXPORT_SYMBOL(cfs_hash_hlist_for_each); */ void cfs_hash_for_each_key(struct cfs_hash *hs, const void *key, - cfs_hash_for_each_cb_t func, void *data) { - struct hlist_node *hnode; - struct cfs_hash_bd bds[2]; - unsigned i; + cfs_hash_for_each_cb_t func, void *data) +{ + struct hlist_node *hnode; + struct cfs_hash_bd bds[2]; + unsigned int i; cfs_hash_lock(hs, 0); @@ -1777,7 +1789,7 @@ EXPORT_SYMBOL(cfs_hash_for_each_key); void cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) { - int i; + int i; /* need hold cfs_hash_lock(hs, 1) */ LASSERT(cfs_hash_with_rehash(hs) && @@ -1815,7 +1827,7 @@ EXPORT_SYMBOL(cfs_hash_rehash_cancel); int cfs_hash_rehash(struct cfs_hash *hs, int do_rehash) { - int rc; + int rc; LASSERT(cfs_hash_with_rehash(hs) && !cfs_hash_with_no_lock(hs)); @@ -1845,12 +1857,12 @@ EXPORT_SYMBOL(cfs_hash_rehash); static int cfs_hash_rehash_bd(struct cfs_hash *hs, struct cfs_hash_bd *old) { - struct cfs_hash_bd new; - struct hlist_head *hhead; - struct hlist_node *hnode; - struct hlist_node *pos; - void *key; - int c = 0; + struct cfs_hash_bd new; + struct hlist_head *hhead; + struct hlist_node *hnode; + struct hlist_node *pos; + void *key; + int c = 0; /* hold cfs_hash_lock(hs, 1), so don't need any bucket lock */ cfs_hash_bd_for_each_hlist(hs, old, hhead) { @@ -1876,17 +1888,17 @@ cfs_hash_rehash_bd(struct cfs_hash *hs, struct cfs_hash_bd *old) static int cfs_hash_rehash_worker(cfs_workitem_t *wi) { - struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_rehash_wi); + struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_rehash_wi); struct cfs_hash_bucket **bkts; - struct cfs_hash_bd bd; - unsigned int old_size; - unsigned int new_size; - int bsize; - int count = 0; - int rc = 0; - int i; + struct cfs_hash_bd bd; + unsigned int old_size; + unsigned int new_size; + int bsize; + int count = 0; + int rc = 0; + int i; - LASSERT (hs != NULL && cfs_hash_with_rehash(hs)); + LASSERT(hs != NULL && cfs_hash_with_rehash(hs)); cfs_hash_lock(hs, 0); LASSERT(cfs_hash_is_rehashing(hs)); @@ -1958,7 +1970,7 @@ cfs_hash_rehash_worker(cfs_workitem_t *wi) hs->hs_rehash_buckets = NULL; hs->hs_cur_bits = hs->hs_rehash_bits; - out: +out: hs->hs_rehash_bits = 0; if (rc == -ESRCH) /* never be scheduled again */ cfs_wi_exit(cfs_sched_rehash, wi); @@ -1986,9 +1998,9 @@ cfs_hash_rehash_worker(cfs_workitem_t *wi) void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key, void *new_key, struct hlist_node *hnode) { - struct cfs_hash_bd bds[3]; - struct cfs_hash_bd old_bds[2]; - struct cfs_hash_bd new_bd; + struct cfs_hash_bd bds[3]; + struct cfs_hash_bd old_bds[2]; + struct cfs_hash_bd new_bd; LASSERT(!hlist_unhashed(hnode)); @@ -2054,12 +2066,12 @@ cfs_hash_full_nbkt(struct cfs_hash *hs) void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) { - int dist[8] = { 0, }; - int maxdep = -1; - int maxdepb = -1; - int total = 0; - int theta; - int i; + int dist[8] = { 0, }; + int maxdep = -1; + int maxdepb = -1; + int total = 0; + int theta; + int i; cfs_hash_lock(hs, 0); theta = __cfs_hash_theta(hs); @@ -2085,11 +2097,11 @@ void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) * If you hash function results in a non-uniform hash the will * be observable by outlier bucks in the distribution histogram. * - * Uniform hash distribution: 128/128/0/0/0/0/0/0 - * Non-Uniform hash distribution: 128/125/0/0/0/0/2/1 + * Uniform hash distribution: 128/128/0/0/0/0/0/0 + * Non-Uniform hash distribution: 128/125/0/0/0/0/2/1 */ for (i = 0; i < cfs_hash_full_nbkt(hs); i++) { - struct cfs_hash_bd bd; + struct cfs_hash_bd bd; bd.bd_bucket = cfs_hash_full_bkts(hs)[i]; cfs_hash_bd_lock(hs, &bd, 0); -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:28 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:28 -0400 Subject: [lustre-devel] [PATCH 07/10] staging: lustre: cleanup over 80 characters in libcfs_hash.h In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-8-git-send-email-jsimmons@infradead.org> From: James Simmons Fix up all the over 80 character line issues in libcfs_hash.h reported by checkpatch.pl. At the same time update this header to match what is in the OpenSFS lustre branch. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 162 +++++++++++--------- 1 files changed, 93 insertions(+), 69 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index c9f550e..70b8b29 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -285,20 +285,22 @@ struct cfs_hash_lock_ops { struct cfs_hash_hlist_ops { /** return hlist_head of hash-head of @bd */ - struct hlist_head *(*hop_hhead)(struct cfs_hash *hs, struct cfs_hash_bd *bd); + struct hlist_head *(*hop_hhead)(struct cfs_hash *hs, + struct cfs_hash_bd *bd); /** return hash-head size */ int (*hop_hhead_size)(struct cfs_hash *hs); /** add @hnode to hash-head of @bd */ - int (*hop_hnode_add)(struct cfs_hash *hs, - struct cfs_hash_bd *bd, struct hlist_node *hnode); + int (*hop_hnode_add)(struct cfs_hash *hs, struct cfs_hash_bd *bd, + struct hlist_node *hnode); /** remove @hnode from hash-head of @bd */ - int (*hop_hnode_del)(struct cfs_hash *hs, - struct cfs_hash_bd *bd, struct hlist_node *hnode); + int (*hop_hnode_del)(struct cfs_hash *hs, struct cfs_hash_bd *bd, + struct hlist_node *hnode); }; struct cfs_hash_ops { /** return hashed value from @key */ - unsigned (*hs_hash)(struct cfs_hash *hs, const void *key, unsigned mask); + unsigned (*hs_hash)(struct cfs_hash *hs, const void *key, + unsigned mask); /** return key address of @hnode */ void * (*hs_key)(struct hlist_node *hnode); /** copy key from @hnode to @key */ @@ -315,7 +317,8 @@ struct cfs_hash_ops { /** release refcount of item */ void (*hs_put)(struct cfs_hash *hs, struct hlist_node *hnode); /** release refcount of item, always called with holding bucket-lock */ - void (*hs_put_locked)(struct cfs_hash *hs, struct hlist_node *hnode); + void (*hs_put_locked)(struct cfs_hash *hs, + struct hlist_node *hnode); /** it's called before removing of @hnode */ void (*hs_exit)(struct cfs_hash *hs, struct hlist_node *hnode); }; @@ -546,22 +549,26 @@ static inline void cfs_hash_bd_unlock(struct cfs_hash *hs, * operations on cfs_hash bucket (bd: bucket descriptor), * they are normally for hash-table without rehash */ -void cfs_hash_bd_get(struct cfs_hash *hs, const void *key, struct cfs_hash_bd *bd); +void cfs_hash_bd_get(struct cfs_hash *hs, const void *key, + struct cfs_hash_bd *bd); -static inline void cfs_hash_bd_get_and_lock(struct cfs_hash *hs, const void *key, - struct cfs_hash_bd *bd, int excl) +static inline void +cfs_hash_bd_get_and_lock(struct cfs_hash *hs, const void *key, + struct cfs_hash_bd *bd, int excl) { cfs_hash_bd_get(hs, key, bd); cfs_hash_bd_lock(hs, bd, excl); } -static inline unsigned cfs_hash_bd_index_get(struct cfs_hash *hs, struct cfs_hash_bd *bd) +static inline unsigned +cfs_hash_bd_index_get(struct cfs_hash *hs, struct cfs_hash_bd *bd) { return bd->bd_offset | (bd->bd_bucket->hsb_index << hs->hs_bkt_bits); } -static inline void cfs_hash_bd_index_set(struct cfs_hash *hs, - unsigned index, struct cfs_hash_bd *bd) +static inline void +cfs_hash_bd_index_set(struct cfs_hash *hs, unsigned index, + struct cfs_hash_bd *bd) { bd->bd_bucket = hs->hs_buckets[index >> hs->hs_bkt_bits]; bd->bd_offset = index & (CFS_HASH_BKT_NHLIST(hs) - 1U); @@ -611,68 +618,73 @@ void cfs_hash_bd_add_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, void cfs_hash_bd_del_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode); void cfs_hash_bd_move_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd_old, - struct cfs_hash_bd *bd_new, struct hlist_node *hnode); + struct cfs_hash_bd *bd_new, + struct hlist_node *hnode); -static inline int cfs_hash_bd_dec_and_lock(struct cfs_hash *hs, struct cfs_hash_bd *bd, - atomic_t *condition) +static inline int +cfs_hash_bd_dec_and_lock(struct cfs_hash *hs, struct cfs_hash_bd *bd, + atomic_t *condition) { LASSERT(cfs_hash_with_spin_bktlock(hs)); - return atomic_dec_and_lock(condition, - &bd->bd_bucket->hsb_lock.spin); + return atomic_dec_and_lock(condition, &bd->bd_bucket->hsb_lock.spin); } -static inline struct hlist_head *cfs_hash_bd_hhead(struct cfs_hash *hs, - struct cfs_hash_bd *bd) +static inline struct hlist_head * +cfs_hash_bd_hhead(struct cfs_hash *hs, struct cfs_hash_bd *bd) { return hs->hs_hops->hop_hhead(hs, bd); } -struct hlist_node *cfs_hash_bd_lookup_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bd, const void *key); -struct hlist_node *cfs_hash_bd_peek_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bd, const void *key); -struct hlist_node *cfs_hash_bd_findadd_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bd, const void *key, - struct hlist_node *hnode, - int insist_add); -struct hlist_node *cfs_hash_bd_finddel_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bd, const void *key, - struct hlist_node *hnode); +struct hlist_node * +cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key); +struct hlist_node * +cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key); +struct hlist_node * +cfs_hash_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key, struct hlist_node *hnode, + int insist_add); +struct hlist_node * +cfs_hash_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key, struct hlist_node *hnode); /** * operations on cfs_hash bucket (bd: bucket descriptor), * they are safe for hash-table with rehash */ -void cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, struct cfs_hash_bd *bds); -void cfs_hash_dual_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds, int excl); -void cfs_hash_dual_bd_unlock(struct cfs_hash *hs, struct cfs_hash_bd *bds, int excl); +void cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, + struct cfs_hash_bd *bds); +void cfs_hash_dual_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds, + int excl); +void cfs_hash_dual_bd_unlock(struct cfs_hash *hs, struct cfs_hash_bd *bds, + int excl); -static inline void cfs_hash_dual_bd_get_and_lock(struct cfs_hash *hs, const void *key, - struct cfs_hash_bd *bds, int excl) +static inline void +cfs_hash_dual_bd_get_and_lock(struct cfs_hash *hs, const void *key, + struct cfs_hash_bd *bds, int excl) { cfs_hash_dual_bd_get(hs, key, bds); cfs_hash_dual_bd_lock(hs, bds, excl); } -struct hlist_node *cfs_hash_dual_bd_lookup_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bds, - const void *key); -struct hlist_node *cfs_hash_dual_bd_findadd_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bds, - const void *key, - struct hlist_node *hnode, - int insist_add); -struct hlist_node *cfs_hash_dual_bd_finddel_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bds, - const void *key, - struct hlist_node *hnode); +struct hlist_node * +cfs_hash_dual_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, + const void *key); +struct hlist_node * +cfs_hash_dual_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, + const void *key, struct hlist_node *hnode, + int insist_add); +struct hlist_node * +cfs_hash_dual_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, + const void *key, struct hlist_node *hnode); /* Hash init/cleanup functions */ -struct cfs_hash *cfs_hash_create(char *name, unsigned cur_bits, - unsigned max_bits, unsigned bkt_bits, - unsigned extra_bytes, unsigned min_theta, - unsigned max_theta, struct cfs_hash_ops *ops, - unsigned flags); +struct cfs_hash * +cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, + unsigned bkt_bits, unsigned extra_bytes, + unsigned min_theta, unsigned max_theta, + struct cfs_hash_ops *ops, unsigned flags); struct cfs_hash *cfs_hash_getref(struct cfs_hash *hs); void cfs_hash_putref(struct cfs_hash *hs); @@ -686,28 +698,39 @@ void *cfs_hash_findadd_unique(struct cfs_hash *hs, const void *key, struct hlist_node *hnode); /* Hash deletion functions */ -void *cfs_hash_del(struct cfs_hash *hs, const void *key, struct hlist_node *hnode); +void *cfs_hash_del(struct cfs_hash *hs, const void *key, + struct hlist_node *hnode); void *cfs_hash_del_key(struct cfs_hash *hs, const void *key); /* Hash lookup/for_each functions */ #define CFS_HASH_LOOP_HOG 1024 -typedef int (*cfs_hash_for_each_cb_t)(struct cfs_hash *hs, struct cfs_hash_bd *bd, - struct hlist_node *node, void *data); -void *cfs_hash_lookup(struct cfs_hash *hs, const void *key); -void cfs_hash_for_each(struct cfs_hash *hs, cfs_hash_for_each_cb_t, void *data); -void cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t, void *data); -int cfs_hash_for_each_nolock(struct cfs_hash *hs, - cfs_hash_for_each_cb_t, void *data); -int cfs_hash_for_each_empty(struct cfs_hash *hs, - cfs_hash_for_each_cb_t, void *data); -void cfs_hash_for_each_key(struct cfs_hash *hs, const void *key, - cfs_hash_for_each_cb_t, void *data); +typedef int (*cfs_hash_for_each_cb_t)(struct cfs_hash *hs, + struct cfs_hash_bd *bd, + struct hlist_node *node, + void *data); +void * +cfs_hash_lookup(struct cfs_hash *hs, const void *key); +void +cfs_hash_for_each(struct cfs_hash *hs, cfs_hash_for_each_cb_t, void *data); +void +cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t, void *data); +int +cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t, + void *data); +int +cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t, + void *data); +void +cfs_hash_for_each_key(struct cfs_hash *hs, const void *key, + cfs_hash_for_each_cb_t, void *data); typedef int (*cfs_hash_cond_opt_cb_t)(void *obj, void *data); -void cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t, void *data); +void +cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t, void *data); -void cfs_hash_hlist_for_each(struct cfs_hash *hs, unsigned hindex, - cfs_hash_for_each_cb_t, void *data); +void +cfs_hash_hlist_for_each(struct cfs_hash *hs, unsigned hindex, + cfs_hash_for_each_cb_t, void *data); int cfs_hash_is_empty(struct cfs_hash *hs); __u64 cfs_hash_size_get(struct cfs_hash *hs); @@ -777,7 +800,8 @@ static inline int __cfs_hash_theta(struct cfs_hash *hs) CFS_HASH_THETA_BITS) >> hs->hs_cur_bits; } -static inline void __cfs_hash_set_theta(struct cfs_hash *hs, int min, int max) +static inline void +__cfs_hash_set_theta(struct cfs_hash *hs, int min, int max) { LASSERT(min < max); hs->hs_min_theta = (__u16)min; -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:30 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:30 -0400 Subject: [lustre-devel] [PATCH 09/10] staging: lustre: fix remaining checkpatch issues for libcfs_hash.h In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-10-git-send-email-jsimmons@infradead.org> From: James Simmons Final cleanup to make libcfs_hash.h completely kernel standard compliant. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 5df8ba2..563b2b4 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -62,7 +62,8 @@ /** disable debug */ #define CFS_HASH_DEBUG_NONE 0 /** record hash depth and output to console when it's too deep, - * computing overhead is low but consume more memory */ + * computing overhead is low but consume more memory + */ #define CFS_HASH_DEBUG_1 1 /** expensive, check key validation */ #define CFS_HASH_DEBUG_2 2 @@ -158,7 +159,8 @@ enum cfs_hash_tag { */ CFS_HASH_NBLK_CHANGE = 1 << 13, /** NB, we typed hs_flags as __u16, please change it - * if you need to extend >=16 flags */ + * if you need to extend >=16 flags + */ }; /** most used attributes */ @@ -206,7 +208,8 @@ enum cfs_hash_tag { struct cfs_hash { /** serialize with rehash, or serialize all operations if - * the hash-table has CFS_HASH_NO_BKTLOCK */ + * the hash-table has CFS_HASH_NO_BKTLOCK + */ union cfs_hash_lock hs_lock; /** hash operations */ struct cfs_hash_ops *hs_ops; @@ -375,7 +378,8 @@ cfs_hash_with_no_itemref(struct cfs_hash *hs) { /* hash-table doesn't keep refcount on item, * item can't be removed from hash unless it's - * ZERO refcount */ + * ZERO refcount. + */ return (hs->hs_flags & CFS_HASH_NO_ITEMREF) != 0; } @@ -820,7 +824,7 @@ cfs_hash_djb2_hash(const void *key, size_t size, unsigned mask) { unsigned i, hash = 5381; - LASSERT(key != NULL); + LASSERT(key); for (i = 0; i < size; i++) hash = hash * 33 + ((char *)key)[i]; @@ -848,7 +852,7 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask) /** iterate over all buckets in @bds (array of struct cfs_hash_bd) */ #define cfs_hash_for_each_bd(bds, n, i) \ - for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++) + for (i = 0; i < n && (bds)[i].bd_bucket; i++) /** iterate over all buckets of @hs */ #define cfs_hash_for_each_bucket(hs, bd, pos) \ -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:22 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:22 -0400 Subject: [lustre-devel] [PATCH 01/10] staging: lustre: change cfs_hash_lock_ops_t to struct In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-2-git-send-email-jsimmons@infradead.org> From: James Simmons Change cfs_hash_lock_ops_t to struct cfs_hash_lock_ops. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 4 ++-- drivers/staging/lustre/lustre/libcfs/hash.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index c408145..778feb6 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -272,7 +272,7 @@ struct cfs_hash { char hs_name[0]; }; -typedef struct cfs_hash_lock_ops { +struct cfs_hash_lock_ops { /** lock the hash table */ void (*hs_lock)(union cfs_hash_lock *lock, int exclusive); /** unlock the hash table */ @@ -281,7 +281,7 @@ typedef struct cfs_hash_lock_ops { void (*hs_bkt_lock)(union cfs_hash_lock *lock, int exclusive); /** unlock the hash bucket */ void (*hs_bkt_unlock)(union cfs_hash_lock *lock, int exclusive); -} cfs_hash_lock_ops_t; +}; typedef struct cfs_hash_hlist_ops { /** return hlist_head of hash-head of @bd */ diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 6f4c7d4..b78feb0 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -159,7 +159,7 @@ cfs_hash_rw_unlock(union cfs_hash_lock *lock, int exclusive) } /** No lock hash */ -static cfs_hash_lock_ops_t cfs_hash_nl_lops = { +static struct cfs_hash_lock_ops cfs_hash_nl_lops = { .hs_lock = cfs_hash_nl_lock, .hs_unlock = cfs_hash_nl_unlock, .hs_bkt_lock = cfs_hash_nl_lock, @@ -167,7 +167,7 @@ static cfs_hash_lock_ops_t cfs_hash_nl_lops = { }; /** no bucket lock, one spinlock to protect everything */ -static cfs_hash_lock_ops_t cfs_hash_nbl_lops = { +static struct cfs_hash_lock_ops cfs_hash_nbl_lops = { .hs_lock = cfs_hash_spin_lock, .hs_unlock = cfs_hash_spin_unlock, .hs_bkt_lock = cfs_hash_nl_lock, @@ -175,7 +175,7 @@ static cfs_hash_lock_ops_t cfs_hash_nbl_lops = { }; /** spin bucket lock, rehash is enabled */ -static cfs_hash_lock_ops_t cfs_hash_bkt_spin_lops = { +static struct cfs_hash_lock_ops cfs_hash_bkt_spin_lops = { .hs_lock = cfs_hash_rw_lock, .hs_unlock = cfs_hash_rw_unlock, .hs_bkt_lock = cfs_hash_spin_lock, @@ -183,7 +183,7 @@ static cfs_hash_lock_ops_t cfs_hash_bkt_spin_lops = { }; /** rw bucket lock, rehash is enabled */ -static cfs_hash_lock_ops_t cfs_hash_bkt_rw_lops = { +static struct cfs_hash_lock_ops cfs_hash_bkt_rw_lops = { .hs_lock = cfs_hash_rw_lock, .hs_unlock = cfs_hash_rw_unlock, .hs_bkt_lock = cfs_hash_rw_lock, @@ -191,7 +191,7 @@ static cfs_hash_lock_ops_t cfs_hash_bkt_rw_lops = { }; /** spin bucket lock, rehash is disabled */ -static cfs_hash_lock_ops_t cfs_hash_nr_bkt_spin_lops = { +static struct cfs_hash_lock_ops cfs_hash_nr_bkt_spin_lops = { .hs_lock = cfs_hash_nl_lock, .hs_unlock = cfs_hash_nl_unlock, .hs_bkt_lock = cfs_hash_spin_lock, @@ -199,7 +199,7 @@ static cfs_hash_lock_ops_t cfs_hash_nr_bkt_spin_lops = { }; /** rw bucket lock, rehash is disabled */ -static cfs_hash_lock_ops_t cfs_hash_nr_bkt_rw_lops = { +static struct cfs_hash_lock_ops cfs_hash_nr_bkt_rw_lops = { .hs_lock = cfs_hash_nl_lock, .hs_unlock = cfs_hash_nl_unlock, .hs_bkt_lock = cfs_hash_rw_lock, -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:24 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:24 -0400 Subject: [lustre-devel] [PATCH 03/10] staging: lustre: change cfs_hash_ops_t to struct In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-4-git-send-email-jsimmons@infradead.org> From: James Simmons Change cfs_hash_ops_t to struct cfs_hash_ops. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 21 ++++++++++--------- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 18 ++++++++-------- drivers/staging/lustre/lustre/libcfs/hash.c | 2 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 2 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 6 ++-- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 ++-- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 ++-- .../staging/lustre/lustre/obdclass/obd_config.c | 8 +++--- drivers/staging/lustre/lustre/osc/osc_quota.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/connection.c | 8 +++--- 10 files changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 6ac54a0..200b760 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -211,13 +211,13 @@ enum cfs_hash_tag { struct cfs_hash { /** serialize with rehash, or serialize all operations if * the hash-table has CFS_HASH_NO_BKTLOCK */ - union cfs_hash_lock hs_lock; + union cfs_hash_lock hs_lock; /** hash operations */ - struct cfs_hash_ops *hs_ops; + struct cfs_hash_ops *hs_ops; /** hash lock operations */ - struct cfs_hash_lock_ops *hs_lops; + struct cfs_hash_lock_ops *hs_lops; /** hash list operations */ - struct cfs_hash_hlist_ops *hs_hops; + struct cfs_hash_hlist_ops *hs_hops; /** hash buckets-table */ struct cfs_hash_bucket **hs_buckets; /** total number of items on this hash-table */ @@ -296,7 +296,7 @@ struct cfs_hash_hlist_ops { struct cfs_hash_bd *bd, struct hlist_node *hnode); }; -typedef struct cfs_hash_ops { +struct cfs_hash_ops { /** return hashed value from @key */ unsigned (*hs_hash)(struct cfs_hash *hs, const void *key, unsigned mask); /** return key address of @hnode */ @@ -318,7 +318,7 @@ typedef struct cfs_hash_ops { void (*hs_put_locked)(struct cfs_hash *hs, struct hlist_node *hnode); /** it's called before removing of @hnode */ void (*hs_exit)(struct cfs_hash *hs, struct hlist_node *hnode); -} cfs_hash_ops_t; +}; /** total number of buckets in @hs */ #define CFS_HASH_NBKT(hs) \ @@ -668,10 +668,11 @@ struct hlist_node *cfs_hash_dual_bd_finddel_locked(struct cfs_hash *hs, struct hlist_node *hnode); /* Hash init/cleanup functions */ -struct cfs_hash *cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, - unsigned bkt_bits, unsigned extra_bytes, - unsigned min_theta, unsigned max_theta, - cfs_hash_ops_t *ops, unsigned flags); +struct cfs_hash *cfs_hash_create(char *name, unsigned cur_bits, + unsigned max_bits, unsigned bkt_bits, + unsigned extra_bytes, unsigned min_theta, + unsigned max_theta, struct cfs_hash_ops *ops, + unsigned flags); struct cfs_hash *cfs_hash_getref(struct cfs_hash *hs); void cfs_hash_putref(struct cfs_hash *hs); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 342c465..c0a54bf 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -531,26 +531,26 @@ static void ldlm_res_hop_put(struct cfs_hash *hs, struct hlist_node *hnode) ldlm_resource_putref(res); } -static cfs_hash_ops_t ldlm_ns_hash_ops = { +static struct cfs_hash_ops ldlm_ns_hash_ops = { .hs_hash = ldlm_res_hop_hash, - .hs_key = ldlm_res_hop_key, + .hs_key = ldlm_res_hop_key, .hs_keycmp = ldlm_res_hop_keycmp, .hs_keycpy = NULL, .hs_object = ldlm_res_hop_object, - .hs_get = ldlm_res_hop_get_locked, + .hs_get = ldlm_res_hop_get_locked, .hs_put_locked = ldlm_res_hop_put_locked, - .hs_put = ldlm_res_hop_put + .hs_put = ldlm_res_hop_put }; -static cfs_hash_ops_t ldlm_ns_fid_hash_ops = { +static struct cfs_hash_ops ldlm_ns_fid_hash_ops = { .hs_hash = ldlm_res_hop_fid_hash, - .hs_key = ldlm_res_hop_key, + .hs_key = ldlm_res_hop_key, .hs_keycmp = ldlm_res_hop_keycmp, .hs_keycpy = NULL, .hs_object = ldlm_res_hop_object, - .hs_get = ldlm_res_hop_get_locked, + .hs_get = ldlm_res_hop_get_locked, .hs_put_locked = ldlm_res_hop_put_locked, - .hs_put = ldlm_res_hop_put + .hs_put = ldlm_res_hop_put }; struct ldlm_ns_hash_def { @@ -560,7 +560,7 @@ struct ldlm_ns_hash_def { /** hash bits */ unsigned nsd_all_bits; /** hash operations */ - cfs_hash_ops_t *nsd_hops; + struct cfs_hash_ops *nsd_hops; }; static struct ldlm_ns_hash_def ldlm_ns_hash_defs[] = { diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 63c4434..f8026e1 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -1019,7 +1019,7 @@ struct cfs_hash * cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, unsigned bkt_bits, unsigned extra_bytes, unsigned min_theta, unsigned max_theta, - cfs_hash_ops_t *ops, unsigned flags) + struct cfs_hash_ops *ops, unsigned flags) { struct cfs_hash *hs; int len; diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index bdee0a6..515a5c1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -234,7 +234,7 @@ void lprocfs_lov_init_vars(struct lprocfs_static_vars *lvars); extern struct lu_device_type lov_device_type; /* pools */ -extern cfs_hash_ops_t pool_hash_operations; +extern struct cfs_hash_ops pool_hash_operations; /* ost_pool methods */ int lov_ost_pool_init(struct ost_pool *op, unsigned int count); int lov_ost_pool_extend(struct ost_pool *op, unsigned int min_count); diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index 2234321..b03827e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -142,12 +142,12 @@ static void pool_hashrefcount_put_locked(struct cfs_hash *hs, lov_pool_putref_locked(pool); } -cfs_hash_ops_t pool_hash_operations = { +struct cfs_hash_ops pool_hash_operations = { .hs_hash = pool_hashfn, - .hs_key = pool_key, + .hs_key = pool_key, .hs_keycmp = pool_hashkey_keycmp, .hs_object = pool_hashobject, - .hs_get = pool_hashrefcount_get, + .hs_get = pool_hashrefcount_get, .hs_put_locked = pool_hashrefcount_put_locked, }; diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index f59c03c..a1a6024 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -586,12 +586,12 @@ static void cl_env_hops_noop(struct cfs_hash *hs, struct hlist_node *hn) LASSERT(cle->ce_magic == &cl_env_init0); } -static cfs_hash_ops_t cl_env_hops = { +static struct cfs_hash_ops cl_env_hops = { .hs_hash = cl_env_hops_hash, - .hs_key = cl_env_hops_obj, + .hs_key = cl_env_hops_obj, .hs_keycmp = cl_env_hops_keycmp, .hs_object = cl_env_hops_obj, - .hs_get = cl_env_hops_noop, + .hs_get = cl_env_hops_noop, .hs_put_locked = cl_env_hops_noop, }; diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 0d15bd5..0193608 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -916,12 +916,12 @@ static void lu_obj_hop_put_locked(struct cfs_hash *hs, struct hlist_node *hnode) LBUG(); /* we should never called it */ } -cfs_hash_ops_t lu_site_hash_ops = { +struct cfs_hash_ops lu_site_hash_ops = { .hs_hash = lu_obj_hop_hash, - .hs_key = lu_obj_hop_key, + .hs_key = lu_obj_hop_key, .hs_keycmp = lu_obj_hop_keycmp, .hs_object = lu_obj_hop_object, - .hs_get = lu_obj_hop_get, + .hs_get = lu_obj_hop_get, .hs_put_locked = lu_obj_hop_put_locked, }; diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 64753b3..c231e0d 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -47,7 +47,7 @@ #include "llog_internal.h" -static cfs_hash_ops_t uuid_hash_ops; +static struct cfs_hash_ops uuid_hash_ops; /*********** string parsing utils *********/ @@ -1473,11 +1473,11 @@ uuid_export_put_locked(struct cfs_hash *hs, struct hlist_node *hnode) class_export_put(exp); } -static cfs_hash_ops_t uuid_hash_ops = { +static struct cfs_hash_ops uuid_hash_ops = { .hs_hash = uuid_hash, - .hs_key = uuid_key, + .hs_key = uuid_key, .hs_keycmp = uuid_keycmp, .hs_object = uuid_export_object, - .hs_get = uuid_export_get, + .hs_get = uuid_export_get, .hs_put_locked = uuid_export_put_locked, }; diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c index df8cfb4..1997831 100644 --- a/drivers/staging/lustre/lustre/osc/osc_quota.c +++ b/drivers/staging/lustre/lustre/osc/osc_quota.c @@ -193,7 +193,7 @@ oqi_exit(struct cfs_hash *hs, struct hlist_node *hnode) #define HASH_QUOTA_CUR_BITS 5 #define HASH_QUOTA_MAX_BITS 15 -static cfs_hash_ops_t quota_hash_ops = { +static struct cfs_hash_ops quota_hash_ops = { .hs_hash = oqi_hashfn, .hs_keycmp = oqi_keycmp, .hs_key = oqi_key, diff --git a/drivers/staging/lustre/lustre/ptlrpc/connection.c b/drivers/staging/lustre/lustre/ptlrpc/connection.c index 1ba1f5f..da1f0b1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/connection.c +++ b/drivers/staging/lustre/lustre/ptlrpc/connection.c @@ -42,7 +42,7 @@ #include "ptlrpc_internal.h" static struct cfs_hash *conn_hash; -static cfs_hash_ops_t conn_hash_ops; +static struct cfs_hash_ops conn_hash_ops; struct ptlrpc_connection * ptlrpc_connection_get(lnet_process_id_t peer, lnet_nid_t self, @@ -230,12 +230,12 @@ conn_exit(struct cfs_hash *hs, struct hlist_node *hnode) kfree(conn); } -static cfs_hash_ops_t conn_hash_ops = { +static struct cfs_hash_ops conn_hash_ops = { .hs_hash = conn_hashfn, .hs_keycmp = conn_keycmp, - .hs_key = conn_key, + .hs_key = conn_key, .hs_object = conn_object, - .hs_get = conn_get, + .hs_get = conn_get, .hs_put_locked = conn_put_locked, .hs_exit = conn_exit, }; -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:27 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:27 -0400 Subject: [lustre-devel] [PATCH 06/10] staging: lustre: convert last typedef data types in hash.c In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-7-git-send-email-jsimmons@infradead.org> From: James Simmons Change the last typedef data types cfs_hash_lookup_intent_t to enum and cfs_hash_cond_arg_t to a structure. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/libcfs/hash.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index c267f8a..0308744 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -606,7 +606,7 @@ enum { CFS_HS_LOOKUP_MASK_DEL = BIT(3), }; -typedef enum cfs_hash_lookup_intent { +enum cfs_hash_lookup_intent { /** return item w/o refcount */ CFS_HS_LOOKUP_IT_PEEK = CFS_HS_LOOKUP_MASK_FIND, /** return item with refcount */ @@ -621,12 +621,12 @@ typedef enum cfs_hash_lookup_intent { /** delete if existed */ CFS_HS_LOOKUP_IT_FINDDEL = (CFS_HS_LOOKUP_MASK_FIND | CFS_HS_LOOKUP_MASK_DEL) -} cfs_hash_lookup_intent_t; +}; static struct hlist_node * cfs_hash_bd_lookup_intent(struct cfs_hash *hs, struct cfs_hash_bd *bd, const void *key, struct hlist_node *hnode, - cfs_hash_lookup_intent_t intent) + enum cfs_hash_lookup_intent intent) { struct hlist_head *hhead = cfs_hash_bd_hhead(hs, bd); @@ -1489,16 +1489,16 @@ cfs_hash_for_each_tight(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, return count; } -typedef struct { - cfs_hash_cond_opt_cb_t func; - void *arg; -} cfs_hash_cond_arg_t; +struct cfs_hash_cond_arg { + cfs_hash_cond_opt_cb_t func; + void *arg; +}; static int cfs_hash_cond_del_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *data) { - cfs_hash_cond_arg_t *cond = data; + struct cfs_hash_cond_arg *cond = data; if (cond->func(cfs_hash_object(hs, hnode), cond->arg)) cfs_hash_bd_del_locked(hs, bd, hnode); @@ -1513,7 +1513,7 @@ cfs_hash_cond_del_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, void cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, void *data) { - cfs_hash_cond_arg_t arg = { + struct cfs_hash_cond_arg arg = { .func = func, .arg = data, }; -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:26 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:26 -0400 Subject: [lustre-devel] [PATCH 05/10] staging: lustre: change cfs_hash_head*_t to struct In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-6-git-send-email-jsimmons@infradead.org> From: James Simmons Change cfs_hash_head_t and cfs_head_head_dep_t from typedef to true structures. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 4 +- drivers/staging/lustre/lustre/libcfs/hash.c | 33 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 805f298..c9f550e 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -88,8 +88,8 @@ union cfs_hash_lock { * cfs_hash_bucket is a container of: * - lock, counter ... * - array of hash-head starting from hsb_head[0], hash-head can be one of - * . cfs_hash_head_t - * . cfs_hash_head_dep_t + * . struct cfs_hash_head + * . struct cfs_hash_head_dep * . struct cfs_hash_dhead * . struct cfs_hash_dhead_dep * which depends on requirement of user diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 575e8a8..c267f8a 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -239,21 +239,22 @@ cfs_hash_lock_setup(struct cfs_hash *hs) * Simple hash head without depth tracking * new element is always added to head of hlist */ -typedef struct { +struct cfs_hash_head { struct hlist_head hh_head; /**< entries list */ -} cfs_hash_head_t; +}; static int cfs_hash_hh_hhead_size(struct cfs_hash *hs) { - return sizeof(cfs_hash_head_t); + return sizeof(struct cfs_hash_head); } static struct hlist_head * cfs_hash_hh_hhead(struct cfs_hash *hs, struct cfs_hash_bd *bd) { - cfs_hash_head_t *head = (cfs_hash_head_t *)&bd->bd_bucket->hsb_head[0]; + struct cfs_hash_head *head; + head = (struct cfs_hash_head *)&bd->bd_bucket->hsb_head[0]; return &head[bd->bd_offset].hh_head; } @@ -277,23 +278,23 @@ cfs_hash_hh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, * Simple hash head with depth tracking * new element is always added to head of hlist */ -typedef struct { +struct cfs_hash_head_dep { struct hlist_head hd_head; /**< entries list */ - unsigned int hd_depth; /**< list length */ -} cfs_hash_head_dep_t; + unsigned int hd_depth; /**< list length */ +}; static int cfs_hash_hd_hhead_size(struct cfs_hash *hs) { - return sizeof(cfs_hash_head_dep_t); + return sizeof(struct cfs_hash_head_dep); } static struct hlist_head * cfs_hash_hd_hhead(struct cfs_hash *hs, struct cfs_hash_bd *bd) { - cfs_hash_head_dep_t *head; + struct cfs_hash_head_dep *head; - head = (cfs_hash_head_dep_t *)&bd->bd_bucket->hsb_head[0]; + head = (struct cfs_hash_head_dep *)&bd->bd_bucket->hsb_head[0]; return &head[bd->bd_offset].hd_head; } @@ -301,8 +302,10 @@ static int cfs_hash_hd_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - cfs_hash_head_dep_t *hh = container_of(cfs_hash_hd_hhead(hs, bd), - cfs_hash_head_dep_t, hd_head); + struct cfs_hash_head_dep *hh; + + hh = container_of(cfs_hash_hd_hhead(hs, bd), + struct cfs_hash_head_dep, hd_head); hlist_add_head(hnode, &hh->hd_head); return ++hh->hd_depth; } @@ -311,8 +314,10 @@ static int cfs_hash_hd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - cfs_hash_head_dep_t *hh = container_of(cfs_hash_hd_hhead(hs, bd), - cfs_hash_head_dep_t, hd_head); + struct cfs_hash_head_dep *hh; + + hh = container_of(cfs_hash_hd_hhead(hs, bd), + struct cfs_hash_head_dep, hd_head); hlist_del_init(hnode); return --hh->hd_depth; } -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:25 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:25 -0400 Subject: [lustre-devel] [PATCH 04/10] staging: lustre: change cfs_hash_dhead*_t to struct In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-5-git-send-email-jsimmons@infradead.org> From: James Simmons Change cfs_hash_dhead_t and cfs_head_dhead_dep_to from typedef to true structures. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 4 +- drivers/staging/lustre/lustre/libcfs/hash.c | 40 +++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 200b760..805f298 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -90,8 +90,8 @@ union cfs_hash_lock { * - array of hash-head starting from hsb_head[0], hash-head can be one of * . cfs_hash_head_t * . cfs_hash_head_dep_t - * . cfs_hash_dhead_t - * . cfs_hash_dhead_dep_t + * . struct cfs_hash_dhead + * . struct cfs_hash_dhead_dep * which depends on requirement of user * - some extra bytes (caller can require it while creating hash) */ diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index f8026e1..575e8a8 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -321,23 +321,23 @@ cfs_hash_hd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, * double links hash head without depth tracking * new element is always added to tail of hlist */ -typedef struct { +struct cfs_hash_dhead { struct hlist_head dh_head; /**< entries list */ struct hlist_node *dh_tail; /**< the last entry */ -} cfs_hash_dhead_t; +}; static int cfs_hash_dh_hhead_size(struct cfs_hash *hs) { - return sizeof(cfs_hash_dhead_t); + return sizeof(struct cfs_hash_dhead); } static struct hlist_head * cfs_hash_dh_hhead(struct cfs_hash *hs, struct cfs_hash_bd *bd) { - cfs_hash_dhead_t *head; + struct cfs_hash_dhead *head; - head = (cfs_hash_dhead_t *)&bd->bd_bucket->hsb_head[0]; + head = (struct cfs_hash_dhead *)&bd->bd_bucket->hsb_head[0]; return &head[bd->bd_offset].dh_head; } @@ -345,9 +345,10 @@ static int cfs_hash_dh_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - cfs_hash_dhead_t *dh = container_of(cfs_hash_dh_hhead(hs, bd), - cfs_hash_dhead_t, dh_head); + struct cfs_hash_dhead *dh; + dh = container_of(cfs_hash_dh_hhead(hs, bd), + struct cfs_hash_dhead, dh_head); if (dh->dh_tail != NULL) /* not empty */ hlist_add_behind(hnode, dh->dh_tail); else /* empty list */ @@ -360,9 +361,10 @@ static int cfs_hash_dh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnd) { - cfs_hash_dhead_t *dh = container_of(cfs_hash_dh_hhead(hs, bd), - cfs_hash_dhead_t, dh_head); + struct cfs_hash_dhead *dh; + dh = container_of(cfs_hash_dh_hhead(hs, bd), + struct cfs_hash_dhead, dh_head); if (hnd->next == NULL) { /* it's the tail */ dh->dh_tail = (hnd->pprev == &dh->dh_head.first) ? NULL : container_of(hnd->pprev, struct hlist_node, next); @@ -375,24 +377,24 @@ cfs_hash_dh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, * double links hash head with depth tracking * new element is always added to tail of hlist */ -typedef struct { +struct cfs_hash_dhead_dep { struct hlist_head dd_head; /**< entries list */ struct hlist_node *dd_tail; /**< the last entry */ unsigned int dd_depth; /**< list length */ -} cfs_hash_dhead_dep_t; +}; static int cfs_hash_dd_hhead_size(struct cfs_hash *hs) { - return sizeof(cfs_hash_dhead_dep_t); + return sizeof(struct cfs_hash_dhead_dep); } static struct hlist_head * cfs_hash_dd_hhead(struct cfs_hash *hs, struct cfs_hash_bd *bd) { - cfs_hash_dhead_dep_t *head; + struct cfs_hash_dhead_dep *head; - head = (cfs_hash_dhead_dep_t *)&bd->bd_bucket->hsb_head[0]; + head = (struct cfs_hash_dhead_dep *)&bd->bd_bucket->hsb_head[0]; return &head[bd->bd_offset].dd_head; } @@ -400,9 +402,10 @@ static int cfs_hash_dd_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - cfs_hash_dhead_dep_t *dh = container_of(cfs_hash_dd_hhead(hs, bd), - cfs_hash_dhead_dep_t, dd_head); + struct cfs_hash_dhead_dep *dh; + dh = container_of(cfs_hash_dd_hhead(hs, bd), + struct cfs_hash_dhead_dep, dd_head); if (dh->dd_tail != NULL) /* not empty */ hlist_add_behind(hnode, dh->dd_tail); else /* empty list */ @@ -415,9 +418,10 @@ static int cfs_hash_dd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnd) { - cfs_hash_dhead_dep_t *dh = container_of(cfs_hash_dd_hhead(hs, bd), - cfs_hash_dhead_dep_t, dd_head); + struct cfs_hash_dhead_dep *dh; + dh = container_of(cfs_hash_dd_hhead(hs, bd), + struct cfs_hash_dhead_dep, dd_head); if (hnd->next == NULL) { /* it's the tail */ dh->dd_tail = (hnd->pprev == &dh->dd_head.first) ? NULL : container_of(hnd->pprev, struct hlist_node, next); -- 1.7.1 From jsimmons at infradead.org Wed Oct 28 16:54:23 2015 From: jsimmons at infradead.org (James Simmons) Date: Wed, 28 Oct 2015 12:54:23 -0400 Subject: [lustre-devel] [PATCH 02/10] staging: lustre: change cfs_hash_hlist_ops_t to struct In-Reply-To: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446051271-25189-3-git-send-email-jsimmons@infradead.org> From: James Simmons Change cfs_hash_hlist_ops_t to struct cfs_hash_hlist_ops. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 4 ++-- drivers/staging/lustre/lustre/libcfs/hash.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 778feb6..6ac54a0 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -283,7 +283,7 @@ struct cfs_hash_lock_ops { void (*hs_bkt_unlock)(union cfs_hash_lock *lock, int exclusive); }; -typedef struct cfs_hash_hlist_ops { +struct cfs_hash_hlist_ops { /** return hlist_head of hash-head of @bd */ struct hlist_head *(*hop_hhead)(struct cfs_hash *hs, struct cfs_hash_bd *bd); /** return hash-head size */ @@ -294,7 +294,7 @@ typedef struct cfs_hash_hlist_ops { /** remove @hnode from hash-head of @bd */ int (*hop_hnode_del)(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode); -} cfs_hash_hlist_ops_t; +}; typedef struct cfs_hash_ops { /** return hashed value from @key */ diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index b78feb0..63c4434 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -426,28 +426,28 @@ cfs_hash_dd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, return --dh->dd_depth; } -static cfs_hash_hlist_ops_t cfs_hash_hh_hops = { +static struct cfs_hash_hlist_ops cfs_hash_hh_hops = { .hop_hhead = cfs_hash_hh_hhead, .hop_hhead_size = cfs_hash_hh_hhead_size, .hop_hnode_add = cfs_hash_hh_hnode_add, .hop_hnode_del = cfs_hash_hh_hnode_del, }; -static cfs_hash_hlist_ops_t cfs_hash_hd_hops = { +static struct cfs_hash_hlist_ops cfs_hash_hd_hops = { .hop_hhead = cfs_hash_hd_hhead, .hop_hhead_size = cfs_hash_hd_hhead_size, .hop_hnode_add = cfs_hash_hd_hnode_add, .hop_hnode_del = cfs_hash_hd_hnode_del, }; -static cfs_hash_hlist_ops_t cfs_hash_dh_hops = { +static struct cfs_hash_hlist_ops cfs_hash_dh_hops = { .hop_hhead = cfs_hash_dh_hhead, .hop_hhead_size = cfs_hash_dh_hhead_size, .hop_hnode_add = cfs_hash_dh_hnode_add, .hop_hnode_del = cfs_hash_dh_hnode_del, }; -static cfs_hash_hlist_ops_t cfs_hash_dd_hops = { +static struct cfs_hash_hlist_ops cfs_hash_dd_hops = { .hop_hhead = cfs_hash_dd_hhead, .hop_hhead_size = cfs_hash_dd_hhead_size, .hop_hnode_add = cfs_hash_dd_hnode_add, -- 1.7.1 From simmonsja at ornl.gov Wed Oct 28 19:00:29 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 28 Oct 2015 19:00:29 +0000 Subject: [lustre-devel] [PATCH 5/5] staging:lustre: Update license and copyright for kernel comm In-Reply-To: <562E051D.6030807@gmail.com> References: <562E051D.6030807@gmail.com> Message-ID: >> >> - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf >> - * >> - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, >> - * CA 95054 USA or visit www.sun.com if you need additional information or >> - * have any questions. > >That text is in every files. You should kill all references. That would be a mighty big patch. A patch already exist in our development branch to update the copyright so that will be eventually backported to the staging tree. I can look into updating the rest after the copyright patch lands. Then I will port to the staging tree. From andreas.dilger at intel.com Wed Oct 28 22:34:21 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 28 Oct 2015 22:34:21 +0000 Subject: [lustre-devel] [PATCH 08/10] staging: lustre: remove white space in libcfs_hash.h In-Reply-To: <1446051271-25189-9-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> <1446051271-25189-9-git-send-email-jsimmons@infradead.org> Message-ID: On 2015/10/28, 10:54, "lustre-devel on behalf of James Simmons" wrote: >From: James Simmons > >Cleanup all the unneeded white space in libcfs_hash.h. > >Signed-off-by: James Simmons Minor note - it would be better to keep these two email addresses consistent. >struct cfs_hash_bd { >- struct cfs_hash_bucket *bd_bucket; /**< address of bucket */ >- unsigned int bd_offset; /**< offset in bucket */ >+ /**< address of bucket */ >+ struct cfs_hash_bucket *bd_bucket; >+ /**< offset in bucket */ >+ unsigned int bd_offset; > }; The "/**< ... */" marker means "the field to the left", but if you are moving these to the line before the field you should just use "/* ... */". Cheers, Andreas > >-#define CFS_HASH_NAME_LEN 16 /**< default name length */ >-#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ >+#define CFS_HASH_NAME_LEN 16 /**< default name length */ >+#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ > >-#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ >-#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ >-#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS >+#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ >+#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ >+#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS > > /** > * common hash attributes. >@@ -133,41 +129,41 @@ enum cfs_hash_tag { > */ > CFS_HASH_NO_LOCK = 1 << 0, > /** no bucket lock, use one spinlock to protect the whole hash */ >- CFS_HASH_NO_BKTLOCK = 1 << 1, >+ CFS_HASH_NO_BKTLOCK = 1 << 1, > /** rwlock to protect bucket */ >- CFS_HASH_RW_BKTLOCK = 1 << 2, >+ CFS_HASH_RW_BKTLOCK = 1 << 2, > /** spinlock to protect bucket */ >- CFS_HASH_SPIN_BKTLOCK = 1 << 3, >+ CFS_HASH_SPIN_BKTLOCK = 1 << 3, > /** always add new item to tail */ >- CFS_HASH_ADD_TAIL = 1 << 4, >+ CFS_HASH_ADD_TAIL = 1 << 4, > /** hash-table doesn't have refcount on item */ >- CFS_HASH_NO_ITEMREF = 1 << 5, >+ CFS_HASH_NO_ITEMREF = 1 << 5, > /** big name for param-tree */ > CFS_HASH_BIGNAME = 1 << 6, > /** track global count */ > CFS_HASH_COUNTER = 1 << 7, > /** rehash item by new key */ >- CFS_HASH_REHASH_KEY = 1 << 8, >+ CFS_HASH_REHASH_KEY = 1 << 8, > /** Enable dynamic hash resizing */ >- CFS_HASH_REHASH = 1 << 9, >+ CFS_HASH_REHASH = 1 << 9, > /** can shrink hash-size */ >- CFS_HASH_SHRINK = 1 << 10, >+ CFS_HASH_SHRINK = 1 << 10, > /** assert hash is empty on exit */ >- CFS_HASH_ASSERT_EMPTY = 1 << 11, >+ CFS_HASH_ASSERT_EMPTY = 1 << 11, > /** record hlist depth */ >- CFS_HASH_DEPTH = 1 << 12, >+ CFS_HASH_DEPTH = 1 << 12, > /** > * rehash is always scheduled in a different thread, so current > * change on hash table is non-blocking > */ >- CFS_HASH_NBLK_CHANGE = 1 << 13, >+ CFS_HASH_NBLK_CHANGE = 1 << 13, > /** NB, we typed hs_flags as __u16, please change it > * if you need to extend >=16 flags */ > }; > > /** most used attributes */ >-#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ >- CFS_HASH_COUNTER | CFS_HASH_REHASH) >+#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ >+ CFS_HASH_COUNTER | CFS_HASH_REHASH) > > /** > * cfs_hash is a hash-table implementation for general purpose, it can >support: >@@ -211,7 +207,7 @@ enum cfs_hash_tag { > struct cfs_hash { > /** serialize with rehash, or serialize all operations if > * the hash-table has CFS_HASH_NO_BKTLOCK */ >- union cfs_hash_lock hs_lock; >+ union cfs_hash_lock hs_lock; > /** hash operations */ > struct cfs_hash_ops *hs_ops; > /** hash lock operations */ >@@ -219,57 +215,57 @@ struct cfs_hash { > /** hash list operations */ > struct cfs_hash_hlist_ops *hs_hops; > /** hash buckets-table */ >- struct cfs_hash_bucket **hs_buckets; >+ struct cfs_hash_bucket **hs_buckets; > /** total number of items on this hash-table */ >- atomic_t hs_count; >+ atomic_t hs_count; > /** hash flags, see cfs_hash_tag for detail */ >- __u16 hs_flags; >+ __u16 hs_flags; > /** # of extra-bytes for bucket, for user saving extended attributes */ >- __u16 hs_extra_bytes; >+ __u16 hs_extra_bytes; > /** wants to iterate */ >- __u8 hs_iterating; >+ __u8 hs_iterating; > /** hash-table is dying */ >- __u8 hs_exiting; >+ __u8 hs_exiting; > /** current hash bits */ >- __u8 hs_cur_bits; >+ __u8 hs_cur_bits; > /** min hash bits */ >- __u8 hs_min_bits; >+ __u8 hs_min_bits; > /** max hash bits */ >- __u8 hs_max_bits; >+ __u8 hs_max_bits; > /** bits for rehash */ >- __u8 hs_rehash_bits; >+ __u8 hs_rehash_bits; > /** bits for each bucket */ >- __u8 hs_bkt_bits; >+ __u8 hs_bkt_bits; > /** resize min threshold */ >- __u16 hs_min_theta; >+ __u16 hs_min_theta; > /** resize max threshold */ >- __u16 hs_max_theta; >+ __u16 hs_max_theta; > /** resize count */ >- __u32 hs_rehash_count; >+ __u32 hs_rehash_count; > /** # of iterators (caller of cfs_hash_for_each_*) */ >- __u32 hs_iterators; >+ __u32 hs_iterators; > /** rehash workitem */ >- cfs_workitem_t hs_rehash_wi; >+ cfs_workitem_t hs_rehash_wi; > /** refcount on this hash table */ >- atomic_t hs_refcount; >+ atomic_t hs_refcount; > /** rehash buckets-table */ >- struct cfs_hash_bucket **hs_rehash_buckets; >+ struct cfs_hash_bucket **hs_rehash_buckets; > #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 > /** serialize debug members */ > spinlock_t hs_dep_lock; > /** max depth */ >- unsigned int hs_dep_max; >+ unsigned int hs_dep_max; > /** id of the deepest bucket */ >- unsigned int hs_dep_bkt; >+ unsigned int hs_dep_bkt; > /** offset in the deepest bucket */ >- unsigned int hs_dep_off; >+ unsigned int hs_dep_off; > /** bits when we found the max depth */ >- unsigned int hs_dep_bits; >+ unsigned int hs_dep_bits; > /** workitem to output max depth */ >- cfs_workitem_t hs_dep_wi; >+ cfs_workitem_t hs_dep_wi; > #endif > /** name of htable */ >- char hs_name[0]; >+ char hs_name[0]; > }; > > struct cfs_hash_lock_ops { >@@ -324,11 +320,11 @@ struct cfs_hash_ops { > }; > > /** total number of buckets in @hs */ >-#define CFS_HASH_NBKT(hs) \ >+#define CFS_HASH_NBKT(hs) \ > (1U << ((hs)->hs_cur_bits - (hs)->hs_bkt_bits)) > > /** total number of buckets in @hs while rehashing */ >-#define CFS_HASH_RH_NBKT(hs) \ >+#define CFS_HASH_RH_NBKT(hs) \ > (1U << ((hs)->hs_rehash_bits - (hs)->hs_bkt_bits)) > > /** number of hlist for in bucket */ >@@ -433,19 +429,22 @@ cfs_hash_with_nblk_change(struct cfs_hash *hs) > > static inline int > cfs_hash_is_exiting(struct cfs_hash *hs) >-{ /* cfs_hash_destroy is called */ >+{ >+ /* cfs_hash_destroy is called */ > return hs->hs_exiting; > } > > static inline int > cfs_hash_is_rehashing(struct cfs_hash *hs) >-{ /* rehash is launched */ >+{ >+ /* rehash is launched */ > return hs->hs_rehash_bits != 0; > } > > static inline int > cfs_hash_is_iterating(struct cfs_hash *hs) >-{ /* someone is calling cfs_hash_for_each_* */ >+{ >+ /* someone is calling cfs_hash_for_each_* */ > return hs->hs_iterating || hs->hs_iterators != 0; > } > >@@ -758,7 +757,7 @@ static inline void > cfs_hash_bucket_validate(struct cfs_hash *hs, struct cfs_hash_bd *bd, > struct hlist_node *hnode) > { >- struct cfs_hash_bd bds[2]; >+ struct cfs_hash_bd bds[2]; > > cfs_hash_dual_bd_get(hs, cfs_hash_key(hs, hnode), bds); > LASSERT(bds[0].bd_bucket == bd->bd_bucket || >@@ -777,9 +776,9 @@ cfs_hash_bucket_validate(struct cfs_hash *hs, struct >cfs_hash_bd *bd, > > #endif /* CFS_HASH_DEBUG_LEVEL */ > >-#define CFS_HASH_THETA_BITS 10 >-#define CFS_HASH_MIN_THETA (1U << (CFS_HASH_THETA_BITS - 1)) >-#define CFS_HASH_MAX_THETA (1U << (CFS_HASH_THETA_BITS + 1)) >+#define CFS_HASH_THETA_BITS 10 >+#define CFS_HASH_MIN_THETA (1U << (CFS_HASH_THETA_BITS - 1)) >+#define CFS_HASH_MAX_THETA (1U << (CFS_HASH_THETA_BITS + 1)) > > /* Return integer component of theta */ > static inline int __cfs_hash_theta_int(int theta) >@@ -848,20 +847,20 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask) > } > > /** iterate over all buckets in @bds (array of struct cfs_hash_bd) */ >-#define cfs_hash_for_each_bd(bds, n, i) \ >+#define cfs_hash_for_each_bd(bds, n, i) \ > for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++) > > /** iterate over all buckets of @hs */ >-#define cfs_hash_for_each_bucket(hs, bd, pos) \ >- for (pos = 0; \ >- pos < CFS_HASH_NBKT(hs) && \ >+#define cfs_hash_for_each_bucket(hs, bd, pos) \ >+ for (pos = 0; \ >+ pos < CFS_HASH_NBKT(hs) && \ > ((bd)->bd_bucket = (hs)->hs_buckets[pos]) != NULL; pos++) > > /** iterate over all hlist of bucket @bd */ >-#define cfs_hash_bd_for_each_hlist(hs, bd, hlist) \ >- for ((bd)->bd_offset = 0; \ >- (bd)->bd_offset < CFS_HASH_BKT_NHLIST(hs) && \ >- (hlist = cfs_hash_bd_hhead(hs, bd)) != NULL; \ >+#define cfs_hash_bd_for_each_hlist(hs, bd, hlist) \ >+ for ((bd)->bd_offset = 0; \ >+ (bd)->bd_offset < CFS_HASH_BKT_NHLIST(hs) && \ >+ (hlist = cfs_hash_bd_hhead(hs, bd)) != NULL; \ > (bd)->bd_offset++) > > /* !__LIBCFS__HASH_H__ */ >-- >1.7.1 > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From andreas.dilger at intel.com Wed Oct 28 22:36:07 2015 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 28 Oct 2015 22:36:07 +0000 Subject: [lustre-devel] [PATCH 09/10] staging: lustre: fix remaining checkpatch issues for libcfs_hash.h In-Reply-To: <1446051271-25189-10-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> <1446051271-25189-10-git-send-email-jsimmons@infradead.org> Message-ID: On 2015/10/28, 10:54, "lustre-devel on behalf of James Simmons" wrote: >From: James Simmons > >Final cleanup to make libcfs_hash.h completely kernel standard >compliant. > >Signed-off-by: James Simmons >--- > .../lustre/include/linux/libcfs/libcfs_hash.h | 16 >++++++++++------ > 1 files changed, 10 insertions(+), 6 deletions(-) > >diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >index 5df8ba2..563b2b4 100644 >--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >@@ -62,7 +62,8 @@ > /** disable debug */ > #define CFS_HASH_DEBUG_NONE 0 > /** record hash depth and output to console when it's too deep, >- * computing overhead is low but consume more memory */ >+ * computing overhead is low but consume more memory >+ */ Typically, multi-line comments have the leading /* on a separate line from the first line of text. If you are changing all these comments you may as well make it consistent with the kernel style. Cheers, Andreas > #define CFS_HASH_DEBUG_1 1 > /** expensive, check key validation */ > #define CFS_HASH_DEBUG_2 2 >@@ -158,7 +159,8 @@ enum cfs_hash_tag { > */ > CFS_HASH_NBLK_CHANGE = 1 << 13, > /** NB, we typed hs_flags as __u16, please change it >- * if you need to extend >=16 flags */ >+ * if you need to extend >=16 flags >+ */ > }; > > /** most used attributes */ >@@ -206,7 +208,8 @@ enum cfs_hash_tag { > > struct cfs_hash { > /** serialize with rehash, or serialize all operations if >- * the hash-table has CFS_HASH_NO_BKTLOCK */ >+ * the hash-table has CFS_HASH_NO_BKTLOCK >+ */ > union cfs_hash_lock hs_lock; > /** hash operations */ > struct cfs_hash_ops *hs_ops; >@@ -375,7 +378,8 @@ cfs_hash_with_no_itemref(struct cfs_hash *hs) > { > /* hash-table doesn't keep refcount on item, > * item can't be removed from hash unless it's >- * ZERO refcount */ >+ * ZERO refcount. >+ */ > return (hs->hs_flags & CFS_HASH_NO_ITEMREF) != 0; > } > >@@ -820,7 +824,7 @@ cfs_hash_djb2_hash(const void *key, size_t size, >unsigned mask) > { > unsigned i, hash = 5381; > >- LASSERT(key != NULL); >+ LASSERT(key); > > for (i = 0; i < size; i++) > hash = hash * 33 + ((char *)key)[i]; >@@ -848,7 +852,7 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask) > > /** iterate over all buckets in @bds (array of struct cfs_hash_bd) */ > #define cfs_hash_for_each_bd(bds, n, i) \ >- for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++) >+ for (i = 0; i < n && (bds)[i].bd_bucket; i++) > > /** iterate over all buckets of @hs */ > #define cfs_hash_for_each_bucket(hs, bd, pos) \ >-- >1.7.1 > >_______________________________________________ >lustre-devel mailing list >lustre-devel at lists.lustre.org >http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > Cheers, Andreas -- Andreas Dilger Lustre Software Architect Intel High Performance Data Division From greg at kroah.com Wed Oct 28 22:45:13 2015 From: greg at kroah.com (Greg KH) Date: Thu, 29 Oct 2015 07:45:13 +0900 Subject: [lustre-devel] [PATCH 5/5] staging:lustre: Update license and copyright for kernel comm In-Reply-To: References: <562E051D.6030807@gmail.com> Message-ID: <20151028224513.GA31326@kroah.com> On Wed, Oct 28, 2015 at 07:00:29PM +0000, Simmons, James A. wrote: > >> > >> - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf > >> - * > >> - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, > >> - * CA 95054 USA or visit www.sun.com if you need additional information or > >> - * have any questions. > > > >That text is in every files. You should kill all references. > > That would be a mighty big patch. I can take "mighty big patches" like this quite easily, please send it to me, don't mess with this "development branch of an external tree" nonsense, which I'm _REALLY_ getting tired of. Please drop that tree and only use the in-kernel version. If that doesn't work for you, then we need to drop the in-kernel version as it's pretty obvious no one is actually using this in-kernel code. thanks, greg k-h From gregkh at linuxfoundation.org Wed Oct 28 23:01:54 2015 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Thu, 29 Oct 2015 08:01:54 +0900 Subject: [lustre-devel] [PATCH 08/10] staging: lustre: remove white space in libcfs_hash.h In-Reply-To: <1446051271-25189-9-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> <1446051271-25189-9-git-send-email-jsimmons@infradead.org> Message-ID: <20151028230154.GA10118@kroah.com> On Wed, Oct 28, 2015 at 12:54:29PM -0400, James Simmons wrote: > From: James Simmons > > Cleanup all the unneeded white space in libcfs_hash.h. > > Signed-off-by: James Simmons > --- > .../lustre/include/linux/libcfs/libcfs_hash.h | 147 ++++++++++---------- > 1 files changed, 73 insertions(+), 74 deletions(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h > index 70b8b29..5df8ba2 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h > @@ -41,6 +41,9 @@ > > #ifndef __LIBCFS_HASH_H__ > #define __LIBCFS_HASH_H__ > + > +#include > + > /* > * Knuth recommends primes in approximately golden ratio to the maximum > * integer representable by a machine word for multiplicative hashing. > @@ -56,22 +59,13 @@ > /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ > #define CFS_GOLDEN_RATIO_PRIME_64 0x9e37fffffffc0001ULL > > -/* > - * Ideally we would use HAVE_HASH_LONG for this, but on linux we configure > - * the linux kernel and user space at the same time, so we need to differentiate > - * between them explicitly. If this is not needed on other architectures, then > - * we'll need to move the functions to architecture specific headers. > - */ > - > -#include > - That's not "cleaning up whitespace", that's "deleting unused/unneeded stuff. Please be more careful and only do one thing per patch, you know better than to try to sneak other changes in. I'll stop here in applying this series, please fix up and resend. greg k-h From gregkh at linuxfoundation.org Wed Oct 28 23:02:15 2015 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Thu, 29 Oct 2015 08:02:15 +0900 Subject: [lustre-devel] [PATCH 10/10] staging: lustre: remove white space in hash.c In-Reply-To: <1446051271-25189-11-git-send-email-jsimmons@infradead.org> References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> <1446051271-25189-11-git-send-email-jsimmons@infradead.org> Message-ID: <20151028230215.GB10118@kroah.com> On Wed, Oct 28, 2015 at 12:54:31PM -0400, James Simmons wrote: > From: James Simmons > > Cleanup all the unneeded white space in hash.c. > > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/libcfs/hash.c | 336 ++++++++++++++------------- > 1 files changed, 174 insertions(+), 162 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c > index 0308744..c5921f7 100644 > --- a/drivers/staging/lustre/lustre/libcfs/hash.c > +++ b/drivers/staging/lustre/lustre/libcfs/hash.c > @@ -106,9 +106,9 @@ > * Now we support both locked iteration & lockless iteration of hash > * table. Also, user can break the iteration by return 1 in callback. > */ > +#include > > #include "../../include/linux/libcfs/libcfs.h" > -#include Again, not a "whitespace fix". From mahfouz.saif.elyazal at gmail.com Thu Oct 29 00:26:56 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Thu, 29 Oct 2015 02:26:56 +0200 Subject: [lustre-devel] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 In-Reply-To: <20151028064159.GB3649@sudip-pc> References: <36db1862a6b63ac07f3b1ed3a1f7f39a772399c6.1445967419.git.mahfouz.saif.elyazal@gmail.com> <20151028064159.GB3649@sudip-pc> Message-ID: <20151029002656.GA12848@waves> On Wed, Oct 28, 2015 at 12:11:59PM +0530, Sudip Mukherjee wrote: > On Tue, Oct 27, 2015 at 07:43:34PM +0200, Aya Mahfouz wrote: > > Replaces IS_PO2 by is_power_of_2. It is more accurate to use > > is_power_of_2 since it returns 1 for numbers that are powers > > of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are > > powers of 2. > > > > Reviewed-by: Andreas Dilger > > Signed-off-by: Aya Mahfouz > > --- > > v2: > > -changed commit message > > -added Andreas Reviewed by tag > > > > drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c > > index 6f4c7d4..4b5e79a 100644 > > --- a/drivers/staging/lustre/lustre/libcfs/hash.c > > +++ b/drivers/staging/lustre/lustre/libcfs/hash.c > > @@ -109,6 +109,8 @@ > > > > #include "../../include/linux/libcfs/libcfs.h" > > #include > > +#include > > + > > This extra blank line will introduce new checkpatch error of "multiple > blank lines" > > regards > sudip Thanks Sudip! I will handle your comments on the patchset and resend it. -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Thu Oct 29 00:52:50 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Thu, 29 Oct 2015 02:52:50 +0200 Subject: [lustre-devel] [PATCH v3 0/5] Remove uses and definition of IS_PO2 Message-ID: Concerned with the removal of IS_PO2 by replacing its uses with is_power_of_2 and then removing the definition. The second version handled warnings indicated by kbuild test robot. The third version handled checkpatch.pl warnings indicated by Sudip Mukherjee. Aya Mahfouz (5): staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2 staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2 staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- drivers/staging/lustre/lnet/selftest/selftest.h | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- drivers/staging/lustre/lustre/libcfs/hash.c | 3 ++- drivers/staging/lustre/lustre/libcfs/workitem.c | 2 +- 5 files changed, 5 insertions(+), 11 deletions(-) -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Thu Oct 29 00:54:09 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Thu, 29 Oct 2015 02:54:09 +0200 Subject: [lustre-devel] [PATCH v3 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Signed-off-by: Aya Mahfouz --- v2: -changed commit message v3: -no change drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index c787888..9c70f31 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -149,7 +149,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode) int index; LASSERT(mode != 0); - LASSERT(IS_PO2(mode)); + LASSERT(is_power_of_2(mode)); for (index = -1; mode; index++) mode >>= 1; LASSERT(index < LCK_MODE_NUM); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Thu Oct 29 00:55:50 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Thu, 29 Oct 2015 02:55:50 +0200 Subject: [lustre-devel] [PATCH v3 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Reviewed-by: Andreas Dilger Signed-off-by: Aya Mahfouz --- v2: -changed commit message -added Andreas Reviewed by tag v3: -fixed checkpatch.pl warning drivers/staging/lustre/lustre/libcfs/hash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 0308744..ec26916 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -109,6 +109,7 @@ #include "../../include/linux/libcfs/libcfs.h" #include +#include #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 static unsigned int warn_on_depth = 8; @@ -1794,7 +1795,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) for (i = 2; cfs_hash_is_rehashing(hs); i++) { cfs_hash_unlock(hs, 1); /* raise console warning while waiting too long */ - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, "hash %s is still rehashing, rescheded %d\n", hs->hs_name, i - 1); cond_resched(); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Thu Oct 29 00:57:33 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Thu, 29 Oct 2015 02:57:33 +0200 Subject: [lustre-devel] [PATCH v3 3/5] staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: <5f3bb74fa1c407ecc97e27d2adde7cec8a3d8afa.1446079745.git.mahfouz.saif.elyazal@gmail.com> Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Reviewed-by: Andreas Dilger Signed-off-by: Aya Mahfouz --- v2: -changed commit message -added Andreas Reviewed by tag v3: -no change drivers/staging/lustre/lustre/libcfs/workitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index e1143a5..268dd68 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -325,7 +325,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) spin_lock(&cfs_wi_data.wi_glock); while (sched->ws_nthreads > 0) { - CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, + CDEBUG(is_power_of_2(++i) ? D_WARNING : D_NET, "waiting for %d threads of WI sched[%s] to terminate\n", sched->ws_nthreads, sched->ws_name); -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Thu Oct 29 00:59:27 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Thu, 29 Oct 2015 02:59:27 +0200 Subject: [lustre-devel] [PATCH v3 4/5] staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2 In-Reply-To: References: Message-ID: Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Signed-off-by: Aya Mahfouz --- v2: -added new patch in patch set for selftest.h v3: -fixed checkpatch.pl warning drivers/staging/lustre/lnet/selftest/selftest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 8a77d3f..15b3b34 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -585,7 +585,7 @@ swi_state2str (int state) do { \ int __I = 2; \ while (!(cond)) { \ - CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ + CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET, \ fmt, ## __VA_ARGS__); \ spin_unlock(&(lock)); \ \ -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From mahfouz.saif.elyazal at gmail.com Thu Oct 29 01:00:24 2015 From: mahfouz.saif.elyazal at gmail.com (Aya Mahfouz) Date: Thu, 29 Oct 2015 03:00:24 +0200 Subject: [lustre-devel] [PATCH v3 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 In-Reply-To: References: Message-ID: <6257d068b94ff8b07a6c756df16325fea0e7536f.1446079745.git.mahfouz.saif.elyazal@gmail.com> Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have been replaced by is_power_of_2 Signed-off-by: Aya Mahfouz --- v2: -became patch number 5 in the series v3: -no change drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 4d74e8a..7f76b20 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -42,13 +42,6 @@ #include "curproc.h" -static inline int __is_po2(unsigned long long val) -{ - return !(val & (val - 1)); -} - -#define IS_PO2(val) __is_po2((unsigned long long)(val)) - #define LOWEST_BIT_SET(x) ((x) & ~((x) - 1)) /* -- 2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz From dan.carpenter at oracle.com Thu Oct 29 09:24:40 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 29 Oct 2015 12:24:40 +0300 Subject: [lustre-devel] [patch 1/2] staging: lustre: remove o_ prefix from function pointers Message-ID: <20151029092440.GA8629@mwanda> We mostly refer to these function pointers using macros that use macro magic to add the "o_" prefix to the front. It means that you can't use cscope to find the caller. Heck, you can't even grep for it. I looked at preserving the "o_" prefix by removing the macro magic and adding "o_" to all the call sites but then I realized that, really, the prefix doesn't add any value. Let's just remove it. Signed-off-by: Dan Carpenter diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 5e93afc..5aca9bb 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -963,123 +963,123 @@ struct md_enqueue_info { }; struct obd_ops { - struct module *o_owner; - int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len, - void *karg, void *uarg); - int (*o_get_info)(const struct lu_env *env, struct obd_export *, - __u32 keylen, void *key, __u32 *vallen, void *val, - struct lov_stripe_md *lsm); - int (*o_set_info_async)(const struct lu_env *, struct obd_export *, - __u32 keylen, void *key, - __u32 vallen, void *val, - struct ptlrpc_request_set *set); - int (*o_attach)(struct obd_device *dev, u32 len, void *data); - int (*o_detach)(struct obd_device *dev); - int (*o_setup)(struct obd_device *dev, struct lustre_cfg *cfg); - int (*o_precleanup)(struct obd_device *dev, - enum obd_cleanup_stage cleanup_stage); - int (*o_cleanup)(struct obd_device *dev); - int (*o_process_config)(struct obd_device *dev, u32 len, void *data); - int (*o_postrecov)(struct obd_device *dev); - int (*o_add_conn)(struct obd_import *imp, struct obd_uuid *uuid, - int priority); - int (*o_del_conn)(struct obd_import *imp, struct obd_uuid *uuid); + struct module *owner; + int (*iocontrol)(unsigned int cmd, struct obd_export *exp, int len, + void *karg, void *uarg); + int (*get_info)(const struct lu_env *env, struct obd_export *, + __u32 keylen, void *key, __u32 *vallen, void *val, + struct lov_stripe_md *lsm); + int (*set_info_async)(const struct lu_env *, struct obd_export *, + __u32 keylen, void *key, + __u32 vallen, void *val, + struct ptlrpc_request_set *set); + int (*attach)(struct obd_device *dev, u32 len, void *data); + int (*detach)(struct obd_device *dev); + int (*setup)(struct obd_device *dev, struct lustre_cfg *cfg); + int (*precleanup)(struct obd_device *dev, + enum obd_cleanup_stage cleanup_stage); + int (*cleanup)(struct obd_device *dev); + int (*process_config)(struct obd_device *dev, u32 len, void *data); + int (*postrecov)(struct obd_device *dev); + int (*add_conn)(struct obd_import *imp, struct obd_uuid *uuid, + int priority); + int (*del_conn)(struct obd_import *imp, struct obd_uuid *uuid); /* connect to the target device with given connection * data. @ocd->ocd_connect_flags is modified to reflect flags actually * granted by the target, which are guaranteed to be a subset of flags * asked for. If @ocd == NULL, use default parameters. */ - int (*o_connect)(const struct lu_env *env, - struct obd_export **exp, struct obd_device *src, - struct obd_uuid *cluuid, struct obd_connect_data *ocd, + int (*connect)(const struct lu_env *env, + struct obd_export **exp, struct obd_device *src, + struct obd_uuid *cluuid, struct obd_connect_data *ocd, + void *localdata); + int (*reconnect)(const struct lu_env *env, + struct obd_export *exp, struct obd_device *src, + struct obd_uuid *cluuid, + struct obd_connect_data *ocd, void *localdata); - int (*o_reconnect)(const struct lu_env *env, - struct obd_export *exp, struct obd_device *src, - struct obd_uuid *cluuid, - struct obd_connect_data *ocd, - void *localdata); - int (*o_disconnect)(struct obd_export *exp); + int (*disconnect)(struct obd_export *exp); /* Initialize/finalize fids infrastructure. */ - int (*o_fid_init)(struct obd_device *obd, - struct obd_export *exp, enum lu_cli_type type); - int (*o_fid_fini)(struct obd_device *obd); + int (*fid_init)(struct obd_device *obd, + struct obd_export *exp, enum lu_cli_type type); + int (*fid_fini)(struct obd_device *obd); /* Allocate new fid according to passed @hint. */ - int (*o_fid_alloc)(struct obd_export *exp, struct lu_fid *fid, - struct md_op_data *op_data); + int (*fid_alloc)(struct obd_export *exp, struct lu_fid *fid, + struct md_op_data *op_data); /* * Object with @fid is getting deleted, we may want to do something * about this. */ - int (*o_statfs)(const struct lu_env *, struct obd_export *exp, - struct obd_statfs *osfs, __u64 max_age, __u32 flags); - int (*o_statfs_async)(struct obd_export *exp, struct obd_info *oinfo, - __u64 max_age, struct ptlrpc_request_set *set); - int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt, - struct lov_stripe_md *mem_src); - int (*o_unpackmd)(struct obd_export *exp, - struct lov_stripe_md **mem_tgt, - struct lov_mds_md *disk_src, int disk_len); - int (*o_preallocate)(struct lustre_handle *, u32 *req, u64 *ids); - int (*o_create)(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md **ea, - struct obd_trans_info *oti); - int (*o_destroy)(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md *ea, - struct obd_trans_info *oti, struct obd_export *md_exp); - int (*o_setattr)(const struct lu_env *, struct obd_export *exp, - struct obd_info *oinfo, struct obd_trans_info *oti); - int (*o_setattr_async)(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti, - struct ptlrpc_request_set *rqset); - int (*o_getattr)(const struct lu_env *env, struct obd_export *exp, - struct obd_info *oinfo); - int (*o_getattr_async)(struct obd_export *exp, struct obd_info *oinfo, - struct ptlrpc_request_set *set); - int (*o_adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm, - u64 size, int shrink); - int (*o_preprw)(const struct lu_env *env, int cmd, - struct obd_export *exp, struct obdo *oa, int objcount, - struct obd_ioobj *obj, struct niobuf_remote *remote, - int *nr_pages, struct niobuf_local *local, - struct obd_trans_info *oti); - int (*o_commitrw)(const struct lu_env *env, int cmd, - struct obd_export *exp, struct obdo *oa, - int objcount, struct obd_ioobj *obj, - struct niobuf_remote *remote, int pages, - struct niobuf_local *local, - struct obd_trans_info *oti, int rc); - int (*o_find_cbdata)(struct obd_export *, struct lov_stripe_md *, - ldlm_iterator_t it, void *data); - int (*o_init_export)(struct obd_export *exp); - int (*o_destroy_export)(struct obd_export *exp); + int (*statfs)(const struct lu_env *, struct obd_export *exp, + struct obd_statfs *osfs, __u64 max_age, __u32 flags); + int (*statfs_async)(struct obd_export *exp, struct obd_info *oinfo, + __u64 max_age, struct ptlrpc_request_set *set); + int (*packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt, + struct lov_stripe_md *mem_src); + int (*unpackmd)(struct obd_export *exp, + struct lov_stripe_md **mem_tgt, + struct lov_mds_md *disk_src, int disk_len); + int (*preallocate)(struct lustre_handle *, u32 *req, u64 *ids); + int (*create)(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti); + int (*destroy)(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *ea, + struct obd_trans_info *oti, struct obd_export *md_exp); + int (*setattr)(const struct lu_env *, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti); + int (*setattr_async)(struct obd_export *exp, struct obd_info *oinfo, + struct obd_trans_info *oti, + struct ptlrpc_request_set *rqset); + int (*getattr)(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo); + int (*getattr_async)(struct obd_export *exp, struct obd_info *oinfo, + struct ptlrpc_request_set *set); + int (*adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm, + u64 size, int shrink); + int (*preprw)(const struct lu_env *env, int cmd, + struct obd_export *exp, struct obdo *oa, int objcount, + struct obd_ioobj *obj, struct niobuf_remote *remote, + int *nr_pages, struct niobuf_local *local, + struct obd_trans_info *oti); + int (*commitrw)(const struct lu_env *env, int cmd, + struct obd_export *exp, struct obdo *oa, + int objcount, struct obd_ioobj *obj, + struct niobuf_remote *remote, int pages, + struct niobuf_local *local, + struct obd_trans_info *oti, int rc); + int (*find_cbdata)(struct obd_export *, struct lov_stripe_md *, + ldlm_iterator_t it, void *data); + int (*init_export)(struct obd_export *exp); + int (*destroy_export)(struct obd_export *exp); /* metadata-only methods */ - int (*o_import_event)(struct obd_device *, struct obd_import *, - enum obd_import_event); + int (*import_event)(struct obd_device *, struct obd_import *, + enum obd_import_event); - int (*o_notify)(struct obd_device *obd, struct obd_device *watched, - enum obd_notify_event ev, void *data); + int (*notify)(struct obd_device *obd, struct obd_device *watched, + enum obd_notify_event ev, void *data); - int (*o_health_check)(const struct lu_env *env, struct obd_device *); - struct obd_uuid *(*o_get_uuid)(struct obd_export *exp); + int (*health_check)(const struct lu_env *env, struct obd_device *); + struct obd_uuid *(*get_uuid)(struct obd_export *exp); /* quota methods */ - int (*o_quotacheck)(struct obd_device *, struct obd_export *, - struct obd_quotactl *); - int (*o_quotactl)(struct obd_device *, struct obd_export *, + int (*quotacheck)(struct obd_device *, struct obd_export *, struct obd_quotactl *); + int (*quotactl)(struct obd_device *, struct obd_export *, + struct obd_quotactl *); /* pools methods */ - int (*o_pool_new)(struct obd_device *obd, char *poolname); - int (*o_pool_del)(struct obd_device *obd, char *poolname); - int (*o_pool_add)(struct obd_device *obd, char *poolname, - char *ostname); - int (*o_pool_rem)(struct obd_device *obd, char *poolname, - char *ostname); - void (*o_getref)(struct obd_device *obd); - void (*o_putref)(struct obd_device *obd); + int (*pool_new)(struct obd_device *obd, char *poolname); + int (*pool_del)(struct obd_device *obd, char *poolname); + int (*pool_add)(struct obd_device *obd, char *poolname, + char *ostname); + int (*pool_rem)(struct obd_device *obd, char *poolname, + char *ostname); + void (*getref)(struct obd_device *obd); + void (*putref)(struct obd_device *obd); /* * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c. diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index bf2bde5..674be77 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -260,7 +260,7 @@ void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj); void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid); #define OBT(dev) (dev)->obd_type -#define OBP(dev, op) (dev)->obd_type->typ_dt_ops->o_ ## op +#define OBP(dev, op) (dev)->obd_type->typ_dt_ops->op #define MDP(dev, op) (dev)->obd_type->typ_md_ops->m_ ## op #define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op @@ -291,9 +291,9 @@ static inline int obd_check_dev_active(struct obd_device *obd) } #define OBD_COUNTER_OFFSET(op) \ - ((offsetof(struct obd_ops, o_ ## op) - \ - offsetof(struct obd_ops, o_iocontrol)) \ - / sizeof(((struct obd_ops *)(0))->o_iocontrol)) + ((offsetof(struct obd_ops, op) - \ + offsetof(struct obd_ops, iocontrol)) \ + / sizeof(((struct obd_ops *)(0))->iocontrol)) #define OBD_COUNTER_INCREMENT(obdx, op) \ if ((obdx)->obd_stats != NULL) { \ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 635a93c..947a127 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2744,23 +2744,23 @@ static int lmv_quotacheck(struct obd_device *unused, struct obd_export *exp, } static struct obd_ops lmv_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = lmv_setup, - .o_cleanup = lmv_cleanup, - .o_precleanup = lmv_precleanup, - .o_process_config = lmv_process_config, - .o_connect = lmv_connect, - .o_disconnect = lmv_disconnect, - .o_statfs = lmv_statfs, - .o_get_info = lmv_get_info, - .o_set_info_async = lmv_set_info_async, - .o_packmd = lmv_packmd, - .o_unpackmd = lmv_unpackmd, - .o_notify = lmv_notify, - .o_get_uuid = lmv_get_uuid, - .o_iocontrol = lmv_iocontrol, - .o_quotacheck = lmv_quotacheck, - .o_quotactl = lmv_quotactl + .owner = THIS_MODULE, + .setup = lmv_setup, + .cleanup = lmv_cleanup, + .precleanup = lmv_precleanup, + .process_config = lmv_process_config, + .connect = lmv_connect, + .disconnect = lmv_disconnect, + .statfs = lmv_statfs, + .get_info = lmv_get_info, + .set_info_async = lmv_set_info_async, + .packmd = lmv_packmd, + .unpackmd = lmv_unpackmd, + .notify = lmv_notify, + .get_uuid = lmv_get_uuid, + .iocontrol = lmv_iocontrol, + .quotacheck = lmv_quotacheck, + .quotactl = lmv_quotactl }; static struct md_ops lmv_md_ops = { diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index c3be0b5..ad678d4 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -2280,35 +2280,35 @@ out: } static struct obd_ops lov_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = lov_setup, - .o_precleanup = lov_precleanup, - .o_cleanup = lov_cleanup, - /*.o_process_config = lov_process_config,*/ - .o_connect = lov_connect, - .o_disconnect = lov_disconnect, - .o_statfs = lov_statfs, - .o_statfs_async = lov_statfs_async, - .o_packmd = lov_packmd, - .o_unpackmd = lov_unpackmd, - .o_create = lov_create, - .o_destroy = lov_destroy, - .o_getattr_async = lov_getattr_async, - .o_setattr_async = lov_setattr_async, - .o_adjust_kms = lov_adjust_kms, - .o_find_cbdata = lov_find_cbdata, - .o_iocontrol = lov_iocontrol, - .o_get_info = lov_get_info, - .o_set_info_async = lov_set_info_async, - .o_notify = lov_notify, - .o_pool_new = lov_pool_new, - .o_pool_rem = lov_pool_remove, - .o_pool_add = lov_pool_add, - .o_pool_del = lov_pool_del, - .o_getref = lov_getref, - .o_putref = lov_putref, - .o_quotactl = lov_quotactl, - .o_quotacheck = lov_quotacheck, + .owner = THIS_MODULE, + .setup = lov_setup, + .precleanup = lov_precleanup, + .cleanup = lov_cleanup, + /*.process_config = lov_process_config,*/ + .connect = lov_connect, + .disconnect = lov_disconnect, + .statfs = lov_statfs, + .statfs_async = lov_statfs_async, + .packmd = lov_packmd, + .unpackmd = lov_unpackmd, + .create = lov_create, + .destroy = lov_destroy, + .getattr_async = lov_getattr_async, + .setattr_async = lov_setattr_async, + .adjust_kms = lov_adjust_kms, + .find_cbdata = lov_find_cbdata, + .iocontrol = lov_iocontrol, + .get_info = lov_get_info, + .set_info_async = lov_set_info_async, + .notify = lov_notify, + .pool_new = lov_pool_new, + .pool_rem = lov_pool_remove, + .pool_add = lov_pool_add, + .pool_del = lov_pool_del, + .getref = lov_getref, + .putref = lov_putref, + .quotactl = lov_quotactl, + .quotacheck = lov_quotacheck, }; struct kmem_cache *lov_oinfo_slab; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 16a5a10..34a8867 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2460,26 +2460,26 @@ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid, } static struct obd_ops mdc_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = mdc_setup, - .o_precleanup = mdc_precleanup, - .o_cleanup = mdc_cleanup, - .o_add_conn = client_import_add_conn, - .o_del_conn = client_import_del_conn, - .o_connect = client_connect_import, - .o_disconnect = client_disconnect_export, - .o_iocontrol = mdc_iocontrol, - .o_set_info_async = mdc_set_info_async, - .o_statfs = mdc_statfs, - .o_fid_init = client_fid_init, - .o_fid_fini = client_fid_fini, - .o_fid_alloc = mdc_fid_alloc, - .o_import_event = mdc_import_event, - .o_get_info = mdc_get_info, - .o_process_config = mdc_process_config, - .o_get_uuid = mdc_get_uuid, - .o_quotactl = mdc_quotactl, - .o_quotacheck = mdc_quotacheck + .owner = THIS_MODULE, + .setup = mdc_setup, + .precleanup = mdc_precleanup, + .cleanup = mdc_cleanup, + .add_conn = client_import_add_conn, + .del_conn = client_import_del_conn, + .connect = client_connect_import, + .disconnect = client_disconnect_export, + .iocontrol = mdc_iocontrol, + .set_info_async = mdc_set_info_async, + .statfs = mdc_statfs, + .fid_init = client_fid_init, + .fid_fini = client_fid_fini, + .fid_alloc = mdc_fid_alloc, + .import_event = mdc_import_event, + .get_info = mdc_get_info, + .process_config = mdc_process_config, + .get_uuid = mdc_get_uuid, + .quotactl = mdc_quotactl, + .quotacheck = mdc_quotacheck }; static struct md_ops mdc_md_ops = { diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 7315733..8c56cc3 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1694,20 +1694,20 @@ out: } static struct obd_ops mgc_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = mgc_setup, - .o_precleanup = mgc_precleanup, - .o_cleanup = mgc_cleanup, - .o_add_conn = client_import_add_conn, - .o_del_conn = client_import_del_conn, - .o_connect = client_connect_import, - .o_disconnect = client_disconnect_export, - /* .o_enqueue = mgc_enqueue, */ - /* .o_iocontrol = mgc_iocontrol, */ - .o_set_info_async = mgc_set_info_async, - .o_get_info = mgc_get_info, - .o_import_event = mgc_import_event, - .o_process_config = mgc_process_config, + .owner = THIS_MODULE, + .setup = mgc_setup, + .precleanup = mgc_precleanup, + .cleanup = mgc_cleanup, + .add_conn = client_import_add_conn, + .del_conn = client_import_del_conn, + .connect = client_connect_import, + .disconnect = client_disconnect_export, + /* .enqueue = mgc_enqueue, */ + /* .iocontrol = mgc_iocontrol, */ + .set_info_async = mgc_set_info_async, + .get_info = mgc_get_info, + .import_event = mgc_import_event, + .process_config = mgc_process_config, }; static int __init mgc_init(void) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index ab0748b..fbbd4b5 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -132,7 +132,7 @@ static struct obd_type *class_get_type(const char *name) if (type) { spin_lock(&type->obd_type_lock); type->typ_refcnt++; - try_module_get(type->typ_dt_ops->o_owner); + try_module_get(type->typ_dt_ops->owner); spin_unlock(&type->obd_type_lock); } return type; @@ -143,7 +143,7 @@ void class_put_type(struct obd_type *type) LASSERT(type); spin_lock(&type->obd_type_lock); type->typ_refcnt--; - module_put(type->typ_dt_ops->o_owner); + module_put(type->typ_dt_ops->owner); spin_unlock(&type->obd_type_lock); } EXPORT_SYMBOL(class_put_type); diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index ef9cb31..5b26265 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -2128,10 +2128,10 @@ static int echo_client_disconnect(struct obd_export *exp) } static struct obd_ops echo_client_obd_ops = { - .o_owner = THIS_MODULE, - .o_iocontrol = echo_client_iocontrol, - .o_connect = echo_client_connect, - .o_disconnect = echo_client_disconnect + .owner = THIS_MODULE, + .iocontrol = echo_client_iocontrol, + .connect = echo_client_connect, + .disconnect = echo_client_disconnect }; static int echo_client_init(void) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 32c9713..d2fc4fe 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -3257,33 +3257,33 @@ static int osc_process_config(struct obd_device *obd, u32 len, void *buf) } struct obd_ops osc_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = osc_setup, - .o_precleanup = osc_precleanup, - .o_cleanup = osc_cleanup, - .o_add_conn = client_import_add_conn, - .o_del_conn = client_import_del_conn, - .o_connect = client_connect_import, - .o_reconnect = osc_reconnect, - .o_disconnect = osc_disconnect, - .o_statfs = osc_statfs, - .o_statfs_async = osc_statfs_async, - .o_packmd = osc_packmd, - .o_unpackmd = osc_unpackmd, - .o_create = osc_create, - .o_destroy = osc_destroy, - .o_getattr = osc_getattr, - .o_getattr_async = osc_getattr_async, - .o_setattr = osc_setattr, - .o_setattr_async = osc_setattr_async, - .o_find_cbdata = osc_find_cbdata, - .o_iocontrol = osc_iocontrol, - .o_get_info = osc_get_info, - .o_set_info_async = osc_set_info_async, - .o_import_event = osc_import_event, - .o_process_config = osc_process_config, - .o_quotactl = osc_quotactl, - .o_quotacheck = osc_quotacheck, + .owner = THIS_MODULE, + .setup = osc_setup, + .precleanup = osc_precleanup, + .cleanup = osc_cleanup, + .add_conn = client_import_add_conn, + .del_conn = client_import_del_conn, + .connect = client_connect_import, + .reconnect = osc_reconnect, + .disconnect = osc_disconnect, + .statfs = osc_statfs, + .statfs_async = osc_statfs_async, + .packmd = osc_packmd, + .unpackmd = osc_unpackmd, + .create = osc_create, + .destroy = osc_destroy, + .getattr = osc_getattr, + .getattr_async = osc_getattr_async, + .setattr = osc_setattr, + .setattr_async = osc_setattr_async, + .find_cbdata = osc_find_cbdata, + .iocontrol = osc_iocontrol, + .get_info = osc_get_info, + .set_info_async = osc_set_info_async, + .import_event = osc_import_event, + .process_config = osc_process_config, + .quotactl = osc_quotactl, + .quotacheck = osc_quotacheck, }; extern struct lu_kmem_descr osc_caches[]; From dan.carpenter at oracle.com Thu Oct 29 09:26:36 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 29 Oct 2015 12:26:36 +0300 Subject: [lustre-devel] [patch 2/2] staging: lustre: remove m_ prefix from function pointers In-Reply-To: <20151029092440.GA8629@mwanda> Message-ID: <20151029092636.GB8629@mwanda> All the callers call these function pointers without the "m_" prefix and use macro magic to add it later behind the scenes. It means that you can't grep for the call sites. I considered modifying the call sites but in the end I decided that the "m_" prefix doesn't add anything so we can just get rid of it. Signed-off-by: Dan Carpenter diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 5aca9bb..5c90b59 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -1124,89 +1124,89 @@ struct md_open_data { struct lookup_intent; struct md_ops { - int (*m_getstatus)(struct obd_export *, struct lu_fid *); - int (*m_null_inode)(struct obd_export *, const struct lu_fid *); - int (*m_find_cbdata)(struct obd_export *, const struct lu_fid *, - ldlm_iterator_t, void *); - int (*m_close)(struct obd_export *, struct md_op_data *, - struct md_open_data *, struct ptlrpc_request **); - int (*m_create)(struct obd_export *, struct md_op_data *, - const void *, int, int, __u32, __u32, cfs_cap_t, - __u64, struct ptlrpc_request **); - int (*m_done_writing)(struct obd_export *, struct md_op_data *, - struct md_open_data *); - int (*m_enqueue)(struct obd_export *, struct ldlm_enqueue_info *, - struct lookup_intent *, struct md_op_data *, - struct lustre_handle *, void *, int, - struct ptlrpc_request **, __u64); - int (*m_getattr)(struct obd_export *, struct md_op_data *, - struct ptlrpc_request **); - int (*m_getattr_name)(struct obd_export *, struct md_op_data *, - struct ptlrpc_request **); - int (*m_intent_lock)(struct obd_export *, struct md_op_data *, - void *, int, struct lookup_intent *, int, - struct ptlrpc_request **, - ldlm_blocking_callback, __u64); - int (*m_link)(struct obd_export *, struct md_op_data *, + int (*getstatus)(struct obd_export *, struct lu_fid *); + int (*null_inode)(struct obd_export *, const struct lu_fid *); + int (*find_cbdata)(struct obd_export *, const struct lu_fid *, + ldlm_iterator_t, void *); + int (*close)(struct obd_export *, struct md_op_data *, + struct md_open_data *, struct ptlrpc_request **); + int (*create)(struct obd_export *, struct md_op_data *, + const void *, int, int, __u32, __u32, cfs_cap_t, + __u64, struct ptlrpc_request **); + int (*done_writing)(struct obd_export *, struct md_op_data *, + struct md_open_data *); + int (*enqueue)(struct obd_export *, struct ldlm_enqueue_info *, + struct lookup_intent *, struct md_op_data *, + struct lustre_handle *, void *, int, + struct ptlrpc_request **, __u64); + int (*getattr)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*getattr_name)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*intent_lock)(struct obd_export *, struct md_op_data *, + void *, int, struct lookup_intent *, int, + struct ptlrpc_request **, + ldlm_blocking_callback, __u64); + int (*link)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*rename)(struct obd_export *, struct md_op_data *, + const char *, int, const char *, int, struct ptlrpc_request **); - int (*m_rename)(struct obd_export *, struct md_op_data *, - const char *, int, const char *, int, - struct ptlrpc_request **); - int (*m_is_subdir)(struct obd_export *, const struct lu_fid *, - const struct lu_fid *, + int (*is_subdir)(struct obd_export *, const struct lu_fid *, + const struct lu_fid *, struct ptlrpc_request **); - int (*m_setattr)(struct obd_export *, struct md_op_data *, void *, - int, void *, int, struct ptlrpc_request **, + int (*setattr)(struct obd_export *, struct md_op_data *, void *, + int, void *, int, struct ptlrpc_request **, struct md_open_data **mod); - int (*m_sync)(struct obd_export *, const struct lu_fid *, + int (*sync)(struct obd_export *, const struct lu_fid *, + struct ptlrpc_request **); + int (*readpage)(struct obd_export *, struct md_op_data *, + struct page **, struct ptlrpc_request **); + + int (*unlink)(struct obd_export *, struct md_op_data *, struct ptlrpc_request **); - int (*m_readpage)(struct obd_export *, struct md_op_data *, - struct page **, struct ptlrpc_request **); - int (*m_unlink)(struct obd_export *, struct md_op_data *, + int (*setxattr)(struct obd_export *, const struct lu_fid *, + u64, const char *, const char *, int, int, int, __u32, struct ptlrpc_request **); - int (*m_setxattr)(struct obd_export *, const struct lu_fid *, - u64, const char *, const char *, int, int, int, __u32, - struct ptlrpc_request **); - - int (*m_getxattr)(struct obd_export *, const struct lu_fid *, - u64, const char *, const char *, int, int, int, - struct ptlrpc_request **); + int (*getxattr)(struct obd_export *, const struct lu_fid *, + u64, const char *, const char *, int, int, int, + struct ptlrpc_request **); - int (*m_init_ea_size)(struct obd_export *, int, int, int, int); + int (*init_ea_size)(struct obd_export *, int, int, int, int); - int (*m_get_lustre_md)(struct obd_export *, struct ptlrpc_request *, - struct obd_export *, struct obd_export *, - struct lustre_md *); + int (*get_lustre_md)(struct obd_export *, struct ptlrpc_request *, + struct obd_export *, struct obd_export *, + struct lustre_md *); - int (*m_free_lustre_md)(struct obd_export *, struct lustre_md *); + int (*free_lustre_md)(struct obd_export *, struct lustre_md *); - int (*m_set_open_replay_data)(struct obd_export *, - struct obd_client_handle *, - struct lookup_intent *); - int (*m_clear_open_replay_data)(struct obd_export *, - struct obd_client_handle *); - int (*m_set_lock_data)(struct obd_export *, __u64 *, void *, __u64 *); + int (*set_open_replay_data)(struct obd_export *, + struct obd_client_handle *, + struct lookup_intent *); + int (*clear_open_replay_data)(struct obd_export *, + struct obd_client_handle *); + int (*set_lock_data)(struct obd_export *, __u64 *, void *, __u64 *); - ldlm_mode_t (*m_lock_match)(struct obd_export *, __u64, - const struct lu_fid *, ldlm_type_t, - ldlm_policy_data_t *, ldlm_mode_t, - struct lustre_handle *); + ldlm_mode_t (*lock_match)(struct obd_export *, __u64, + const struct lu_fid *, ldlm_type_t, + ldlm_policy_data_t *, ldlm_mode_t, + struct lustre_handle *); - int (*m_cancel_unused)(struct obd_export *, const struct lu_fid *, - ldlm_policy_data_t *, ldlm_mode_t, - ldlm_cancel_flags_t flags, void *opaque); + int (*cancel_unused)(struct obd_export *, const struct lu_fid *, + ldlm_policy_data_t *, ldlm_mode_t, + ldlm_cancel_flags_t flags, void *opaque); - int (*m_get_remote_perm)(struct obd_export *, const struct lu_fid *, - __u32, struct ptlrpc_request **); + int (*get_remote_perm)(struct obd_export *, const struct lu_fid *, + __u32, struct ptlrpc_request **); - int (*m_intent_getattr_async)(struct obd_export *, - struct md_enqueue_info *, - struct ldlm_enqueue_info *); + int (*intent_getattr_async)(struct obd_export *, + struct md_enqueue_info *, + struct ldlm_enqueue_info *); - int (*m_revalidate_lock)(struct obd_export *, struct lookup_intent *, - struct lu_fid *, __u64 *bits); + int (*revalidate_lock)(struct obd_export *, struct lookup_intent *, + struct lu_fid *, __u64 *bits); /* * NOTE: If adding ops, add another LPROCFS_MD_OP_INIT() line to diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 674be77..c323c84 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -261,7 +261,7 @@ void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid); #define OBT(dev) (dev)->obd_type #define OBP(dev, op) (dev)->obd_type->typ_dt_ops->op -#define MDP(dev, op) (dev)->obd_type->typ_md_ops->m_ ## op +#define MDP(dev, op) (dev)->obd_type->typ_md_ops->op #define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op /* Ensure obd_setup: used for cleanup which must be called @@ -314,9 +314,9 @@ static inline int obd_check_dev_active(struct obd_device *obd) } #define MD_COUNTER_OFFSET(op) \ - ((offsetof(struct md_ops, m_ ## op) - \ - offsetof(struct md_ops, m_getstatus)) \ - / sizeof(((struct md_ops *)(0))->m_getstatus)) + ((offsetof(struct md_ops, op) - \ + offsetof(struct md_ops, getstatus)) \ + / sizeof(((struct md_ops *)(0))->getstatus)) #define MD_COUNTER_INCREMENT(obdx, op) \ if ((obd)->md_stats != NULL) { \ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 947a127..55f801b 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2764,35 +2764,35 @@ static struct obd_ops lmv_obd_ops = { }; static struct md_ops lmv_md_ops = { - .m_getstatus = lmv_getstatus, - .m_null_inode = lmv_null_inode, - .m_find_cbdata = lmv_find_cbdata, - .m_close = lmv_close, - .m_create = lmv_create, - .m_done_writing = lmv_done_writing, - .m_enqueue = lmv_enqueue, - .m_getattr = lmv_getattr, - .m_getxattr = lmv_getxattr, - .m_getattr_name = lmv_getattr_name, - .m_intent_lock = lmv_intent_lock, - .m_link = lmv_link, - .m_rename = lmv_rename, - .m_setattr = lmv_setattr, - .m_setxattr = lmv_setxattr, - .m_sync = lmv_sync, - .m_readpage = lmv_readpage, - .m_unlink = lmv_unlink, - .m_init_ea_size = lmv_init_ea_size, - .m_cancel_unused = lmv_cancel_unused, - .m_set_lock_data = lmv_set_lock_data, - .m_lock_match = lmv_lock_match, - .m_get_lustre_md = lmv_get_lustre_md, - .m_free_lustre_md = lmv_free_lustre_md, - .m_set_open_replay_data = lmv_set_open_replay_data, - .m_clear_open_replay_data = lmv_clear_open_replay_data, - .m_get_remote_perm = lmv_get_remote_perm, - .m_intent_getattr_async = lmv_intent_getattr_async, - .m_revalidate_lock = lmv_revalidate_lock + .getstatus = lmv_getstatus, + .null_inode = lmv_null_inode, + .find_cbdata = lmv_find_cbdata, + .close = lmv_close, + .create = lmv_create, + .done_writing = lmv_done_writing, + .enqueue = lmv_enqueue, + .getattr = lmv_getattr, + .getxattr = lmv_getxattr, + .getattr_name = lmv_getattr_name, + .intent_lock = lmv_intent_lock, + .link = lmv_link, + .rename = lmv_rename, + .setattr = lmv_setattr, + .setxattr = lmv_setxattr, + .sync = lmv_sync, + .readpage = lmv_readpage, + .unlink = lmv_unlink, + .init_ea_size = lmv_init_ea_size, + .cancel_unused = lmv_cancel_unused, + .set_lock_data = lmv_set_lock_data, + .lock_match = lmv_lock_match, + .get_lustre_md = lmv_get_lustre_md, + .free_lustre_md = lmv_free_lustre_md, + .set_open_replay_data = lmv_set_open_replay_data, + .clear_open_replay_data = lmv_clear_open_replay_data, + .get_remote_perm = lmv_get_remote_perm, + .intent_getattr_async = lmv_intent_getattr_async, + .revalidate_lock = lmv_revalidate_lock }; static int __init lmv_init(void) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 34a8867..5b78e7a 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2483,36 +2483,36 @@ static struct obd_ops mdc_obd_ops = { }; static struct md_ops mdc_md_ops = { - .m_getstatus = mdc_getstatus, - .m_null_inode = mdc_null_inode, - .m_find_cbdata = mdc_find_cbdata, - .m_close = mdc_close, - .m_create = mdc_create, - .m_done_writing = mdc_done_writing, - .m_enqueue = mdc_enqueue, - .m_getattr = mdc_getattr, - .m_getattr_name = mdc_getattr_name, - .m_intent_lock = mdc_intent_lock, - .m_link = mdc_link, - .m_is_subdir = mdc_is_subdir, - .m_rename = mdc_rename, - .m_setattr = mdc_setattr, - .m_setxattr = mdc_setxattr, - .m_getxattr = mdc_getxattr, - .m_sync = mdc_sync, - .m_readpage = mdc_readpage, - .m_unlink = mdc_unlink, - .m_cancel_unused = mdc_cancel_unused, - .m_init_ea_size = mdc_init_ea_size, - .m_set_lock_data = mdc_set_lock_data, - .m_lock_match = mdc_lock_match, - .m_get_lustre_md = mdc_get_lustre_md, - .m_free_lustre_md = mdc_free_lustre_md, - .m_set_open_replay_data = mdc_set_open_replay_data, - .m_clear_open_replay_data = mdc_clear_open_replay_data, - .m_get_remote_perm = mdc_get_remote_perm, - .m_intent_getattr_async = mdc_intent_getattr_async, - .m_revalidate_lock = mdc_revalidate_lock + .getstatus = mdc_getstatus, + .null_inode = mdc_null_inode, + .find_cbdata = mdc_find_cbdata, + .close = mdc_close, + .create = mdc_create, + .done_writing = mdc_done_writing, + .enqueue = mdc_enqueue, + .getattr = mdc_getattr, + .getattr_name = mdc_getattr_name, + .intent_lock = mdc_intent_lock, + .link = mdc_link, + .is_subdir = mdc_is_subdir, + .rename = mdc_rename, + .setattr = mdc_setattr, + .setxattr = mdc_setxattr, + .getxattr = mdc_getxattr, + .sync = mdc_sync, + .readpage = mdc_readpage, + .unlink = mdc_unlink, + .cancel_unused = mdc_cancel_unused, + .init_ea_size = mdc_init_ea_size, + .set_lock_data = mdc_set_lock_data, + .lock_match = mdc_lock_match, + .get_lustre_md = mdc_get_lustre_md, + .free_lustre_md = mdc_free_lustre_md, + .set_open_replay_data = mdc_set_open_replay_data, + .clear_open_replay_data = mdc_clear_open_replay_data, + .get_remote_perm = mdc_get_remote_perm, + .intent_getattr_async = mdc_intent_getattr_async, + .revalidate_lock = mdc_revalidate_lock }; static int __init mdc_init(void) From dan.carpenter at oracle.com Thu Oct 29 13:51:23 2015 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 29 Oct 2015 16:51:23 +0300 Subject: [lustre-devel] [patch] staging: lustre: potential underflow in libcfs_kkuc_group_add() Message-ID: <20151029135122.GA7709@mwanda> My static checker says that "group" is a user controlled number that can be negative leading to an array underflow. I have looked at it, and I'm not an expert enough in lustre to say for sure if it is really a bug. Anyway, it's simple enough to make the variable unsigned which pleases the static checker and makes it easier to audit. Signed-off-by: Dan Carpenter diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index a989d26..41f3d81 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -91,7 +91,7 @@ typedef int (*libcfs_kkuc_cb_t)(__u32 data, void *cb_arg); /* Kernel methods */ int libcfs_kkuc_msg_put(struct file *fp, void *payload); int libcfs_kkuc_group_put(int group, void *payload); -int libcfs_kkuc_group_add(struct file *fp, int uid, int group, +int libcfs_kkuc_group_add(struct file *fp, int uid, unsigned int group, __u32 data); int libcfs_kkuc_group_rem(int uid, int group); int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func, diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c index ad661a3..d8230ae 100644 --- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c @@ -110,7 +110,8 @@ static DECLARE_RWSEM(kg_sem); * @param uid identifier for this receiver * @param group group number */ -int libcfs_kkuc_group_add(struct file *filp, int uid, int group, __u32 data) +int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group, + __u32 data) { struct kkuc_reg *reg; From simmonsja at ornl.gov Thu Oct 29 15:22:13 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Thu, 29 Oct 2015 15:22:13 +0000 Subject: [lustre-devel] [PATCH 08/10] staging: lustre: remove white space in libcfs_hash.h In-Reply-To: References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> <1446051271-25189-9-git-send-email-jsimmons@infradead.org> Message-ID: <2b25c8958e1944bbbd48b638ab7eed6f@EXCHCS32.ornl.gov> >>struct cfs_hash_bd { >>- struct cfs_hash_bucket *bd_bucket; /**< address of bucket */ >>- unsigned int bd_offset; /**< offset in bucket */ >>+ /**< address of bucket */ >>+ struct cfs_hash_bucket *bd_bucket; >>+ /**< offset in bucket */ >>+ unsigned int bd_offset; >> }; > >The "/**< ... */" marker means "the field to the left", but if you are >moving these to the line before the field you should just use "/* ... */". Fixed. From simmonsja at ornl.gov Thu Oct 29 15:44:59 2015 From: simmonsja at ornl.gov (Simmons, James A.) Date: Thu, 29 Oct 2015 15:44:59 +0000 Subject: [lustre-devel] [PATCH 09/10] staging: lustre: fix remaining checkpatch issues for libcfs_hash.h In-Reply-To: References: <1446051271-25189-1-git-send-email-jsimmons@infradead.org> <1446051271-25189-10-git-send-email-jsimmons@infradead.org> Message-ID: <34f03ffe2c734f2d80bc6d5b1478b82d@EXCHCS32.ornl.gov> >>diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >>b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >>index 5df8ba2..563b2b4 100644 >>--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >>+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h >>@@ -62,7 +62,8 @@ >> /** disable debug */ >> #define CFS_HASH_DEBUG_NONE 0 >> /** record hash depth and output to console when it's too deep, >>- * computing overhead is low but consume more memory */ >>+ * computing overhead is low but consume more memory >>+ */ > >Typically, multi-line comments have the leading /* on a separate line >from the first line of text. If you are changing all these comments >you may as well make it consistent with the kernel style. Fixed for next patch series. From jsimmons at infradead.org Thu Oct 29 21:35:16 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 17:35:16 -0400 Subject: [lustre-devel] [PATCH 0/6] staging: lustre: second series for libcfs hash code cleanup Message-ID: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> From: James Simmons This patch covers more style cleanup series for the libcfs hash code. Mostly removal of white spaces and resolving the checkpath issues in libcfs_hash.h. James Simmons (6): staging: lustre: remove white space in libcfs_hash.h staging: lustre: remove obsolete comment in libcfs_hash.h staging: lustre: move linux hash.h header to start of libcfs_hash.h staging: lustre: fix remaining checkpatch issues for libcfs_hash.h staging: lustre: remove white space in hash.c staging: lustre: place linux header first in hash.c .../lustre/include/linux/libcfs/libcfs_hash.h | 170 +++++----- drivers/staging/lustre/lustre/libcfs/hash.c | 344 ++++++++++---------- 2 files changed, 266 insertions(+), 248 deletions(-) From jsimmons at infradead.org Thu Oct 29 21:35:17 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 17:35:17 -0400 Subject: [lustre-devel] [PATCH 1/6] staging: lustre: remove white space in libcfs_hash.h In-Reply-To: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> References: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446154522-12929-2-git-send-email-jsimmons@infradead.org> From: James Simmons Cleanup all the unneeded white space in libcfs_hash.h. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 135 ++++++++++---------- 1 files changed, 70 insertions(+), 65 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 70b8b29..4d73f8a 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -66,12 +66,12 @@ #include /** disable debug */ -#define CFS_HASH_DEBUG_NONE 0 +#define CFS_HASH_DEBUG_NONE 0 /** record hash depth and output to console when it's too deep, * computing overhead is low but consume more memory */ -#define CFS_HASH_DEBUG_1 1 +#define CFS_HASH_DEBUG_1 1 /** expensive, check key validation */ -#define CFS_HASH_DEBUG_2 2 +#define CFS_HASH_DEBUG_2 2 #define CFS_HASH_DEBUG_LEVEL CFS_HASH_DEBUG_NONE @@ -108,16 +108,18 @@ struct cfs_hash_bucket { * cfs_hash bucket descriptor, it's normally in stack of caller */ struct cfs_hash_bd { - struct cfs_hash_bucket *bd_bucket; /**< address of bucket */ - unsigned int bd_offset; /**< offset in bucket */ + /* address of bucket */ + struct cfs_hash_bucket *bd_bucket; + /* offset in bucket */ + unsigned int bd_offset; }; -#define CFS_HASH_NAME_LEN 16 /**< default name length */ -#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ +#define CFS_HASH_NAME_LEN 16 /**< default name length */ +#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ -#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ -#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ -#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS +#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ +#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ +#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS /** * common hash attributes. @@ -133,41 +135,41 @@ enum cfs_hash_tag { */ CFS_HASH_NO_LOCK = 1 << 0, /** no bucket lock, use one spinlock to protect the whole hash */ - CFS_HASH_NO_BKTLOCK = 1 << 1, + CFS_HASH_NO_BKTLOCK = 1 << 1, /** rwlock to protect bucket */ - CFS_HASH_RW_BKTLOCK = 1 << 2, + CFS_HASH_RW_BKTLOCK = 1 << 2, /** spinlock to protect bucket */ - CFS_HASH_SPIN_BKTLOCK = 1 << 3, + CFS_HASH_SPIN_BKTLOCK = 1 << 3, /** always add new item to tail */ - CFS_HASH_ADD_TAIL = 1 << 4, + CFS_HASH_ADD_TAIL = 1 << 4, /** hash-table doesn't have refcount on item */ - CFS_HASH_NO_ITEMREF = 1 << 5, + CFS_HASH_NO_ITEMREF = 1 << 5, /** big name for param-tree */ CFS_HASH_BIGNAME = 1 << 6, /** track global count */ CFS_HASH_COUNTER = 1 << 7, /** rehash item by new key */ - CFS_HASH_REHASH_KEY = 1 << 8, + CFS_HASH_REHASH_KEY = 1 << 8, /** Enable dynamic hash resizing */ - CFS_HASH_REHASH = 1 << 9, + CFS_HASH_REHASH = 1 << 9, /** can shrink hash-size */ - CFS_HASH_SHRINK = 1 << 10, + CFS_HASH_SHRINK = 1 << 10, /** assert hash is empty on exit */ - CFS_HASH_ASSERT_EMPTY = 1 << 11, + CFS_HASH_ASSERT_EMPTY = 1 << 11, /** record hlist depth */ - CFS_HASH_DEPTH = 1 << 12, + CFS_HASH_DEPTH = 1 << 12, /** * rehash is always scheduled in a different thread, so current * change on hash table is non-blocking */ - CFS_HASH_NBLK_CHANGE = 1 << 13, + CFS_HASH_NBLK_CHANGE = 1 << 13, /** NB, we typed hs_flags as __u16, please change it * if you need to extend >=16 flags */ }; /** most used attributes */ -#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ - CFS_HASH_COUNTER | CFS_HASH_REHASH) +#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ + CFS_HASH_COUNTER | CFS_HASH_REHASH) /** * cfs_hash is a hash-table implementation for general purpose, it can support: @@ -211,7 +213,7 @@ enum cfs_hash_tag { struct cfs_hash { /** serialize with rehash, or serialize all operations if * the hash-table has CFS_HASH_NO_BKTLOCK */ - union cfs_hash_lock hs_lock; + union cfs_hash_lock hs_lock; /** hash operations */ struct cfs_hash_ops *hs_ops; /** hash lock operations */ @@ -219,57 +221,57 @@ struct cfs_hash { /** hash list operations */ struct cfs_hash_hlist_ops *hs_hops; /** hash buckets-table */ - struct cfs_hash_bucket **hs_buckets; + struct cfs_hash_bucket **hs_buckets; /** total number of items on this hash-table */ - atomic_t hs_count; + atomic_t hs_count; /** hash flags, see cfs_hash_tag for detail */ - __u16 hs_flags; + __u16 hs_flags; /** # of extra-bytes for bucket, for user saving extended attributes */ - __u16 hs_extra_bytes; + __u16 hs_extra_bytes; /** wants to iterate */ - __u8 hs_iterating; + __u8 hs_iterating; /** hash-table is dying */ - __u8 hs_exiting; + __u8 hs_exiting; /** current hash bits */ - __u8 hs_cur_bits; + __u8 hs_cur_bits; /** min hash bits */ - __u8 hs_min_bits; + __u8 hs_min_bits; /** max hash bits */ - __u8 hs_max_bits; + __u8 hs_max_bits; /** bits for rehash */ - __u8 hs_rehash_bits; + __u8 hs_rehash_bits; /** bits for each bucket */ - __u8 hs_bkt_bits; + __u8 hs_bkt_bits; /** resize min threshold */ - __u16 hs_min_theta; + __u16 hs_min_theta; /** resize max threshold */ - __u16 hs_max_theta; + __u16 hs_max_theta; /** resize count */ - __u32 hs_rehash_count; + __u32 hs_rehash_count; /** # of iterators (caller of cfs_hash_for_each_*) */ - __u32 hs_iterators; + __u32 hs_iterators; /** rehash workitem */ - cfs_workitem_t hs_rehash_wi; + cfs_workitem_t hs_rehash_wi; /** refcount on this hash table */ - atomic_t hs_refcount; + atomic_t hs_refcount; /** rehash buckets-table */ - struct cfs_hash_bucket **hs_rehash_buckets; + struct cfs_hash_bucket **hs_rehash_buckets; #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 /** serialize debug members */ spinlock_t hs_dep_lock; /** max depth */ - unsigned int hs_dep_max; + unsigned int hs_dep_max; /** id of the deepest bucket */ - unsigned int hs_dep_bkt; + unsigned int hs_dep_bkt; /** offset in the deepest bucket */ - unsigned int hs_dep_off; + unsigned int hs_dep_off; /** bits when we found the max depth */ - unsigned int hs_dep_bits; + unsigned int hs_dep_bits; /** workitem to output max depth */ - cfs_workitem_t hs_dep_wi; + cfs_workitem_t hs_dep_wi; #endif /** name of htable */ - char hs_name[0]; + char hs_name[0]; }; struct cfs_hash_lock_ops { @@ -324,11 +326,11 @@ struct cfs_hash_ops { }; /** total number of buckets in @hs */ -#define CFS_HASH_NBKT(hs) \ +#define CFS_HASH_NBKT(hs) \ (1U << ((hs)->hs_cur_bits - (hs)->hs_bkt_bits)) /** total number of buckets in @hs while rehashing */ -#define CFS_HASH_RH_NBKT(hs) \ +#define CFS_HASH_RH_NBKT(hs) \ (1U << ((hs)->hs_rehash_bits - (hs)->hs_bkt_bits)) /** number of hlist for in bucket */ @@ -433,19 +435,22 @@ cfs_hash_with_nblk_change(struct cfs_hash *hs) static inline int cfs_hash_is_exiting(struct cfs_hash *hs) -{ /* cfs_hash_destroy is called */ +{ + /* cfs_hash_destroy is called */ return hs->hs_exiting; } static inline int cfs_hash_is_rehashing(struct cfs_hash *hs) -{ /* rehash is launched */ +{ + /* rehash is launched */ return hs->hs_rehash_bits != 0; } static inline int cfs_hash_is_iterating(struct cfs_hash *hs) -{ /* someone is calling cfs_hash_for_each_* */ +{ + /* someone is calling cfs_hash_for_each_* */ return hs->hs_iterating || hs->hs_iterators != 0; } @@ -758,7 +763,7 @@ static inline void cfs_hash_bucket_validate(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - struct cfs_hash_bd bds[2]; + struct cfs_hash_bd bds[2]; cfs_hash_dual_bd_get(hs, cfs_hash_key(hs, hnode), bds); LASSERT(bds[0].bd_bucket == bd->bd_bucket || @@ -777,9 +782,9 @@ cfs_hash_bucket_validate(struct cfs_hash *hs, struct cfs_hash_bd *bd, #endif /* CFS_HASH_DEBUG_LEVEL */ -#define CFS_HASH_THETA_BITS 10 -#define CFS_HASH_MIN_THETA (1U << (CFS_HASH_THETA_BITS - 1)) -#define CFS_HASH_MAX_THETA (1U << (CFS_HASH_THETA_BITS + 1)) +#define CFS_HASH_THETA_BITS 10 +#define CFS_HASH_MIN_THETA (1U << (CFS_HASH_THETA_BITS - 1)) +#define CFS_HASH_MAX_THETA (1U << (CFS_HASH_THETA_BITS + 1)) /* Return integer component of theta */ static inline int __cfs_hash_theta_int(int theta) @@ -848,20 +853,20 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask) } /** iterate over all buckets in @bds (array of struct cfs_hash_bd) */ -#define cfs_hash_for_each_bd(bds, n, i) \ +#define cfs_hash_for_each_bd(bds, n, i) \ for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++) /** iterate over all buckets of @hs */ -#define cfs_hash_for_each_bucket(hs, bd, pos) \ - for (pos = 0; \ - pos < CFS_HASH_NBKT(hs) && \ +#define cfs_hash_for_each_bucket(hs, bd, pos) \ + for (pos = 0; \ + pos < CFS_HASH_NBKT(hs) && \ ((bd)->bd_bucket = (hs)->hs_buckets[pos]) != NULL; pos++) /** iterate over all hlist of bucket @bd */ -#define cfs_hash_bd_for_each_hlist(hs, bd, hlist) \ - for ((bd)->bd_offset = 0; \ - (bd)->bd_offset < CFS_HASH_BKT_NHLIST(hs) && \ - (hlist = cfs_hash_bd_hhead(hs, bd)) != NULL; \ +#define cfs_hash_bd_for_each_hlist(hs, bd, hlist) \ + for ((bd)->bd_offset = 0; \ + (bd)->bd_offset < CFS_HASH_BKT_NHLIST(hs) && \ + (hlist = cfs_hash_bd_hhead(hs, bd)) != NULL; \ (bd)->bd_offset++) /* !__LIBCFS__HASH_H__ */ -- 1.7.1 From jsimmons at infradead.org Thu Oct 29 21:35:19 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 17:35:19 -0400 Subject: [lustre-devel] [PATCH 3/6] staging: lustre: move linux hash.h header to start of libcfs_hash.h In-Reply-To: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> References: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446154522-12929-4-git-send-email-jsimmons@infradead.org> From: James Simmons Minor style cleanup to put hash.h header to the top of the libcfs_hash.h file. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 4a78e6d..2e0c892 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -41,6 +41,9 @@ #ifndef __LIBCFS_HASH_H__ #define __LIBCFS_HASH_H__ + +#include + /* * Knuth recommends primes in approximately golden ratio to the maximum * integer representable by a machine word for multiplicative hashing. @@ -56,8 +59,6 @@ /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ #define CFS_GOLDEN_RATIO_PRIME_64 0x9e37fffffffc0001ULL -#include - /** disable debug */ #define CFS_HASH_DEBUG_NONE 0 /** record hash depth and output to console when it's too deep, -- 1.7.1 From jsimmons at infradead.org Thu Oct 29 21:35:18 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 17:35:18 -0400 Subject: [lustre-devel] [PATCH 2/6] staging: lustre: remove obsolete comment in libcfs_hash.h In-Reply-To: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> References: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446154522-12929-3-git-send-email-jsimmons@infradead.org> From: James Simmons Remove comment hash_long which was removed long ago. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 4d73f8a..4a78e6d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -56,13 +56,6 @@ /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ #define CFS_GOLDEN_RATIO_PRIME_64 0x9e37fffffffc0001ULL -/* - * Ideally we would use HAVE_HASH_LONG for this, but on linux we configure - * the linux kernel and user space at the same time, so we need to differentiate - * between them explicitly. If this is not needed on other architectures, then - * we'll need to move the functions to architecture specific headers. - */ - #include /** disable debug */ -- 1.7.1 From jsimmons at infradead.org Thu Oct 29 21:35:20 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 17:35:20 -0400 Subject: [lustre-devel] [PATCH 4/6] staging: lustre: fix remaining checkpatch issues for libcfs_hash.h In-Reply-To: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> References: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446154522-12929-5-git-send-email-jsimmons@infradead.org> From: James Simmons Final cleanup to make libcfs_hash.h completely kernel standard compliant. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_hash.h | 25 ++++++++++++------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 2e0c892..6bd2012 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -61,8 +61,10 @@ /** disable debug */ #define CFS_HASH_DEBUG_NONE 0 -/** record hash depth and output to console when it's too deep, - * computing overhead is low but consume more memory */ +/* + * record hash depth and output to console when it's too deep, + * computing overhead is low but consume more memory + */ #define CFS_HASH_DEBUG_1 1 /** expensive, check key validation */ #define CFS_HASH_DEBUG_2 2 @@ -158,7 +160,8 @@ enum cfs_hash_tag { */ CFS_HASH_NBLK_CHANGE = 1 << 13, /** NB, we typed hs_flags as __u16, please change it - * if you need to extend >=16 flags */ + * if you need to extend >=16 flags + */ }; /** most used attributes */ @@ -205,8 +208,10 @@ enum cfs_hash_tag { */ struct cfs_hash { - /** serialize with rehash, or serialize all operations if - * the hash-table has CFS_HASH_NO_BKTLOCK */ + /* + * serialize with rehash, or serialize all operations if + * the hash-table has CFS_HASH_NO_BKTLOCK + */ union cfs_hash_lock hs_lock; /** hash operations */ struct cfs_hash_ops *hs_ops; @@ -373,9 +378,11 @@ cfs_hash_with_add_tail(struct cfs_hash *hs) static inline int cfs_hash_with_no_itemref(struct cfs_hash *hs) { - /* hash-table doesn't keep refcount on item, + /* + * hash-table doesn't keep refcount on item, * item can't be removed from hash unless it's - * ZERO refcount */ + * ZERO refcount. + */ return (hs->hs_flags & CFS_HASH_NO_ITEMREF) != 0; } @@ -820,7 +827,7 @@ cfs_hash_djb2_hash(const void *key, size_t size, unsigned mask) { unsigned i, hash = 5381; - LASSERT(key != NULL); + LASSERT(key); for (i = 0; i < size; i++) hash = hash * 33 + ((char *)key)[i]; @@ -848,7 +855,7 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask) /** iterate over all buckets in @bds (array of struct cfs_hash_bd) */ #define cfs_hash_for_each_bd(bds, n, i) \ - for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++) + for (i = 0; i < n && (bds)[i].bd_bucket; i++) /** iterate over all buckets of @hs */ #define cfs_hash_for_each_bucket(hs, bd, pos) \ -- 1.7.1 From jsimmons at infradead.org Thu Oct 29 21:35:22 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 17:35:22 -0400 Subject: [lustre-devel] [PATCH 6/6] staging: lustre: place linux header first in hash.c In-Reply-To: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> References: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446154522-12929-7-git-send-email-jsimmons@infradead.org> From: James Simmons Always place linux headers first in libcfs header files. This avoid can potential build issues if any changes to a libcfs header land that starts using a linux header definition. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/libcfs/hash.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index ed4e1f1..4cd8776 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -106,9 +106,9 @@ * Now we support both locked iteration & lockless iteration of hash * table. Also, user can break the iteration by return 1 in callback. */ +#include #include "../../include/linux/libcfs/libcfs.h" -#include #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 static unsigned int warn_on_depth = 8; -- 1.7.1 From jsimmons at infradead.org Thu Oct 29 21:35:21 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 17:35:21 -0400 Subject: [lustre-devel] [PATCH 5/6] staging: lustre: remove white space in hash.c In-Reply-To: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> References: <1446154522-12929-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446154522-12929-6-git-send-email-jsimmons@infradead.org> From: James Simmons Cleanup all the unneeded white space in hash.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/libcfs/hash.c | 342 ++++++++++++++------------- 1 files changed, 177 insertions(+), 165 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 0308744..ed4e1f1 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -161,49 +161,49 @@ cfs_hash_rw_unlock(union cfs_hash_lock *lock, int exclusive) /** No lock hash */ static struct cfs_hash_lock_ops cfs_hash_nl_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_nl_lock, - .hs_bkt_unlock = cfs_hash_nl_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_nl_lock, + .hs_bkt_unlock = cfs_hash_nl_unlock, }; /** no bucket lock, one spinlock to protect everything */ static struct cfs_hash_lock_ops cfs_hash_nbl_lops = { .hs_lock = cfs_hash_spin_lock, - .hs_unlock = cfs_hash_spin_unlock, - .hs_bkt_lock = cfs_hash_nl_lock, - .hs_bkt_unlock = cfs_hash_nl_unlock, + .hs_unlock = cfs_hash_spin_unlock, + .hs_bkt_lock = cfs_hash_nl_lock, + .hs_bkt_unlock = cfs_hash_nl_unlock, }; /** spin bucket lock, rehash is enabled */ static struct cfs_hash_lock_ops cfs_hash_bkt_spin_lops = { .hs_lock = cfs_hash_rw_lock, - .hs_unlock = cfs_hash_rw_unlock, - .hs_bkt_lock = cfs_hash_spin_lock, - .hs_bkt_unlock = cfs_hash_spin_unlock, + .hs_unlock = cfs_hash_rw_unlock, + .hs_bkt_lock = cfs_hash_spin_lock, + .hs_bkt_unlock = cfs_hash_spin_unlock, }; /** rw bucket lock, rehash is enabled */ static struct cfs_hash_lock_ops cfs_hash_bkt_rw_lops = { .hs_lock = cfs_hash_rw_lock, - .hs_unlock = cfs_hash_rw_unlock, - .hs_bkt_lock = cfs_hash_rw_lock, - .hs_bkt_unlock = cfs_hash_rw_unlock, + .hs_unlock = cfs_hash_rw_unlock, + .hs_bkt_lock = cfs_hash_rw_lock, + .hs_bkt_unlock = cfs_hash_rw_unlock, }; /** spin bucket lock, rehash is disabled */ static struct cfs_hash_lock_ops cfs_hash_nr_bkt_spin_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_spin_lock, - .hs_bkt_unlock = cfs_hash_spin_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_spin_lock, + .hs_bkt_unlock = cfs_hash_spin_unlock, }; /** rw bucket lock, rehash is disabled */ static struct cfs_hash_lock_ops cfs_hash_nr_bkt_rw_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_rw_lock, - .hs_bkt_unlock = cfs_hash_rw_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_rw_lock, + .hs_bkt_unlock = cfs_hash_rw_unlock, }; static void @@ -280,7 +280,7 @@ cfs_hash_hh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_head_dep { struct hlist_head hd_head; /**< entries list */ - unsigned int hd_depth; /**< list length */ + unsigned int hd_depth; /**< list length */ }; static int @@ -328,7 +328,7 @@ cfs_hash_hd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_dhead { struct hlist_head dh_head; /**< entries list */ - struct hlist_node *dh_tail; /**< the last entry */ + struct hlist_node *dh_tail; /**< the last entry */ }; static int @@ -384,8 +384,8 @@ cfs_hash_dh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_dhead_dep { struct hlist_head dd_head; /**< entries list */ - struct hlist_node *dd_tail; /**< the last entry */ - unsigned int dd_depth; /**< list length */ + struct hlist_node *dd_tail; /**< the last entry */ + unsigned int dd_depth; /**< list length */ }; static int @@ -436,31 +436,31 @@ cfs_hash_dd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, } static struct cfs_hash_hlist_ops cfs_hash_hh_hops = { - .hop_hhead = cfs_hash_hh_hhead, - .hop_hhead_size = cfs_hash_hh_hhead_size, - .hop_hnode_add = cfs_hash_hh_hnode_add, - .hop_hnode_del = cfs_hash_hh_hnode_del, + .hop_hhead = cfs_hash_hh_hhead, + .hop_hhead_size = cfs_hash_hh_hhead_size, + .hop_hnode_add = cfs_hash_hh_hnode_add, + .hop_hnode_del = cfs_hash_hh_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_hd_hops = { - .hop_hhead = cfs_hash_hd_hhead, - .hop_hhead_size = cfs_hash_hd_hhead_size, - .hop_hnode_add = cfs_hash_hd_hnode_add, - .hop_hnode_del = cfs_hash_hd_hnode_del, + .hop_hhead = cfs_hash_hd_hhead, + .hop_hhead_size = cfs_hash_hd_hhead_size, + .hop_hnode_add = cfs_hash_hd_hnode_add, + .hop_hnode_del = cfs_hash_hd_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_dh_hops = { - .hop_hhead = cfs_hash_dh_hhead, - .hop_hhead_size = cfs_hash_dh_hhead_size, - .hop_hnode_add = cfs_hash_dh_hnode_add, - .hop_hnode_del = cfs_hash_dh_hnode_del, + .hop_hhead = cfs_hash_dh_hhead, + .hop_hhead_size = cfs_hash_dh_hhead_size, + .hop_hnode_add = cfs_hash_dh_hnode_add, + .hop_hnode_del = cfs_hash_dh_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_dd_hops = { - .hop_hhead = cfs_hash_dd_hhead, - .hop_hhead_size = cfs_hash_dd_hhead_size, - .hop_hnode_add = cfs_hash_dd_hnode_add, - .hop_hnode_del = cfs_hash_dd_hnode_del, + .hop_hhead = cfs_hash_dd_hhead, + .hop_hhead_size = cfs_hash_dd_hhead_size, + .hop_hnode_add = cfs_hash_dd_hnode_add, + .hop_hnode_del = cfs_hash_dd_hnode_del, }; static void @@ -529,7 +529,7 @@ void cfs_hash_bd_add_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - int rc; + int rc; rc = hs->hs_hops->hop_hnode_add(hs, bd, hnode); cfs_hash_bd_dep_record(hs, bd, rc); @@ -572,7 +572,7 @@ cfs_hash_bd_move_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd_old, { struct cfs_hash_bucket *obkt = bd_old->bd_bucket; struct cfs_hash_bucket *nbkt = bd_new->bd_bucket; - int rc; + int rc; if (cfs_hash_bd_compare(bd_old, bd_new) == 0) return; @@ -597,30 +597,30 @@ EXPORT_SYMBOL(cfs_hash_bd_move_locked); enum { /** always set, for sanity (avoid ZERO intent) */ - CFS_HS_LOOKUP_MASK_FIND = BIT(0), + CFS_HS_LOOKUP_MASK_FIND = BIT(0), /** return entry with a ref */ - CFS_HS_LOOKUP_MASK_REF = BIT(1), + CFS_HS_LOOKUP_MASK_REF = BIT(1), /** add entry if not existing */ - CFS_HS_LOOKUP_MASK_ADD = BIT(2), + CFS_HS_LOOKUP_MASK_ADD = BIT(2), /** delete entry, ignore other masks */ - CFS_HS_LOOKUP_MASK_DEL = BIT(3), + CFS_HS_LOOKUP_MASK_DEL = BIT(3), }; enum cfs_hash_lookup_intent { /** return item w/o refcount */ - CFS_HS_LOOKUP_IT_PEEK = CFS_HS_LOOKUP_MASK_FIND, + CFS_HS_LOOKUP_IT_PEEK = CFS_HS_LOOKUP_MASK_FIND, /** return item with refcount */ - CFS_HS_LOOKUP_IT_FIND = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_REF), + CFS_HS_LOOKUP_IT_FIND = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_REF), /** return item w/o refcount if existed, otherwise add */ - CFS_HS_LOOKUP_IT_ADD = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_ADD), + CFS_HS_LOOKUP_IT_ADD = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_ADD), /** return item with refcount if existed, otherwise add */ - CFS_HS_LOOKUP_IT_FINDADD = (CFS_HS_LOOKUP_IT_FIND | - CFS_HS_LOOKUP_MASK_ADD), + CFS_HS_LOOKUP_IT_FINDADD = (CFS_HS_LOOKUP_IT_FIND | + CFS_HS_LOOKUP_MASK_ADD), /** delete if existed */ - CFS_HS_LOOKUP_IT_FINDDEL = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_DEL) + CFS_HS_LOOKUP_IT_FINDDEL = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_DEL) }; static struct hlist_node * @@ -629,10 +629,10 @@ cfs_hash_bd_lookup_intent(struct cfs_hash *hs, struct cfs_hash_bd *bd, enum cfs_hash_lookup_intent intent) { - struct hlist_head *hhead = cfs_hash_bd_hhead(hs, bd); - struct hlist_node *ehnode; - struct hlist_node *match; - int intent_add = (intent & CFS_HS_LOOKUP_MASK_ADD) != 0; + struct hlist_head *hhead = cfs_hash_bd_hhead(hs, bd); + struct hlist_node *ehnode; + struct hlist_node *match; + int intent_add = (intent & CFS_HS_LOOKUP_MASK_ADD) != 0; /* with this function, we can avoid a lot of useless refcount ops, * which are expensive atomic operations most time. */ @@ -665,7 +665,8 @@ cfs_hash_bd_lookup_intent(struct cfs_hash *hs, struct cfs_hash_bd *bd, } struct hlist_node * -cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const void *key) +cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key) { return cfs_hash_bd_lookup_intent(hs, bd, key, NULL, CFS_HS_LOOKUP_IT_FIND); @@ -673,7 +674,8 @@ cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const voi EXPORT_SYMBOL(cfs_hash_bd_lookup_locked); struct hlist_node * -cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const void *key) +cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key) { return cfs_hash_bd_lookup_intent(hs, bd, key, NULL, CFS_HS_LOOKUP_IT_PEEK); @@ -706,7 +708,7 @@ cfs_hash_multi_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, int excl) { struct cfs_hash_bucket *prev = NULL; - int i; + int i; /** * bds must be ascendantly ordered by bd->bd_bucket->hsb_index. @@ -729,7 +731,7 @@ cfs_hash_multi_bd_unlock(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, int excl) { struct cfs_hash_bucket *prev = NULL; - int i; + int i; cfs_hash_for_each_bd(bds, n, i) { if (prev != bds[i].bd_bucket) { @@ -743,8 +745,8 @@ static struct hlist_node * cfs_hash_multi_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, const void *key) { - struct hlist_node *ehnode; - unsigned i; + struct hlist_node *ehnode; + unsigned i; cfs_hash_for_each_bd(bds, n, i) { ehnode = cfs_hash_bd_lookup_intent(hs, &bds[i], key, NULL, @@ -756,13 +758,13 @@ cfs_hash_multi_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, } static struct hlist_node * -cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bds, unsigned n, const void *key, +cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, + unsigned n, const void *key, struct hlist_node *hnode, int noref) { - struct hlist_node *ehnode; - int intent; - unsigned i; + struct hlist_node *ehnode; + int intent; + unsigned i; LASSERT(hnode != NULL); intent = (!noref * CFS_HS_LOOKUP_MASK_REF) | CFS_HS_LOOKUP_IT_PEEK; @@ -777,7 +779,7 @@ cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, if (i == 1) { /* only one bucket */ cfs_hash_bd_add_locked(hs, &bds[0], hnode); } else { - struct cfs_hash_bd mybd; + struct cfs_hash_bd mybd; cfs_hash_bd_get(hs, key, &mybd); cfs_hash_bd_add_locked(hs, &mybd, hnode); @@ -791,8 +793,8 @@ cfs_hash_multi_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, const void *key, struct hlist_node *hnode) { - struct hlist_node *ehnode; - unsigned i; + struct hlist_node *ehnode; + unsigned int i; cfs_hash_for_each_bd(bds, n, i) { ehnode = cfs_hash_bd_lookup_intent(hs, &bds[i], key, hnode, @@ -806,7 +808,7 @@ cfs_hash_multi_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, static void cfs_hash_bd_order(struct cfs_hash_bd *bd1, struct cfs_hash_bd *bd2) { - int rc; + int rc; if (bd2->bd_bucket == NULL) return; @@ -831,7 +833,8 @@ cfs_hash_bd_order(struct cfs_hash_bd *bd1, struct cfs_hash_bd *bd2) } void -cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, struct cfs_hash_bd *bds) +cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, + struct cfs_hash_bd *bds) { /* NB: caller should hold hs_lock.rw if REHASH is set */ cfs_hash_bd_from_key(hs, hs->hs_buckets, @@ -894,7 +897,7 @@ static void cfs_hash_buckets_free(struct cfs_hash_bucket **buckets, int bkt_size, int prev_size, int size) { - int i; + int i; for (i = prev_size; i < size; i++) { if (buckets[i] != NULL) @@ -914,7 +917,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, unsigned int old_size, unsigned int new_size) { struct cfs_hash_bucket **new_bkts; - int i; + int i; LASSERT(old_size == 0 || old_bkts != NULL); @@ -932,7 +935,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, for (i = old_size; i < new_size; i++) { struct hlist_head *hhead; - struct cfs_hash_bd bd; + struct cfs_hash_bd bd; LIBCFS_ALLOC(new_bkts[i], cfs_hash_bkt_size(hs)); if (new_bkts[i] == NULL) { @@ -969,7 +972,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, * @max_bits - Maximum allowed hash table resize, in bits * @ops - Registered hash table operations * @flags - CFS_HASH_REHASH enable synamic hash resizing - * - CFS_HASH_SORT enable chained hash sort + * - CFS_HASH_SORT enable chained hash sort */ static int cfs_hash_rehash_worker(cfs_workitem_t *wi); @@ -977,10 +980,10 @@ static int cfs_hash_rehash_worker(cfs_workitem_t *wi); static int cfs_hash_dep_print(cfs_workitem_t *wi) { struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_dep_wi); - int dep; - int bkt; - int off; - int bits; + int dep; + int bkt; + int off; + int bits; spin_lock(&hs->hs_dep_lock); dep = hs->hs_dep_max; @@ -1031,7 +1034,7 @@ cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, struct cfs_hash_ops *ops, unsigned flags) { struct cfs_hash *hs; - int len; + int len; CLASSERT(CFS_HASH_THETA_BITS < 15); @@ -1077,7 +1080,7 @@ cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, hs->hs_max_bits = (__u8)max_bits; hs->hs_bkt_bits = (__u8)bkt_bits; - hs->hs_ops = ops; + hs->hs_ops = ops; hs->hs_extra_bytes = extra_bytes; hs->hs_rehash_bits = 0; cfs_wi_init(&hs->hs_rehash_wi, hs, cfs_hash_rehash_worker); @@ -1102,10 +1105,10 @@ EXPORT_SYMBOL(cfs_hash_create); static void cfs_hash_destroy(struct cfs_hash *hs) { - struct hlist_node *hnode; - struct hlist_node *pos; - struct cfs_hash_bd bd; - int i; + struct hlist_node *hnode; + struct hlist_node *pos; + struct cfs_hash_bd bd; + int i; LASSERT(hs != NULL); LASSERT(!cfs_hash_is_exiting(hs) && @@ -1223,8 +1226,8 @@ cfs_hash_rehash_inline(struct cfs_hash *hs) void cfs_hash_add(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) { - struct cfs_hash_bd bd; - int bits; + struct cfs_hash_bd bd; + int bits; LASSERT(hlist_unhashed(hnode)); @@ -1248,8 +1251,8 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, struct hlist_node *hnode, int noref) { struct hlist_node *ehnode; - struct cfs_hash_bd bds[2]; - int bits = 0; + struct cfs_hash_bd bds[2]; + int bits = 0; LASSERT(hlist_unhashed(hnode)); @@ -1261,7 +1264,7 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, hnode, noref); cfs_hash_dual_bd_unlock(hs, bds, 1); - if (ehnode == hnode) /* new item added */ + if (ehnode == hnode) /* new item added */ bits = cfs_hash_rehash_bits(hs); cfs_hash_unlock(hs, 0); if (bits > 0) @@ -1276,7 +1279,8 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, * Returns 0 on success or -EALREADY on key collisions. */ int -cfs_hash_add_unique(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) +cfs_hash_add_unique(struct cfs_hash *hs, const void *key, + struct hlist_node *hnode) { return cfs_hash_find_or_add(hs, key, hnode, 1) != hnode ? -EALREADY : 0; @@ -1309,9 +1313,9 @@ EXPORT_SYMBOL(cfs_hash_findadd_unique); void * cfs_hash_del(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) { - void *obj = NULL; - int bits = 0; - struct cfs_hash_bd bds[2]; + void *obj = NULL; + int bits = 0; + struct cfs_hash_bd bds[2]; cfs_hash_lock(hs, 0); cfs_hash_dual_bd_get_and_lock(hs, key, bds, 1); @@ -1364,9 +1368,9 @@ EXPORT_SYMBOL(cfs_hash_del_key); void * cfs_hash_lookup(struct cfs_hash *hs, const void *key) { - void *obj = NULL; - struct hlist_node *hnode; - struct cfs_hash_bd bds[2]; + void *obj = NULL; + struct hlist_node *hnode; + struct cfs_hash_bd bds[2]; cfs_hash_lock(hs, 0); cfs_hash_dual_bd_get_and_lock(hs, key, bds, 0); @@ -1383,7 +1387,8 @@ cfs_hash_lookup(struct cfs_hash *hs, const void *key) EXPORT_SYMBOL(cfs_hash_lookup); static void -cfs_hash_for_each_enter(struct cfs_hash *hs) { +cfs_hash_for_each_enter(struct cfs_hash *hs) +{ LASSERT(!cfs_hash_is_exiting(hs)); if (!cfs_hash_with_rehash(hs)) @@ -1408,7 +1413,8 @@ cfs_hash_for_each_enter(struct cfs_hash *hs) { } static void -cfs_hash_for_each_exit(struct cfs_hash *hs) { +cfs_hash_for_each_exit(struct cfs_hash *hs) +{ int remained; int bits; @@ -1439,14 +1445,15 @@ cfs_hash_for_each_exit(struct cfs_hash *hs) { */ static __u64 cfs_hash_for_each_tight(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, - void *data, int remove_safe) { - struct hlist_node *hnode; - struct hlist_node *pos; - struct cfs_hash_bd bd; - __u64 count = 0; - int excl = !!remove_safe; - int loop = 0; - int i; + void *data, int remove_safe) +{ + struct hlist_node *hnode; + struct hlist_node *pos; + struct cfs_hash_bd bd; + __u64 count = 0; + int excl = !!remove_safe; + int loop = 0; + int i; cfs_hash_for_each_enter(hs); @@ -1514,8 +1521,8 @@ void cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, void *data) { struct cfs_hash_cond_arg arg = { - .func = func, - .arg = data, + .func = func, + .arg = data, }; cfs_hash_for_each_tight(hs, cfs_hash_cond_del_locked, &arg, 1); @@ -1523,16 +1530,17 @@ cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, void *data) EXPORT_SYMBOL(cfs_hash_cond_del); void -cfs_hash_for_each(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) +cfs_hash_for_each(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) { cfs_hash_for_each_tight(hs, func, data, 0); } EXPORT_SYMBOL(cfs_hash_for_each); void -cfs_hash_for_each_safe(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { +cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ cfs_hash_for_each_tight(hs, func, data, 1); } EXPORT_SYMBOL(cfs_hash_for_each_safe); @@ -1581,15 +1589,16 @@ EXPORT_SYMBOL(cfs_hash_size_get); */ static int cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, - void *data) { + void *data) +{ struct hlist_node *hnode; struct hlist_node *tmp; - struct cfs_hash_bd bd; - __u32 version; - int count = 0; - int stop_on_change; - int rc; - int i; + struct cfs_hash_bd bd; + __u32 version; + int count = 0; + int stop_on_change; + int rc; + int i; stop_on_change = cfs_hash_with_rehash_key(hs) || !cfs_hash_with_no_itemref(hs) || @@ -1645,8 +1654,9 @@ cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, } int -cfs_hash_for_each_nolock(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { +cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ if (cfs_hash_with_no_lock(hs) || cfs_hash_with_rehash_key(hs) || !cfs_hash_with_no_itemref(hs)) @@ -1677,9 +1687,10 @@ EXPORT_SYMBOL(cfs_hash_for_each_nolock); * the required locking is in place to prevent concurrent insertions. */ int -cfs_hash_for_each_empty(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { - unsigned i = 0; +cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ + unsigned i = 0; if (cfs_hash_with_no_lock(hs)) return -EOPNOTSUPP; @@ -1703,9 +1714,9 @@ void cfs_hash_hlist_for_each(struct cfs_hash *hs, unsigned hindex, cfs_hash_for_each_cb_t func, void *data) { - struct hlist_head *hhead; - struct hlist_node *hnode; - struct cfs_hash_bd bd; + struct hlist_head *hhead; + struct hlist_node *hnode; + struct cfs_hash_bd bd; cfs_hash_for_each_enter(hs); cfs_hash_lock(hs, 0); @@ -1721,7 +1732,7 @@ cfs_hash_hlist_for_each(struct cfs_hash *hs, unsigned hindex, break; } cfs_hash_bd_unlock(hs, &bd, 0); - out: +out: cfs_hash_unlock(hs, 0); cfs_hash_for_each_exit(hs); } @@ -1736,10 +1747,11 @@ EXPORT_SYMBOL(cfs_hash_hlist_for_each); */ void cfs_hash_for_each_key(struct cfs_hash *hs, const void *key, - cfs_hash_for_each_cb_t func, void *data) { - struct hlist_node *hnode; - struct cfs_hash_bd bds[2]; - unsigned i; + cfs_hash_for_each_cb_t func, void *data) +{ + struct hlist_node *hnode; + struct cfs_hash_bd bds[2]; + unsigned int i; cfs_hash_lock(hs, 0); @@ -1777,7 +1789,7 @@ EXPORT_SYMBOL(cfs_hash_for_each_key); void cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) { - int i; + int i; /* need hold cfs_hash_lock(hs, 1) */ LASSERT(cfs_hash_with_rehash(hs) && @@ -1815,7 +1827,7 @@ EXPORT_SYMBOL(cfs_hash_rehash_cancel); int cfs_hash_rehash(struct cfs_hash *hs, int do_rehash) { - int rc; + int rc; LASSERT(cfs_hash_with_rehash(hs) && !cfs_hash_with_no_lock(hs)); @@ -1845,12 +1857,12 @@ EXPORT_SYMBOL(cfs_hash_rehash); static int cfs_hash_rehash_bd(struct cfs_hash *hs, struct cfs_hash_bd *old) { - struct cfs_hash_bd new; - struct hlist_head *hhead; - struct hlist_node *hnode; - struct hlist_node *pos; - void *key; - int c = 0; + struct cfs_hash_bd new; + struct hlist_head *hhead; + struct hlist_node *hnode; + struct hlist_node *pos; + void *key; + int c = 0; /* hold cfs_hash_lock(hs, 1), so don't need any bucket lock */ cfs_hash_bd_for_each_hlist(hs, old, hhead) { @@ -1876,17 +1888,17 @@ cfs_hash_rehash_bd(struct cfs_hash *hs, struct cfs_hash_bd *old) static int cfs_hash_rehash_worker(cfs_workitem_t *wi) { - struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_rehash_wi); + struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_rehash_wi); struct cfs_hash_bucket **bkts; - struct cfs_hash_bd bd; - unsigned int old_size; - unsigned int new_size; - int bsize; - int count = 0; - int rc = 0; - int i; + struct cfs_hash_bd bd; + unsigned int old_size; + unsigned int new_size; + int bsize; + int count = 0; + int rc = 0; + int i; - LASSERT (hs != NULL && cfs_hash_with_rehash(hs)); + LASSERT(hs != NULL && cfs_hash_with_rehash(hs)); cfs_hash_lock(hs, 0); LASSERT(cfs_hash_is_rehashing(hs)); @@ -1958,7 +1970,7 @@ cfs_hash_rehash_worker(cfs_workitem_t *wi) hs->hs_rehash_buckets = NULL; hs->hs_cur_bits = hs->hs_rehash_bits; - out: +out: hs->hs_rehash_bits = 0; if (rc == -ESRCH) /* never be scheduled again */ cfs_wi_exit(cfs_sched_rehash, wi); @@ -1986,9 +1998,9 @@ cfs_hash_rehash_worker(cfs_workitem_t *wi) void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key, void *new_key, struct hlist_node *hnode) { - struct cfs_hash_bd bds[3]; - struct cfs_hash_bd old_bds[2]; - struct cfs_hash_bd new_bd; + struct cfs_hash_bd bds[3]; + struct cfs_hash_bd old_bds[2]; + struct cfs_hash_bd new_bd; LASSERT(!hlist_unhashed(hnode)); @@ -2054,12 +2066,12 @@ cfs_hash_full_nbkt(struct cfs_hash *hs) void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) { - int dist[8] = { 0, }; - int maxdep = -1; - int maxdepb = -1; - int total = 0; - int theta; - int i; + int dist[8] = { 0, }; + int maxdep = -1; + int maxdepb = -1; + int total = 0; + int theta; + int i; cfs_hash_lock(hs, 0); theta = __cfs_hash_theta(hs); @@ -2085,11 +2097,11 @@ void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) * If you hash function results in a non-uniform hash the will * be observable by outlier bucks in the distribution histogram. * - * Uniform hash distribution: 128/128/0/0/0/0/0/0 - * Non-Uniform hash distribution: 128/125/0/0/0/0/2/1 + * Uniform hash distribution: 128/128/0/0/0/0/0/0 + * Non-Uniform hash distribution: 128/125/0/0/0/0/2/1 */ for (i = 0; i < cfs_hash_full_nbkt(hs); i++) { - struct cfs_hash_bd bd; + struct cfs_hash_bd bd; bd.bd_bucket = cfs_hash_full_bkts(hs)[i]; cfs_hash_bd_lock(hs, &bd, 0); -- 1.7.1 From jsimmons at infradead.org Thu Oct 29 23:28:20 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 19:28:20 -0400 Subject: [lustre-devel] [PATCH 0/3] make nidstring.c kernel style compliant Message-ID: <1446161303-798-1-git-send-email-jsimmons@infradead.org> Last patch set to make nidstring.c and nidstr.h both report no errors with checkpatch and removal of the remaining white spaces. James Simmons (3): staging: lustre: checkpatch cleanups for nidstring.c staging: lustre: white space cleanups for nidstring.c staging: lustre: checkpatch cleanups for nidstr.h drivers/staging/lustre/include/linux/lnet/nidstr.h | 9 ++- drivers/staging/lustre/lnet/lnet/nidstrings.c | 98 +++++++++++--------- 2 files changed, 60 insertions(+), 47 deletions(-) From jsimmons at infradead.org Thu Oct 29 23:28:23 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 19:28:23 -0400 Subject: [lustre-devel] [PATCH 3/3] staging: lustre: checkpatch cleanups for nidstr.h In-Reply-To: <1446161303-798-1-git-send-email-jsimmons@infradead.org> References: <1446161303-798-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446161303-798-4-git-send-email-jsimmons@infradead.org> With nidstr.h now having the latest fixes we can now clean up all the remaining checkpatch errors for this header. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/nidstr.h | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 46ad914..ad591d2 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -34,8 +34,10 @@ * Lustre Network Driver types. */ enum { - /* Only add to these values (i.e. don't ever change or redefine them): - * network addresses depend on them... */ + /* + * Only add to these values (i.e. don't ever change or redefine them): + * network addresses depend on them... + */ QSWLND = 1, SOCKLND = 2, GMLND = 3, @@ -67,6 +69,7 @@ static inline char *libcfs_lnd2str(__u32 lnd) return libcfs_lnd2str_r(lnd, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + int libcfs_str2lnd(const char *str); char *libcfs_net2str_r(__u32 net, char *buf, size_t buf_size); static inline char *libcfs_net2str(__u32 net) @@ -74,12 +77,14 @@ static inline char *libcfs_net2str(__u32 net) return libcfs_net2str_r(net, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + char *libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size); static inline char *libcfs_nid2str(lnet_nid_t nid) { return libcfs_nid2str_r(nid, libcfs_next_nidstring(), LNET_NIDSTR_SIZE); } + __u32 libcfs_str2net(const char *str); lnet_nid_t libcfs_str2nid(const char *str); int libcfs_str2anynid(lnet_nid_t *nid, const char *str); -- 1.7.1 From jsimmons at infradead.org Thu Oct 29 23:28:21 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 19:28:21 -0400 Subject: [lustre-devel] [PATCH 1/3] staging: lustre: checkpatch cleanups for nidstring.c In-Reply-To: <1446161303-798-1-git-send-email-jsimmons@infradead.org> References: <1446161303-798-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446161303-798-2-git-send-email-jsimmons@infradead.org> With nidstring now having the latest fixes we can now clean up all the remaining checkpatch errors for nidstring.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/nidstrings.c | 80 ++++++++++++++----------- 1 files changed, 44 insertions(+), 36 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index 80f585a..ee04c3b 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -162,6 +162,7 @@ struct addrrange { static int parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange) { + struct netstrfns *nf = nidrange->nr_netstrfns; struct addrrange *addrrange; if (src->ls_len == 1 && src->ls_str[0] == '*') { @@ -170,14 +171,13 @@ parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange) } LIBCFS_ALLOC(addrrange, sizeof(struct addrrange)); - if (addrrange == NULL) + if (!addrrange) return -ENOMEM; list_add_tail(&addrrange->ar_link, &nidrange->nr_addrranges); INIT_LIST_HEAD(&addrrange->ar_numaddr_ranges); - return nidrange->nr_netstrfns->nf_parse_addrlist(src->ls_str, - src->ls_len, - &addrrange->ar_numaddr_ranges); + return nf->nf_parse_addrlist(src->ls_str, src->ls_len, + &addrrange->ar_numaddr_ranges); } /** @@ -203,16 +203,18 @@ add_nidrange(const struct cfs_lstr *src, return NULL; nf = libcfs_namenum2netstrfns(src->ls_str); - if (nf == NULL) + if (!nf) return NULL; endlen = src->ls_len - strlen(nf->nf_name); if (endlen == 0) /* network name only, e.g. "elan" or "tcp" */ netnum = 0; else { - /* e.g. "elan25" or "tcp23", refuse to parse if + /* + * e.g. "elan25" or "tcp23", refuse to parse if * network name is not appended with decimal or - * hexadecimal number */ + * hexadecimal number + */ if (!cfs_str2num_check(src->ls_str + strlen(nf->nf_name), endlen, &netnum, 0, MAX_NUMERIC_VALUE)) return NULL; @@ -227,7 +229,7 @@ add_nidrange(const struct cfs_lstr *src, } LIBCFS_ALLOC(nr, sizeof(struct nidrange)); - if (nr == NULL) + if (!nr) return NULL; list_add_tail(&nr->nr_link, nidlist); INIT_LIST_HEAD(&nr->nr_addrranges); @@ -256,11 +258,11 @@ parse_nidrange(struct cfs_lstr *src, struct list_head *nidlist) if (cfs_gettok(src, '@', &addrrange) == 0) goto failed; - if (cfs_gettok(src, '@', &net) == 0 || src->ls_str != NULL) + if (cfs_gettok(src, '@', &net) == 0 || src->ls_str) goto failed; nr = add_nidrange(&net, nidlist); - if (nr == NULL) + if (!nr) goto failed; if (parse_addrange(&addrrange, nr) != 0) @@ -370,15 +372,17 @@ int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist) struct addrrange *ar; list_for_each_entry(nr, nidlist, nr_link) { - if (nr->nr_netstrfns->nf_type != LNET_NETTYP(LNET_NIDNET(nid))) + struct netstrfns *nf = nr->nr_netstrfns; + + if (nf->nf_type != LNET_NETTYP(LNET_NIDNET(nid))) continue; if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid))) continue; if (nr->nr_all) return 1; list_for_each_entry(ar, &nr->nr_addrranges, ar_link) - if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid), - &ar->ar_numaddr_ranges)) + if (nf->nf_match_addr(LNET_NIDADDR(nid), + &ar->ar_numaddr_ranges)) return 1; } return 0; @@ -487,13 +491,13 @@ static void cfs_ip_ar_min_max(struct addrrange *ar, __u32 *min_nid, tmp_ip_addr = ((min_ip[0] << 24) | (min_ip[1] << 16) | (min_ip[2] << 8) | min_ip[3]); - if (min_nid != NULL) + if (min_nid) *min_nid = tmp_ip_addr; tmp_ip_addr = ((max_ip[0] << 24) | (max_ip[1] << 16) | (max_ip[2] << 8) | max_ip[3]); - if (max_nid != NULL) + if (max_nid) *max_nid = tmp_ip_addr; } @@ -522,9 +526,9 @@ static void cfs_num_ar_min_max(struct addrrange *ar, __u32 *min_nid, } } - if (min_nid != NULL) + if (min_nid) *min_nid = min_addr; - if (max_nid != NULL) + if (max_nid) *max_nid = max_addr; } @@ -546,7 +550,7 @@ bool cfs_nidrange_is_contiguous(struct list_head *nidlist) list_for_each_entry(nr, nidlist, nr_link) { nf = nr->nr_netstrfns; - if (lndname == NULL) + if (!lndname) lndname = nf->nf_name; if (netnum == -1) netnum = nr->nr_netnum; @@ -556,7 +560,7 @@ bool cfs_nidrange_is_contiguous(struct list_head *nidlist) return false; } - if (nf == NULL) + if (!nf) return false; if (!nf->nf_is_contiguous(nidlist)) @@ -763,9 +767,9 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, } } - if (min_nid != NULL) + if (min_nid) *min_nid = min_ip_addr; - if (max_nid != NULL) + if (max_nid) *max_nid = max_ip_addr; } @@ -784,12 +788,14 @@ libcfs_ip_addr2str(__u32 addr, char *str, size_t size) (addr >> 8) & 0xff, addr & 0xff); } -/* CAVEAT EMPTOR XscanfX +/* + * CAVEAT EMPTOR XscanfX * I use "%n" at the end of a sscanf format to detect trailing junk. However * sscanf may return immediately if it sees the terminating '0' in a string, so * I initialise the %n variable to the expected length. If sscanf sets it; * fine, if it doesn't, then the scan ended at the end of the string, which is - * fine too :) */ + * fine too :) + */ static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) { @@ -804,7 +810,7 @@ libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) n == nob && (a & ~0xff) == 0 && (b & ~0xff) == 0 && (c & ~0xff) == 0 && (d & ~0xff) == 0) { - *addr = ((a<<24)|(b<<16)|(c<<8)|d); + *addr = ((a << 24) | (b << 16) | (c << 8) | d); return 1; } @@ -824,7 +830,7 @@ cfs_ip_addr_parse(char *str, int len, struct list_head *list) src.ls_len = len; i = 0; - while (src.ls_str != NULL) { + while (src.ls_str) { struct cfs_lstr res; if (!cfs_gettok(&src, '.', &res)) { @@ -1060,7 +1066,9 @@ libcfs_name2netstrfns(const char *name) int libcfs_isknown_lnd(__u32 lnd) { - return libcfs_lnd2netstrfns(lnd) != NULL; + struct netstrfns *nf = libcfs_lnd2netstrfns(lnd); + + return nf ? 1 : 0; } EXPORT_SYMBOL(libcfs_isknown_lnd); @@ -1069,7 +1077,7 @@ libcfs_lnd2modname(__u32 lnd) { struct netstrfns *nf = libcfs_lnd2netstrfns(lnd); - return (nf == NULL) ? NULL : nf->nf_modname; + return !nf ? NULL : nf->nf_modname; } EXPORT_SYMBOL(libcfs_lnd2modname); @@ -1078,7 +1086,7 @@ libcfs_str2lnd(const char *str) { struct netstrfns *nf = libcfs_name2netstrfns(str); - if (nf != NULL) + if (nf) return nf->nf_type; return -1; @@ -1091,7 +1099,7 @@ libcfs_lnd2str_r(__u32 lnd, char *buf, size_t buf_size) struct netstrfns *nf; nf = libcfs_lnd2netstrfns(lnd); - if (nf == NULL) + if (!nf) snprintf(buf, buf_size, "?%u?", lnd); else snprintf(buf, buf_size, "%s", nf->nf_name); @@ -1108,7 +1116,7 @@ libcfs_net2str_r(__u32 net, char *buf, size_t buf_size) struct netstrfns *nf; nf = libcfs_lnd2netstrfns(lnd); - if (nf == NULL) + if (!nf) snprintf(buf, buf_size, "<%u:%u>", lnd, nnum); else if (nnum == 0) snprintf(buf, buf_size, "%s", nf->nf_name); @@ -1135,9 +1143,9 @@ libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size) } nf = libcfs_lnd2netstrfns(lnd); - if (nf == NULL) + if (!nf) { snprintf(buf, buf_size, "%x@<%u:%u>", addr, lnd, nnum); - else { + } else { size_t addr_len; nf->nf_addr2str(addr, buf, buf_size); @@ -1195,7 +1203,7 @@ libcfs_str2net(const char *str) { __u32 net; - if (libcfs_str2net_internal(str, &net) != NULL) + if (libcfs_str2net_internal(str, &net)) return net; return LNET_NIDNET(LNET_NID_ANY); @@ -1210,15 +1218,15 @@ libcfs_str2nid(const char *str) __u32 net; __u32 addr; - if (sep != NULL) { + if (sep) { nf = libcfs_str2net_internal(sep + 1, &net); - if (nf == NULL) + if (!nf) return LNET_NID_ANY; } else { sep = str + strlen(str); net = LNET_MKNET(SOCKLND, 0); nf = libcfs_lnd2netstrfns(SOCKLND); - LASSERT(nf != NULL); + LASSERT(nf); } if (!nf->nf_str2addr(str, (int)(sep - str), &addr)) -- 1.7.1 From jsimmons at infradead.org Thu Oct 29 23:28:22 2015 From: jsimmons at infradead.org (James Simmons) Date: Thu, 29 Oct 2015 19:28:22 -0400 Subject: [lustre-devel] [PATCH 2/3] staging: lustre: white space cleanups for nidstring.c In-Reply-To: <1446161303-798-1-git-send-email-jsimmons@infradead.org> References: <1446161303-798-1-git-send-email-jsimmons@infradead.org> Message-ID: <1446161303-798-3-git-send-email-jsimmons@infradead.org> Remove the remaining white spaces in nidstring.c. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/lnet/nidstrings.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index ee04c3b..7df8599 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -799,11 +799,11 @@ libcfs_ip_addr2str(__u32 addr, char *str, size_t size) static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) { - unsigned int a; - unsigned int b; - unsigned int c; - unsigned int d; - int n = nob; /* XscanfX */ + unsigned int a; + unsigned int b; + unsigned int c; + unsigned int d; + int n = nob; /* XscanfX */ /* numeric IP? */ if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 && @@ -902,7 +902,7 @@ libcfs_decnum_addr2str(__u32 addr, char *str, size_t size) static int libcfs_num_str2addr(const char *str, int nob, __u32 *addr) { - int n; + int n; n = nob; if (sscanf(str, "0x%x%n", addr, &n) >= 1 && n == nob) @@ -931,7 +931,7 @@ static int libcfs_num_parse(char *str, int len, struct list_head *list) { struct cfs_expr_list *el; - int rc; + int rc; rc = cfs_expr_list_parse(str, len, 0, MAX_NUMERIC_VALUE, &el); if (rc == 0) @@ -1054,7 +1054,7 @@ libcfs_namenum2netstrfns(const char *name) static struct netstrfns * libcfs_name2netstrfns(const char *name) { - int i; + int i; for (i = 0; i < libcfs_nnetstrfns; i++) if (!strcmp(libcfs_netstrfns[i].nf_name, name)) @@ -1201,7 +1201,7 @@ libcfs_str2net_internal(const char *str, __u32 *net) __u32 libcfs_str2net(const char *str) { - __u32 net; + __u32 net; if (libcfs_str2net_internal(str, &net)) return net; -- 1.7.1 From sudipm.mukherjee at gmail.com Fri Oct 30 07:50:53 2015 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Fri, 30 Oct 2015 13:20:53 +0530 Subject: [lustre-devel] [PATCH 1/3] staging: lustre: checkpatch cleanups for nidstring.c In-Reply-To: <1446161303-798-2-git-send-email-jsimmons@infradead.org> References: <1446161303-798-1-git-send-email-jsimmons@infradead.org> <1446161303-798-2-git-send-email-jsimmons@infradead.org> Message-ID: <20151030075053.GD31483@sudip-pc> On Thu, Oct 29, 2015 at 07:28:21PM -0400, James Simmons wrote: > With nidstring now having the latest fixes we can > now clean up all the remaining checkpatch errors > for nidstring.c. > > Signed-off-by: James Simmons > --- You are doing different types of changes in this patch. Please split them. regards sudip From yoyolu05 at 163.com Fri Oct 30 07:52:20 2015 From: yoyolu05 at 163.com (Youyou Lu) Date: Fri, 30 Oct 2015 15:52:20 +0800 (CST) Subject: [lustre-devel] unsuscribe Message-ID: <1334d4b1.2de0.150b7bba85a.Coremail.yoyolu05@163.com> From gregkh at linuxfoundation.org Fri Oct 30 23:01:48 2015 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Fri, 30 Oct 2015 16:01:48 -0700 Subject: [lustre-devel] [PATCH 1/3] staging: lustre: checkpatch cleanups for nidstring.c In-Reply-To: <1446161303-798-2-git-send-email-jsimmons@infradead.org> References: <1446161303-798-1-git-send-email-jsimmons@infradead.org> <1446161303-798-2-git-send-email-jsimmons@infradead.org> Message-ID: <20151030230148.GB2920@kroah.com> On Thu, Oct 29, 2015 at 07:28:21PM -0400, James Simmons wrote: > With nidstring now having the latest fixes we can > now clean up all the remaining checkpatch errors > for nidstring.c. Please be specific as to exactly what you changed, and break it up into one-patch-per-thing. And no, "fix all checkpatch errors" is not "one thing" thanks, greg k-h