From elfring at users.sourceforge.net Sun Jan 1 16:30:59 2017 From: elfring at users.sourceforge.net (SF Markus Elfring) Date: Sun, 1 Jan 2017 17:30:59 +0100 Subject: [lustre-devel] [PATCH 0/5] staging-Lustre: Fine-tuning for some function implementations Message-ID: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> From: Markus Elfring Date: Sun, 1 Jan 2017 17:10:10 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (5): llite: Use seq_puts() in three functions mgc: Combine two seq_printf() calls into one call in lprocfs_mgc_rd_ir_state() obdclass: Use seq_putc() in four functions obdclass: Combine two seq_printf() calls into one call in lprocfs_rd_state() obdclass: Use seq_puts() in three functions drivers/staging/lustre/lustre/llite/lproc_llite.c | 12 +++++------ drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +---- drivers/staging/lustre/lustre/obdclass/cl_object.c | 8 ++++---- .../lustre/lustre/obdclass/lprocfs_status.c | 23 ++++++++++------------ 4 files changed, 21 insertions(+), 27 deletions(-) -- 2.11.0 From elfring at users.sourceforge.net Sun Jan 1 16:33:51 2017 From: elfring at users.sourceforge.net (SF Markus Elfring) Date: Sun, 1 Jan 2017 17:33:51 +0100 Subject: [lustre-devel] [PATCH 1/5] staging/lustre/llite: Use seq_puts() in three functions In-Reply-To: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> References: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> Message-ID: <6980a3a8-be35-e9a3-fc89-8394d503b80f@users.sourceforge.net> From: Markus Elfring Date: Sun, 1 Jan 2017 15:30:45 +0100 A string which did not contain a data format specification should be put into a sequence. Thus use the corresponding function "seq_puts" so that the data output will be a bit more efficient in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/llite/lproc_llite.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 03682c10fc9e..b195b7eb2883 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -1325,8 +1325,8 @@ static int ll_rw_extents_stats_pp_seq_show(struct seq_file *seq, void *v) ktime_get_real_ts64(&now); if (!sbi->ll_rw_stats_on) { - seq_printf(seq, "disabled\n" - "write anything in this file to activate, then 0 or \"[D/d]isabled\" to deactivate\n"); + seq_puts(seq, "disabled\n" + "write anything in this file to activate, then 0 or \"[D/d]isabled\" to deactivate\n"); return 0; } seq_printf(seq, "snapshot_time: %llu.%09lu (secs.usecs)\n", @@ -1403,8 +1403,8 @@ static int ll_rw_extents_stats_seq_show(struct seq_file *seq, void *v) ktime_get_real_ts64(&now); if (!sbi->ll_rw_stats_on) { - seq_printf(seq, "disabled\n" - "write anything in this file to activate, then 0 or \"[D/d]isabled\" to deactivate\n"); + seq_puts(seq, "disabled\n" + "write anything in this file to activate, then 0 or \"[D/d]isabled\" to deactivate\n"); return 0; } seq_printf(seq, "snapshot_time: %llu.%09lu (secs.usecs)\n", @@ -1583,8 +1583,8 @@ static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v) ktime_get_real_ts64(&now); if (!sbi->ll_rw_stats_on) { - seq_printf(seq, "disabled\n" - "write anything in this file to activate, then 0 or \"[D/d]isabled\" to deactivate\n"); + seq_puts(seq, "disabled\n" + "write anything in this file to activate, then 0 or \"[D/d]isabled\" to deactivate\n"); return 0; } spin_lock(&sbi->ll_process_lock); -- 2.11.0 From elfring at users.sourceforge.net Sun Jan 1 16:35:25 2017 From: elfring at users.sourceforge.net (SF Markus Elfring) Date: Sun, 1 Jan 2017 17:35:25 +0100 Subject: [lustre-devel] [PATCH 2/5] staging/lustre/mgc: Combine two seq_printf() calls into one call in lprocfs_mgc_rd_ir_state() In-Reply-To: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> References: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> Message-ID: <25b07069-c624-cdd4-ca7b-85aaae51e79e@users.sourceforge.net> From: Markus Elfring Date: Sun, 1 Jan 2017 15:40:29 +0100 Some data were printed into a sequence by two separate function calls. Print the same data by a single function call instead. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index b9c522a3c7a4..a6ca48d7e96b 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -460,11 +460,8 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) imp = obd->u.cli.cl_import; ocd = &imp->imp_connect_data; - - seq_printf(m, "imperative_recovery: %s\n", + seq_printf(m, "imperative_recovery: %s\nclient_state:\n", OCD_HAS_FLAG(ocd, IMP_RECOV) ? "ENABLED" : "DISABLED"); - seq_printf(m, "client_state:\n"); - spin_lock(&config_list_lock); list_for_each_entry(cld, &config_llog_list, cld_list_chain) { if (!cld->cld_recover) -- 2.11.0 From elfring at users.sourceforge.net Sun Jan 1 16:37:04 2017 From: elfring at users.sourceforge.net (SF Markus Elfring) Date: Sun, 1 Jan 2017 17:37:04 +0100 Subject: [lustre-devel] [PATCH 3/5] staging/lustre/obdclass: Use seq_putc() in four functions In-Reply-To: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> References: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> Message-ID: From: Markus Elfring Date: Sun, 1 Jan 2017 16:12:23 +0100 A few single characters (line breaks) should be put into a sequence. Thus use the corresponding function "seq_putc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/obdclass/cl_object.c | 4 ++-- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index f5d4e23c64b7..277908d66a89 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -441,7 +441,7 @@ static int cache_stats_print(const struct cache_stats *cs, seq_printf(m, "%6s", " "); for (i = 0; i < CS_NR; i++) seq_printf(m, "%8s", names[i]); - seq_printf(m, "\n"); + seq_putc(m, '\n'); } seq_printf(m, "%5.5s:", cs->cs_name); @@ -516,7 +516,7 @@ locks: ...... ...... ...... ...... ...... [...... ...... ...... ...... ......] atomic_read(&site->cs_pages_state[i])); seq_printf(m, "]\n"); cache_stats_print(&cl_env_stats, m, 0); - seq_printf(m, "\n"); + seq_putc(m, '\n'); return 0; } EXPORT_SYMBOL(cl_site_stats_print); diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 2c99717b0aba..3f6fcab5a1fc 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -878,7 +878,7 @@ int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at) for (i = 0; i < AT_BINS; i++) seq_printf(m, "%3u ", at->at_hist[i]); - seq_printf(m, "\n"); + seq_putc(m, '\n'); return 0; } EXPORT_SYMBOL(lprocfs_at_hist_helper); @@ -946,7 +946,7 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data) flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags; seq_printf(m, "flags=%#llx\n", flags); obd_connect_seq_flags2str(m, flags, "\n"); - seq_printf(m, "\n"); + seq_putc(m, '\n'); up_read(&obd->u.cli.cl_sem); return 0; } -- 2.11.0 From elfring at users.sourceforge.net Sun Jan 1 16:38:21 2017 From: elfring at users.sourceforge.net (SF Markus Elfring) Date: Sun, 1 Jan 2017 17:38:21 +0100 Subject: [lustre-devel] [PATCH 4/5] staging/lustre/obdclass: Combine two seq_printf() calls into one call in lprocfs_rd_state() In-Reply-To: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> References: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> Message-ID: <92ca443f-4791-f291-e2ea-5e67e3a846ac@users.sourceforge.net> From: Markus Elfring Date: Sun, 1 Jan 2017 16:26:36 +0100 Some data were printed into a sequence by two separate function calls. Print the same data by a single function call instead. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 3f6fcab5a1fc..a167cbe8a50e 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -853,10 +853,8 @@ int lprocfs_rd_state(struct seq_file *m, void *data) return rc; imp = obd->u.cli.cl_import; - - seq_printf(m, "current_state: %s\n", + seq_printf(m, "current_state: %s\nstate_history:\n", ptlrpc_import_state_name(imp->imp_state)); - seq_printf(m, "state_history:\n"); k = imp->imp_state_hist_idx; for (j = 0; j < IMP_STATE_HIST_LEN; j++) { struct import_state_hist *ish = -- 2.11.0 From elfring at users.sourceforge.net Sun Jan 1 16:40:05 2017 From: elfring at users.sourceforge.net (SF Markus Elfring) Date: Sun, 1 Jan 2017 17:40:05 +0100 Subject: [lustre-devel] [PATCH 5/5] staging/lustre/obdclass: Use seq_puts() in three functions In-Reply-To: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> References: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> Message-ID: <8d8a448c-4648-2b52-ab88-d3145f6be804@users.sourceforge.net> From: Markus Elfring Date: Sun, 1 Jan 2017 16:45:32 +0100 A string which did not contain a data format specification should be put into a sequence. Thus use the corresponding function "seq_puts" so that the data output will be a bit more efficient in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/obdclass/cl_object.c | 4 ++-- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index 277908d66a89..3e00aa4747b8 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -510,11 +510,11 @@ locks: ...... ...... ...... ...... ...... [...... ...... ...... ...... ......] */ lu_site_stats_print(&site->cs_lu, m); cache_stats_print(&site->cs_pages, m, 1); - seq_printf(m, " ["); + seq_puts(m, " ["); for (i = 0; i < ARRAY_SIZE(site->cs_pages_state); ++i) seq_printf(m, "%s: %u ", pstate[i], atomic_read(&site->cs_pages_state[i])); - seq_printf(m, "]\n"); + seq_puts(m, "]\n"); cache_stats_print(&cl_env_stats, m, 0); seq_putc(m, '\n'); return 0; diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index a167cbe8a50e..3ce590cdd957 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -649,7 +649,7 @@ static int obd_import_flags2str(struct obd_import *imp, struct seq_file *m) bool first = true; if (imp->imp_obd->obd_no_recov) { - seq_printf(m, "no_recov"); + seq_puts(m, "no_recov"); first = false; } @@ -715,15 +715,14 @@ int lprocfs_rd_import(struct seq_file *m, void *data) imp->imp_connect_data.ocd_instance); obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags, ", "); - seq_printf(m, " ]\n"); + seq_puts(m, " ]\n"); obd_connect_data_seqprint(m, ocd); - seq_printf(m, " import_flags: [ "); + seq_puts(m, " import_flags: [ "); obd_import_flags2str(imp, m); - - seq_printf(m, - " ]\n" - " connection:\n" - " failover_nids: [ "); + seq_puts(m, + " ]\n" + " connection:\n" + " failover_nids: [ "); spin_lock(&imp->imp_lock); j = 0; list_for_each_entry(conn, &imp->imp_conn_list, oic_item) { -- 2.11.0 From gregkh at linuxfoundation.org Tue Jan 3 14:05:10 2017 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 3 Jan 2017 15:05:10 +0100 Subject: [lustre-devel] [PATCH] staging: lustre: selftest: Make brw_inject_one_error() static In-Reply-To: <20161223154244.29145-1-Karthik.188@gmail.com> References: <20161223154244.29145-1-Karthik.188@gmail.com> Message-ID: <20170103140510.GA24530@kroah.com> On Fri, Dec 23, 2016 at 09:12:44PM +0530, Karthik Nayak wrote: > Since the function brw_inject_one_error() is used only within > brw_test.c, make it static. This was reported as a warning by sparse. > > Signed-off-by: Karthik Nayak > --- > drivers/staging/lustre/lnet/selftest/brw_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Someone else sent this same patch before you did, sorry :( From gregkh at linuxfoundation.org Tue Jan 3 14:12:48 2017 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Tue, 3 Jan 2017 15:12:48 +0100 Subject: [lustre-devel] [PATCH] staging: lustre: headers: potential UAPI headers In-Reply-To: <1482167207-22800-1-git-send-email-jsimmons@infradead.org> References: <1482167207-22800-1-git-send-email-jsimmons@infradead.org> Message-ID: <20170103141248.GA8695@kroah.com> On Mon, Dec 19, 2016 at 12:06:47PM -0500, James Simmons wrote: > Not for landing. This is the purposed UAPI headers > with the removal of unlikely and debugging macros. > This is just for feedback to see if this is acceptable > for the upstream client. > > Signed-off-by: James Simmons > --- > .../lustre/lustre/include/lustre/lustre_fid.h | 353 +++++++++++++++++++++ > .../lustre/lustre/include/lustre/lustre_ostid.h | 233 ++++++++++++++ Can you make a lustre "uapi" directory so we can see which files you really want to be UAPI and which you don't as time goes on? > 2 files changed, 586 insertions(+) > create mode 100644 drivers/staging/lustre/lustre/include/lustre/lustre_fid.h > create mode 100644 drivers/staging/lustre/lustre/include/lustre/lustre_ostid.h > > diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre/lustre_fid.h > new file mode 100644 > index 0000000..cb6afa5 > --- /dev/null > +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_fid.h > @@ -0,0 +1,353 @@ > +/* > + * 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) 2007, 2010, Oracle and/or its affiliates. All rights reserved. > + * Use is subject to license terms. > + * > + * Copyright (c) 2011, 2014, Intel Corporation. > + * > + * Copyright 2016 Cray Inc, all rights reserved. > + * Author: Ben Evans. > + * > + * all fid manipulation functions go here > + * > + * FIDS are globally unique within a Lustre filessytem, and are made up > + * of three parts: sequence, Object ID, and version. > + * > + */ > +#ifndef _LUSTRE_LUSTRE_FID_H_ > +#define _LUSTRE_LUSTRE_FID_H_ > + > +#include > + > +/** returns fid object sequence */ > +static inline __u64 fid_seq(const struct lu_fid *fid) > +{ > + return fid->f_seq; > +} > + > +/** returns fid object id */ > +static inline __u32 fid_oid(const struct lu_fid *fid) > +{ > + return fid->f_oid; > +} > + > +/** returns fid object version */ > +static inline __u32 fid_ver(const struct lu_fid *fid) > +{ > + return fid->f_ver; > +} > + > +static inline void fid_zero(struct lu_fid *fid) > +{ > + memset(fid, 0, sizeof(*fid)); > +} > + > +static inline __u64 fid_ver_oid(const struct lu_fid *fid) > +{ > + return (__u64)fid_ver(fid) << 32 | fid_oid(fid); > +} > + > +static inline bool fid_seq_is_mdt0(__u64 seq) > +{ > + return seq == FID_SEQ_OST_MDT0; > +} > + > +static inline bool fid_seq_is_mdt(__u64 seq) > +{ > + return seq == FID_SEQ_OST_MDT0 || seq >= FID_SEQ_NORMAL; > +}; > + > +static inline bool fid_seq_is_echo(__u64 seq) > +{ > + return seq == FID_SEQ_ECHO; > +} > + > +static inline bool fid_is_echo(const struct lu_fid *fid) > +{ > + return fid_seq_is_echo(fid_seq(fid)); > +} > + > +static inline bool fid_seq_is_llog(__u64 seq) > +{ > + return seq == FID_SEQ_LLOG; > +} > + > +static inline bool fid_is_llog(const struct lu_fid *fid) > +{ > + /* file with OID == 0 is not llog but contains last oid */ > + return fid_seq_is_llog(fid_seq(fid)) && fid_oid(fid) > 0; > +} > + > +static inline bool fid_seq_is_rsvd(__u64 seq) > +{ > + return seq > FID_SEQ_OST_MDT0 && seq <= FID_SEQ_RSVD; > +}; > + > +static inline bool fid_seq_is_special(__u64 seq) > +{ > + return seq == FID_SEQ_SPECIAL; > +}; > + > +static inline bool fid_seq_is_local_file(__u64 seq) > +{ > + return seq == FID_SEQ_LOCAL_FILE || > + seq == FID_SEQ_LOCAL_NAME; > +}; > + > +static inline bool fid_seq_is_root(__u64 seq) > +{ > + return seq == FID_SEQ_ROOT; > +} > + > +static inline bool fid_seq_is_dot(__u64 seq) > +{ > + return seq == FID_SEQ_DOT_LUSTRE; > +} > + > +static inline bool fid_seq_is_default(__u64 seq) > +{ > + return seq == FID_SEQ_LOV_DEFAULT; > +} > + > +static inline bool fid_is_mdt0(const struct lu_fid *fid) > +{ > + return fid_seq_is_mdt0(fid_seq(fid)); > +} > + > +static inline void lu_root_fid(struct lu_fid *fid) > +{ > + fid->f_seq = FID_SEQ_ROOT; > + fid->f_oid = FID_OID_ROOT; > + fid->f_ver = 0; > +} > + > +static inline void lu_echo_root_fid(struct lu_fid *fid) > +{ > + fid->f_seq = FID_SEQ_ROOT; > + fid->f_oid = FID_OID_ECHO_ROOT; > + fid->f_ver = 0; > +} > + > +static inline void lu_update_log_fid(struct lu_fid *fid, __u32 index) > +{ > + fid->f_seq = FID_SEQ_UPDATE_LOG; > + fid->f_oid = index; > + fid->f_ver = 0; > +} > + > +static inline void lu_update_log_dir_fid(struct lu_fid *fid, __u32 index) > +{ > + fid->f_seq = FID_SEQ_UPDATE_LOG_DIR; > + fid->f_oid = index; > + fid->f_ver = 0; > +} > + > +/** > + * Check if a fid is igif or not. > + * \param fid the fid to be tested. > + * \return true if the fid is an igif; otherwise false. > + */ > +static inline bool fid_seq_is_igif(__u64 seq) > +{ > + return seq >= FID_SEQ_IGIF && seq <= FID_SEQ_IGIF_MAX; > +} > + > +static inline bool fid_is_igif(const struct lu_fid *fid) > +{ > + return fid_seq_is_igif(fid_seq(fid)); > +} > + > +/** > + * Check if a fid is idif or not. > + * \param fid the fid to be tested. > + * \return true if the fid is an idif; otherwise false. Odd kernel doc style :( > + */ > +static inline bool fid_seq_is_idif(__u64 seq) > +{ > + return seq >= FID_SEQ_IDIF && seq <= FID_SEQ_IDIF_MAX; > +} > + > +static inline bool fid_is_idif(const struct lu_fid *fid) > +{ > + return fid_seq_is_idif(fid_seq(fid)); > +} > + > +static inline bool fid_is_local_file(const struct lu_fid *fid) > +{ > + return fid_seq_is_local_file(fid_seq(fid)); > +} > + > +static inline bool fid_seq_is_norm(__u64 seq) > +{ > + return (seq >= FID_SEQ_NORMAL); > +} > + > +static inline bool fid_is_norm(const struct lu_fid *fid) > +{ > + return fid_seq_is_norm(fid_seq(fid)); > +} > + > +static inline int fid_is_layout_rbtree(const struct lu_fid *fid) > +{ > + return fid_seq(fid) == FID_SEQ_LAYOUT_RBTREE; > +} bool? thanks, greg k-h From gregkh at linuxfoundation.org Tue Jan 3 14:15:28 2017 From: gregkh at linuxfoundation.org (Greg KH) Date: Tue, 3 Jan 2017 15:15:28 +0100 Subject: [lustre-devel] [PATCH] staging : lustre : Remove braces from single-line body. In-Reply-To: <1482934209-10857-1-git-send-email-khan.tabrez21@gmail.com> References: <1482934209-10857-1-git-send-email-khan.tabrez21@gmail.com> Message-ID: <20170103141528.GA10415@kroah.com> On Wed, Dec 28, 2016 at 07:40:09PM +0530, Tabrez khan wrote: > Remove unnecessary braces from single-line if statement. > This warning is found using checkpatch.pl. > > Signed-off-by: Tabrez khan > --- > drivers/staging/lustre/lustre/ptlrpc/import.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) You have sent me 5 patches, with 4 of them having duplicated subject lines, yet they do different things. Also, what order am I supposed to apply these patches in? Please resend them as a patch series, properly numbered, and with unique subjects. thanks, greg k-h From dinatale2 at llnl.gov Thu Jan 5 00:16:42 2017 From: dinatale2 at llnl.gov (Di Natale, Giuseppe) Date: Thu, 5 Jan 2017 00:16:42 +0000 Subject: [lustre-devel] (no subject) Message-ID: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> Greetings, I am attempting to port the SysV lnet script as part of a transition to systemd. I ran into the following in lustre/scripts/lnet: if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f "$LUSTRE_LNET_CONFIG_FILE" ]; then $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 else lctl network up || exit 1 fi Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by default) be removed so that way lnetctl is used exclusively? Thanks, Giuseppe Di Natale -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Thu Jan 5 01:36:09 2017 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Wed, 4 Jan 2017 17:36:09 -0800 Subject: [lustre-devel] LUSTRE_LNET_CONFIG_UTILITY in lnet SysV script In-Reply-To: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> Message-ID: <1ea178df-8afa-135a-3bde-a2e7b7fc5e12@llnl.gov> lnetctl is currently an optional build, and its build is not even enabled by default in the lustre spec file. To use lnetctl exclusively, we would need lnetctl's build would need to be unconditional. I don't have a problem with making the lnetctl build unconditional. I'm not sure why it was done that way. Perhaps someone else can comment on that. When/if lnetctl is built unconditionally, it would be nice to purge the "DLC" terminology from the code. Chris On 01/04/2017 04:16 PM, Di Natale, Giuseppe wrote: > Greetings, > > I am attempting to port the SysV lnet script as part of a transition to > systemd. I ran into the following in lustre/scripts/lnet: > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > "$LUSTRE_LNET_CONFIG_FILE" ]; then > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > else > lctl network up || exit 1 > fi > > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by > default) be removed so that way lnetctl is used exclusively? > > Thanks, > Giuseppe Di Natale > > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From anna.fuchs at informatik.uni-hamburg.de Mon Jan 9 13:07:38 2017 From: anna.fuchs at informatik.uni-hamburg.de (Anna Fuchs) Date: Mon, 09 Jan 2017 14:07:38 +0100 Subject: [lustre-devel] Design proposal for client-side compression Message-ID: <1483967258.2622.24.camel@informatik.uni-hamburg.de> Dear all,  a couple of months ago we started the IPCC-L project about compression within Lustre [0]. Currently we are focusing on client-side compression and I would like to present you our plans and discuss them. Any comments are very welcome. General design:  The feature will introduce transparent compression within the Lustre filesystem on the client and server side (in the future). Due to existing infrastructure for compressed blocks within the ZFS backend filesystem, at first, only ZFS will be supported. ldiskfs as backend is not principally discarded, though it requires wide-ranging changes of its infrastructure which might follow once the workflow is proven. All communication between the MDS and any other components remains uncompressed. That means, metadata will not be compressed at any time. The client will compress the data per stripe, while every stripe is divided into chunks based on the ZFS record size. Those chunks can be compressed independently and in parallel. To be able to decompress the data later we need to store the algorithm type and the original chunk size. We want to store it per chunk/record for several reasons. When decompressing, we need to know the required buffer size for the uncompressed piece of data. Moreover, later it will be possible to have different chunk sizes within one stripe and use different algorithms for every chunk. The storing of that additional metadata is up to ZFS and will not affect the MDS.  The compressed stripes will go to the Lustre server including the metadata within the RPC. The server, at first, will just pass the data to ZFS. ZFS for its part will make use of its internal data structure, which already handles compressed blocks. The pre-compressed blocks will be stored within the trees like they have been compressed by ZFS itself. We expect ZFS then to achieve better read-ahead performance as if storing the data like common data blocks (which would produce "holes" within the file). Since ZFS has knowledge about the original data bounds, it can iterate over the records like they were logically contiguous. Implementation details:  We need to make changes on the Lustre client, server, RPC protocol and ZFS backend. Client:  We thought to introduce the changes close to GSS within the PtlRPC layer. In the future, the infrastructure might be reused for client-side encryption also. All the infrastructure changes are independent from specific compression algorithms, except for the requirement that the data size does not grow. It will be possible to change the algorithms; the missing libraries would be deployed and built together with Lustre code if the specific kernel does not support them.  There is a wrapping layer sptlrpc (standing for security ptlrpc?). Analogously, we could introduce a cptlrpc (for compression) or just put both together in a tptlrpc (transform) layer. We would also like to reuse the bd_enc_vec structures for compressed bulk data. What do you think about that? RPC:  We would extend the niobuf_remote structure with the logical size and the algorithm type. Each compressed record would be a separate niobuf. We first had the idea to reuse the free bits of the flavor flag to mask the algorithm type, though we need it per niobuf, but the flavor is per RPC. The read/write RPC with patched niobufs arrives at the server and it can then get the data in the correct amount to pass it through to ZFS.  ZFS: Newest ZFS features include compressed send and receive operations to stream data in compressed form and save CPU efforts. During the course of these changes, the ZFS-to-Lustre interface will be extended by additional parameters lsize and the algorithm type needed for decompression. lsize is the logical size which is the original, uncompressed, user written data size. In contrast the physical size is the actual compressed data size. The current interface will coexist and is not going to be fully exchanged by the extended one to save the ability to write/read data unaffected by compression. Those changes affect at least the two I/O paths "dmu_write" and "dmu_assign_arcbuf".  At first, the use of ZFS’s internal compression will be skipped and possible only with disabled Lustre compression. Though a possible feature is to enable ZFS to decompress the data so that one could access data without Lustre. [0] https://software.intel.com/articles/intel-parallel-computing-center -at-university-of-hamburg-scientific-computing Best regards, Anna --  Anna Fuchs https://wr.informatik.uni-hamburg.de/people/anna_fuchs From jinshan.xiong at intel.com Mon Jan 9 18:05:16 2017 From: jinshan.xiong at intel.com (Xiong, Jinshan) Date: Mon, 9 Jan 2017 18:05:16 +0000 Subject: [lustre-devel] Design proposal for client-side compression In-Reply-To: <1483967258.2622.24.camel@informatik.uni-hamburg.de> References: <1483967258.2622.24.camel@informatik.uni-hamburg.de> Message-ID: Hi Anna, I assume the purpose of this proposal is to fully utilize the CPU cycles on the client nodes to compress and decompress data, because there are much more client nodes than server nodes. After data is compressed, it will need less network bandwidth to transfer it to server and write them back to storage. There would be more changes to implement this feature: 1. I guess dmu_read() needs change as well to transfer compressed data back to client, otherwise how it would improve readahead performance. Please let me know if I overlooked something; 2. read-modify-write on client chunks - if only partial chunk is modified on the client side, the OSC will have to read the chunk back, uncompress it, and modify the data in chunk, and compress it again to get ready for write back. We may have to maintain a separate chunk cache on the OSC layer; 3. the OST should grant LDLM lock to align with ZFS block size otherwise it will be very complex if the OSC has to request locks to do RMW; 4. OSD-ZFS can dynamically extend the block size by the write pattern, so we need to disable it to accommodate this feature; 5. ZFS has supported a new feature called compressed ARC. If clients are already provided compressed data, probably we can get rid of dmu buffer and fulfill the ARC buffer with compressed data directly, but I don’t know much work it would need on ZFS side. Thanks, Jinshan > On Jan 9, 2017, at 5:07 AM, Anna Fuchs wrote: > > Dear all, > > a couple of months ago we started the IPCC-L project about compression > within Lustre [0]. Currently we are focusing on client-side compression > and I would like to present you our plans and discuss them. Any > comments are very welcome. > > General design: > > The feature will introduce transparent compression within the Lustre > filesystem on the client and server side (in the future). > Due to existing infrastructure for compressed blocks within the ZFS > backend filesystem, at first, only ZFS will be supported. ldiskfs as > backend is not principally discarded, though it requires wide-ranging > changes of its infrastructure which might follow once the workflow is > proven. All communication between the MDS and any other components > remains uncompressed. That means, metadata will not be compressed at > any time. > > The client will compress the data per stripe, while every stripe is > divided into chunks based on the ZFS record size. Those chunks can be > compressed independently and in parallel. > To be able to decompress the data later we need to store the algorithm > type and the original chunk size. We want to store it per chunk/record > for several reasons. When decompressing, we need to know the required > buffer size for the uncompressed piece of data. Moreover, later it will > be possible to have different chunk sizes within one stripe and use > different algorithms for every chunk. The storing of that additional > metadata is up to ZFS and will not affect the MDS. > > The compressed stripes will go to the Lustre server including the > metadata within the RPC. The server, at first, will just pass the data > to ZFS. ZFS for its part will make use of its internal data structure, > which already handles compressed blocks. The pre-compressed blocks will > be stored within the trees like they have been compressed by ZFS > itself. We expect ZFS then to achieve better read-ahead performance as > if storing the data like common data blocks (which would produce > "holes" within the file). Since ZFS has knowledge about the original > data bounds, it can iterate over the records like they were logically > contiguous. > > Implementation details: > > We need to make changes on the Lustre client, server, RPC protocol and > ZFS backend. > > Client: > > We thought to introduce the changes close to GSS within the PtlRPC > layer. > In the future, the infrastructure might be reused for client-side > encryption also. All the infrastructure changes are independent from > specific compression algorithms, except for the requirement that the > data size does not grow. It will be possible to change the algorithms; > the missing libraries would be deployed and built together with Lustre > code if the specific kernel does not support them. > There is a wrapping layer sptlrpc (standing for security ptlrpc?). > Analogously, we could introduce a cptlrpc (for compression) or just put > both together in a tptlrpc (transform) layer. > > We would also like to reuse the bd_enc_vec structures for compressed > bulk data. What do you think about that? > > RPC: > > We would extend the niobuf_remote structure with the logical size and > the algorithm type. Each compressed record would be a separate niobuf. > We first had the idea to reuse the free bits of the flavor flag to mask > the algorithm type, though we need it per niobuf, but the flavor is per > RPC. The read/write RPC with patched niobufs arrives at the server and > it can then get the data in the correct amount to pass it through to > ZFS. > > > ZFS: > > Newest ZFS features include compressed send and receive operations to > stream data in compressed form and save CPU efforts. During the course > of these changes, the ZFS-to-Lustre interface will be extended by > additional parameters lsize and the algorithm type needed for > decompression. lsize is the logical size which is the original, > uncompressed, user written data size. In contrast the physical size is > the actual compressed data size. > The current interface will coexist and is not going to be fully > exchanged by the extended one to save the ability to write/read data > unaffected by compression. Those changes affect at least the two I/O > paths "dmu_write" and "dmu_assign_arcbuf". > > At first, the use of ZFS’s internal compression will be skipped and > possible only with disabled Lustre compression. Though a possible > feature is to enable ZFS to decompress the data so that one could > access data without Lustre. > > > [0] https://software.intel.com/articles/intel-parallel-computing-center > -at-university-of-hamburg-scientific-computing > > > Best regards, > Anna > > > -- > Anna Fuchs > https://wr.informatik.uni-hamburg.de/people/anna_fuchs > From amir.shehata.whamcloud at gmail.com Tue Jan 10 20:15:31 2017 From: amir.shehata.whamcloud at gmail.com (Amir Shehata) Date: Tue, 10 Jan 2017 12:15:31 -0800 Subject: [lustre-devel] (no subject) In-Reply-To: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> Message-ID: lctl usage is kept for backwards compatibility. Eventually, we should be moving to using lnetctl exclusively. Which lustre-release we should do that in, is the question. 2.10? thanks amir On 4 January 2017 at 16:16, Di Natale, Giuseppe wrote: > Greetings, > > I am attempting to port the SysV lnet script as part of a transition to > systemd. I ran into the following in lustre/scripts/lnet: > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > "$LUSTRE_LNET_CONFIG_FILE" ]; then > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > else > lctl network up || exit 1 > fi > > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by > default) be removed so that way lnetctl is used exclusively? > > Thanks, > Giuseppe Di Natale > > _______________________________________________ > 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 amir.shehata.whamcloud at gmail.com Tue Jan 10 20:17:52 2017 From: amir.shehata.whamcloud at gmail.com (Amir Shehata) Date: Tue, 10 Jan 2017 12:17:52 -0800 Subject: [lustre-devel] LUSTRE_LNET_CONFIG_UTILITY in lnet SysV script In-Reply-To: <1ea178df-8afa-135a-3bde-a2e7b7fc5e12@llnl.gov> References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <1ea178df-8afa-135a-3bde-a2e7b7fc5e12@llnl.gov> Message-ID: The reason it is conditional is because we use 3rd party library for YAML parsing. If this is not installed on the build system, then we wouldn't be building lnetctl in that scenario. I agree that we should be removing DLC terminology from the code. thanks amir On 4 January 2017 at 17:36, Christopher J. Morrone wrote: > lnetctl is currently an optional build, and its build is not even > enabled by default in the lustre spec file. To use lnetctl exclusively, > we would need lnetctl's build would need to be unconditional. > > I don't have a problem with making the lnetctl build unconditional. I'm > not sure why it was done that way. Perhaps someone else can comment on > that. > > When/if lnetctl is built unconditionally, it would be nice to purge the > "DLC" terminology from the code. > > Chris > > On 01/04/2017 04:16 PM, Di Natale, Giuseppe wrote: > > Greetings, > > > > I am attempting to port the SysV lnet script as part of a transition to > > systemd. I ran into the following in lustre/scripts/lnet: > > > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > > "$LUSTRE_LNET_CONFIG_FILE" ]; then > > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > > else > > lctl network up || exit 1 > > fi > > > > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by > > default) be removed so that way lnetctl is used exclusively? > > > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amir.shehata.whamcloud at gmail.com Tue Jan 10 20:46:34 2017 From: amir.shehata.whamcloud at gmail.com (Amir Shehata) Date: Tue, 10 Jan 2017 12:46:34 -0800 Subject: [lustre-devel] LUSTRE_LNET_CONFIG_UTILITY in lnet SysV script In-Reply-To: References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <1ea178df-8afa-135a-3bde-a2e7b7fc5e12@llnl.gov> Message-ID: We can probably make these YAML parsing libraries mandatory and checked in the configuration step. If not there the build doesn't move forward until they are installed. The libraries will also need to be installed on the nodes which Lustre is deployed on. On 10 January 2017 at 12:17, Amir Shehata wrote: > The reason it is conditional is because we use 3rd party library for YAML > parsing. If this is not installed on the build system, then we wouldn't be > building lnetctl in that scenario. > > I agree that we should be removing DLC terminology from the code. > > thanks > amir > > On 4 January 2017 at 17:36, Christopher J. Morrone > wrote: > >> lnetctl is currently an optional build, and its build is not even >> enabled by default in the lustre spec file. To use lnetctl exclusively, >> we would need lnetctl's build would need to be unconditional. >> >> I don't have a problem with making the lnetctl build unconditional. I'm >> not sure why it was done that way. Perhaps someone else can comment on >> that. >> >> When/if lnetctl is built unconditionally, it would be nice to purge the >> "DLC" terminology from the code. >> >> Chris >> >> On 01/04/2017 04:16 PM, Di Natale, Giuseppe wrote: >> > Greetings, >> > >> > I am attempting to port the SysV lnet script as part of a transition to >> > systemd. I ran into the following in lustre/scripts/lnet: >> > >> > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f >> > "$LUSTRE_LNET_CONFIG_FILE" ]; then >> > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 >> > else >> > lctl network up || exit 1 >> > fi >> > >> > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by >> > default) be removed so that way lnetctl is used exclusively? >> > >> > 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 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Tue Jan 10 22:04:30 2017 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Tue, 10 Jan 2017 14:04:30 -0800 Subject: [lustre-devel] LUSTRE_LNET_CONFIG_UTILITY in lnet SysV script In-Reply-To: References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <1ea178df-8afa-135a-3bde-a2e7b7fc5e12@llnl.gov> Message-ID: <3730cee1-6aa3-af11-84a5-d78f0ac62efa@llnl.gov> Exactly. On 01/10/2017 12:46 PM, Amir Shehata wrote: > We can probably make these YAML parsing libraries mandatory and checked > in the configuration step. If not there the build doesn't move forward > until they are installed. The libraries will also need to be installed > on the nodes which Lustre is deployed on. > > On 10 January 2017 at 12:17, Amir Shehata > > wrote: > > The reason it is conditional is because we use 3rd party library for > YAML parsing. If this is not installed on the build system, then we > wouldn't be building lnetctl in that scenario. > > I agree that we should be removing DLC terminology from the code. > > thanks > amir > > On 4 January 2017 at 17:36, Christopher J. Morrone > > wrote: > > lnetctl is currently an optional build, and its build is not even > enabled by default in the lustre spec file. To use lnetctl > exclusively, > we would need lnetctl's build would need to be unconditional. > > I don't have a problem with making the lnetctl build > unconditional. I'm > not sure why it was done that way. Perhaps someone else can > comment on > that. > > When/if lnetctl is built unconditionally, it would be nice to > purge the > "DLC" terminology from the code. > > Chris > > On 01/04/2017 04:16 PM, Di Natale, Giuseppe wrote: > > Greetings, > > > > I am attempting to port the SysV lnet script as part of a > transition to > > systemd. I ran into the following in lustre/scripts/lnet: > > > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > > "$LUSTRE_LNET_CONFIG_FILE" ]; then > > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || > exit 1 > > else > > lctl network up || exit 1 > > fi > > > > Can the check for LUSTRE_LNET_CONFIG_UTILITY > (/usr/sbin/lnetctl by > > default) be removed so that way lnetctl is used exclusively? > > > > 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 > > > > From morrone2 at llnl.gov Tue Jan 10 22:06:10 2017 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Tue, 10 Jan 2017 14:06:10 -0800 Subject: [lustre-devel] (no subject) In-Reply-To: References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> Message-ID: <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> Sounds good to me. Ideally, lnetctl should be able to do everything that lctl could do (plus all of the new features). Has it reached parity? If not, what else still remains to be done? Chris On 01/10/2017 12:15 PM, Amir Shehata wrote: > lctl usage is kept for backwards compatibility. Eventually, we should be > moving to using lnetctl exclusively. Which lustre-release we should do > that in, is the question. 2.10? > > thanks > amir > > On 4 January 2017 at 16:16, Di Natale, Giuseppe > wrote: > > Greetings, > > I am attempting to port the SysV lnet script as part of a transition > to systemd. I ran into the following in lustre/scripts/lnet: > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > "$LUSTRE_LNET_CONFIG_FILE" ]; then > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > else > lctl network up || exit 1 > fi > > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by > default) be removed so that way lnetctl is used exclusively? > > 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 > From amir.shehata.whamcloud at gmail.com Wed Jan 11 01:08:50 2017 From: amir.shehata.whamcloud at gmail.com (Amir Shehata) Date: Tue, 10 Jan 2017 17:08:50 -0800 Subject: [lustre-devel] (no subject) In-Reply-To: <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> Message-ID: lnetctl was designed to control LNet only. We have not moved the rest of the lctl functionality. lctl does a lot of other lustre specific functions. The idea was to have lnetctl be only LNet specific, and lctl lustre specific. In essence we are attempting to decouple LNet from lustre. There has been some talk about upstreaming LNet before lustre with all the work that James Simmons from ORNL is doing. thanks amir On 10 January 2017 at 14:06, Christopher J. Morrone wrote: > Sounds good to me. Ideally, lnetctl should be able to do everything > that lctl could do (plus all of the new features). Has it reached > parity? If not, what else still remains to be done? > > Chris > > On 01/10/2017 12:15 PM, Amir Shehata wrote: > > lctl usage is kept for backwards compatibility. Eventually, we should be > > moving to using lnetctl exclusively. Which lustre-release we should do > > that in, is the question. 2.10? > > > > thanks > > amir > > > > On 4 January 2017 at 16:16, Di Natale, Giuseppe > > wrote: > > > > Greetings, > > > > I am attempting to port the SysV lnet script as part of a transition > > to systemd. I ran into the following in lustre/scripts/lnet: > > > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > > "$LUSTRE_LNET_CONFIG_FILE" ]; then > > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > > else > > lctl network up || exit 1 > > fi > > > > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by > > default) be removed so that way lnetctl is used exclusively? > > > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.dilger at intel.com Wed Jan 11 04:18:13 2017 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Wed, 11 Jan 2017 04:18:13 +0000 Subject: [lustre-devel] (no subject) In-Reply-To: References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> Message-ID: <30DCC240-3E47-4A2B-8C7B-B46D165C2127@intel.com> It's fine to add the lnet-specific functionality from lctl to lnetctl, but we shouldn't remove existing functionality from lctl to avoid breaking scripts that may be using it today. 4+ releases after all of the LNet specific lctl functionality has been added to lnetctl we can start printing deprecation warnings, and after 8+ releases they can be removed. Cheers, Andreas -- Andreas Dilger Lustre Principal Architect Intel High Performance Data Division On 2017/01/10, 18:08, "lustre-devel on behalf of Amir Shehata" on behalf of amir.shehata.whamcloud at gmail.com> wrote: lnetctl was designed to control LNet only. We have not moved the rest of the lctl functionality. lctl does a lot of other lustre specific functions. The idea was to have lnetctl be only LNet specific, and lctl lustre specific. In essence we are attempting to decouple LNet from lustre. There has been some talk about upstreaming LNet before lustre with all the work that James Simmons from ORNL is doing. thanks amir On 10 January 2017 at 14:06, Christopher J. Morrone > wrote: Sounds good to me. Ideally, lnetctl should be able to do everything that lctl could do (plus all of the new features). Has it reached parity? If not, what else still remains to be done? Chris On 01/10/2017 12:15 PM, Amir Shehata wrote: > lctl usage is kept for backwards compatibility. Eventually, we should be > moving to using lnetctl exclusively. Which lustre-release we should do > that in, is the question. 2.10? > > thanks > amir > > On 4 January 2017 at 16:16, Di Natale, Giuseppe > >> wrote: > > Greetings, > > I am attempting to port the SysV lnet script as part of a transition > to systemd. I ran into the following in lustre/scripts/lnet: > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > "$LUSTRE_LNET_CONFIG_FILE" ]; then > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > else > lctl network up || exit 1 > fi > > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by > default) be removed so that way lnetctl is used exclusively? > > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From morrone2 at llnl.gov Wed Jan 11 23:20:39 2017 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Wed, 11 Jan 2017 15:20:39 -0800 Subject: [lustre-devel] (no subject) In-Reply-To: <30DCC240-3E47-4A2B-8C7B-B46D165C2127@intel.com> References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> <30DCC240-3E47-4A2B-8C7B-B46D165C2127@intel.com> Message-ID: <34fdf36d-b7d2-4a50-9656-dd720d805d31@llnl.gov> Right, I meant copy in lnet-specific functionality from lctl to lnetctl. I didn't mean to sound like I was suggesting moving the rest of lctl's non-lnet parts into lnetctl. Chris On 01/10/2017 08:18 PM, Dilger, Andreas wrote: > It's fine to add the lnet-specific functionality from lctl to lnetctl, > but we shouldn't remove existing functionality from lctl to avoid > breaking scripts that may be using it today. 4+ releases after all of > the LNet specific lctl functionality has been added to lnetctl we can > start printing deprecation warnings, and after 8+ releases they can be > removed. > > > > Cheers, Andreas > > -- > > Andreas Dilger > > Lustre Principal Architect > > Intel High Performance Data Division > > > > On 2017/01/10, 18:08, "lustre-devel on behalf of Amir Shehata" > on behalf of > amir.shehata.whamcloud at gmail.com > > wrote: > > > > lnetctl was designed to control LNet only. We have not moved the rest of > the lctl functionality. lctl does a lot of other lustre specific functions. > > > > The idea was to have lnetctl be only LNet specific, and lctl lustre > specific. In essence we are attempting to decouple LNet from lustre. > There has been some talk about upstreaming LNet before lustre with all > the work that James Simmons from ORNL is doing. > > > > thanks > > amir > > > > On 10 January 2017 at 14:06, Christopher J. Morrone > wrote: > > Sounds good to me. Ideally, lnetctl should be able to do everything > that lctl could do (plus all of the new features). Has it reached > parity? If not, what else still remains to be done? > > Chris > > On 01/10/2017 12:15 PM, Amir Shehata wrote: > > lctl usage is kept for backwards compatibility. Eventually, we > should be > > moving to using lnetctl exclusively. Which lustre-release we should do > > that in, is the question. 2.10? > > > > thanks > > amir > > > > On 4 January 2017 at 16:16, Di Natale, Giuseppe > > > >> wrote: > > > > Greetings, > > > > I am attempting to port the SysV lnet script as part of a > transition > > to systemd. I ran into the following in lustre/scripts/lnet: > > > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > > "$LUSTRE_LNET_CONFIG_FILE" ]; then > > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || > exit 1 > > else > > lctl network up || exit 1 > > fi > > > > Can the check for LUSTRE_LNET_CONFIG_UTILITY > (/usr/sbin/lnetctl by > > default) be removed so that way lnetctl is used exclusively? > > > > 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 anna.fuchs at informatik.uni-hamburg.de Thu Jan 12 12:15:28 2017 From: anna.fuchs at informatik.uni-hamburg.de (Anna Fuchs) Date: Thu, 12 Jan 2017 13:15:28 +0100 Subject: [lustre-devel] Design proposal for client-side compression In-Reply-To: References: <1483967258.2622.24.camel@informatik.uni-hamburg.de> Message-ID: <1484223328.3937.60.camel@informatik.uni-hamburg.de> Hello all, thank you for the responses.  Jinshan, > > I assume the purpose of this proposal is to fully utilize the CPU > cycles on the client nodes to compress and decompress data, because > there are much more client nodes than server nodes. After data is > compressed, it will need less network bandwidth to transfer it to > server and write them back to storage. Yes, that is our goal for the moment. > > There would be more changes to implement this feature: > 1. I guess dmu_read() needs change as well to transfer compressed > data back to client, otherwise how it would improve readahead > performance. Please let me know if I overlooked something; Sure, I might have shortened my explanation too much. The read path will be affected for providing compressed data and record-wise "metadata" back to the client. The client will then decompress it. > 2. read-modify-write on client chunks - if only partial chunk is > modified on the client side, the OSC will have to read the chunk > back, uncompress it, and modify the data in chunk, and compress it > again to get ready for write back. We may have to maintain a separate > chunk cache on the OSC layer; We keep the rmw problem in mind and will definitely need to work on optimization once the basic functionality is done. When compressing only sub-stripes (record size), we already hope to reduce the performance loss since we do not need to transfer and decompress the whole stripe anymore.  We would want to keep the compressed data within bd_enc_vec and uncompressed in the normal vector. The space for that vector is allocated in sptlrpc_enc_pool_get_pages. Are those not cached? Could you give me some hints for the approach and what to look at? Is it a right place at all? Though, the naive prototype I am currently working on is very memory intensive anyway (additional buffers, many copies). There is much work for me until I can dive into optimizations... > 3. the OST should grant LDLM lock to align with ZFS block size > otherwise it will be very complex if the OSC has to request locks to > do RMW; I am not very familiar with the locking in Lustre yet.  You mean, once we want to modify part of the data on OST, we want to have a lock for the complete chunk (record), right? Currently, Lustre can do byte-range locks, instead we wanted record-ranged in this case? > 4. OSD-ZFS can dynamically extend the block size by the write > pattern, so we need to disable it to accommodate this feature; We thought to set the sizes from Lustre (client or later server) and force ZFS to use them. ZFS itself will not be able to change any layouts. Matt,  >  > > a possible feature is to enable ZFS to decompress the data >  > I would recommend that you plan to integrate this compression with > ZFS from the beginning, by using compression formats that ZFS already > supports (e.g. lz4), or by adding support in ZFS for the algorithm > you will use for Lustre.  This will provide better flexibility and > compatibility. We currently experiment with lz4 fast, which our students try to submit to the linux kernel. The ZFS patch for that will hopefully follow soon. We thought it would be nice to have the opportunity to use some brand new algorithms on the client within Lustre even if they are not yet supported by ZFS. Though it is great that the ZFS community is open to integrate new features so we probably could completely match our needs. >  > Also, I agree with what Jinshan said below.  Assuming that you want > to do compressed read as well, you will need to add a compressed read > function to the DMU.  For compressed send/receive we only added > compressed write to the DMU, because zfs send reads directly from the > ARC (which can do compressed read). We are working on it right now, the functionality should be similar to the write case or do I miss some fundamental issues?  Best regards, Anna From bart.vanassche at sandisk.com Wed Jan 11 00:56:48 2017 From: bart.vanassche at sandisk.com (Bart Van Assche) Date: Tue, 10 Jan 2017 16:56:48 -0800 Subject: [lustre-devel] [PATCH 9/9] treewide: Inline ib_dma_map_*() functions In-Reply-To: <20170111005648.14988-1-bart.vanassche@sandisk.com> References: <20170111005648.14988-1-bart.vanassche@sandisk.com> Message-ID: <20170111005648.14988-10-bart.vanassche@sandisk.com> Almost all changes in this patch except the removal of local variables that became superfluous and the actual removal of the ib_dma_map_*() functions have been generated as follows: git grep -lE 'ib_(sg_|)dma_' | xargs -d\\n \ sed -i -e 's/\([^[:alnum:]_]\)ib_dma_\([^(]*\)(\&\([^,]\+\),/\1dma_\2(\3.dma_device,/g' \ -e 's/\([^[:alnum:]_]\)ib_dma_\([^(]*\)(\([^,]\+\),/\1dma_\2(\3->dma_device,/g' \ -e 's/ib_sg_dma_\(len\|address\)(\([^,]\+\), /sg_dma_\1(/g' Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Andreas Dilger Cc: Anna Schumaker Cc: David S. Miller Cc: Eric Van Hensbergen Cc: James Simmons Cc: Latchesar Ionkov Cc: Oleg Drokin Cc: Ron Minnich Cc: Trond Myklebust Cc: devel at driverdev.osuosl.org Cc: linux-nfs at vger.kernel.org Cc: linux-nvme at lists.infradead.org Cc: linux-rdma at vger.kernel.org Cc: lustre-devel at lists.lustre.org Cc: netdev at vger.kernel.org Cc: rds-devel at oss.oracle.com Cc: target-devel at vger.kernel.org Cc: v9fs-developer at lists.sourceforge.net --- drivers/infiniband/core/mad.c | 28 +-- drivers/infiniband/core/rw.c | 30 ++- drivers/infiniband/core/umem.c | 4 +- drivers/infiniband/core/umem_odp.c | 6 +- drivers/infiniband/hw/mlx4/cq.c | 2 +- drivers/infiniband/hw/mlx4/mad.c | 28 +-- drivers/infiniband/hw/mlx4/mr.c | 4 +- drivers/infiniband/hw/mlx4/qp.c | 10 +- drivers/infiniband/hw/mlx5/mr.c | 4 +- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 20 +- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 22 +-- drivers/infiniband/ulp/iser/iscsi_iser.c | 6 +- drivers/infiniband/ulp/iser/iser_initiator.c | 38 ++-- drivers/infiniband/ulp/iser/iser_memory.c | 12 +- drivers/infiniband/ulp/iser/iser_verbs.c | 2 +- drivers/infiniband/ulp/isert/ib_isert.c | 60 +++--- drivers/infiniband/ulp/srp/ib_srp.c | 50 +++-- drivers/infiniband/ulp/srpt/ib_srpt.c | 10 +- drivers/nvme/host/rdma.c | 22 +-- drivers/nvme/target/rdma.c | 20 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 14 +- include/rdma/ib_verbs.h | 218 --------------------- net/9p/trans_rdma.c | 12 +- net/rds/ib.h | 39 ---- net/rds/ib_cm.c | 18 +- net/rds/ib_fmr.c | 10 +- net/rds/ib_frmr.c | 8 +- net/rds/ib_rdma.c | 6 +- net/rds/ib_recv.c | 14 +- net/rds/ib_send.c | 28 +-- net/sunrpc/xprtrdma/fmr_ops.c | 6 +- net/sunrpc/xprtrdma/frwr_ops.c | 6 +- net/sunrpc/xprtrdma/rpc_rdma.c | 14 +- net/sunrpc/xprtrdma/svc_rdma_backchannel.c | 4 +- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 8 +- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 14 +- net/sunrpc/xprtrdma/svc_rdma_transport.c | 8 +- net/sunrpc/xprtrdma/verbs.c | 8 +- 38 files changed, 275 insertions(+), 538 deletions(-) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index a009f7132c73..2d51f0bdc13f 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -1152,21 +1152,21 @@ int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr) mad_agent = mad_send_wr->send_buf.mad_agent; sge = mad_send_wr->sg_list; - sge[0].addr = ib_dma_map_single(mad_agent->device, + sge[0].addr = dma_map_single(mad_agent->device->dma_device, mad_send_wr->send_buf.mad, sge[0].length, DMA_TO_DEVICE); - if (unlikely(ib_dma_mapping_error(mad_agent->device, sge[0].addr))) + if (unlikely(dma_mapping_error(mad_agent->device->dma_device, sge[0].addr))) return -ENOMEM; mad_send_wr->header_mapping = sge[0].addr; - sge[1].addr = ib_dma_map_single(mad_agent->device, + sge[1].addr = dma_map_single(mad_agent->device->dma_device, ib_get_payload(mad_send_wr), sge[1].length, DMA_TO_DEVICE); - if (unlikely(ib_dma_mapping_error(mad_agent->device, sge[1].addr))) { - ib_dma_unmap_single(mad_agent->device, + if (unlikely(dma_mapping_error(mad_agent->device->dma_device, sge[1].addr))) { + dma_unmap_single(mad_agent->device->dma_device, mad_send_wr->header_mapping, sge[0].length, DMA_TO_DEVICE); return -ENOMEM; @@ -1189,10 +1189,10 @@ int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr) } spin_unlock_irqrestore(&qp_info->send_queue.lock, flags); if (ret) { - ib_dma_unmap_single(mad_agent->device, + dma_unmap_single(mad_agent->device->dma_device, mad_send_wr->header_mapping, sge[0].length, DMA_TO_DEVICE); - ib_dma_unmap_single(mad_agent->device, + dma_unmap_single(mad_agent->device->dma_device, mad_send_wr->payload_mapping, sge[1].length, DMA_TO_DEVICE); } @@ -2191,7 +2191,7 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) mad_priv_hdr = container_of(mad_list, struct ib_mad_private_header, mad_list); recv = container_of(mad_priv_hdr, struct ib_mad_private, header); - ib_dma_unmap_single(port_priv->device, + dma_unmap_single(port_priv->device->dma_device, recv->header.mapping, mad_priv_dma_size(recv), DMA_FROM_DEVICE); @@ -2432,10 +2432,10 @@ static void ib_mad_send_done(struct ib_cq *cq, struct ib_wc *wc) qp_info = send_queue->qp_info; retry: - ib_dma_unmap_single(mad_send_wr->send_buf.mad_agent->device, + dma_unmap_single(mad_send_wr->send_buf.mad_agent->device->dma_device, mad_send_wr->header_mapping, mad_send_wr->sg_list[0].length, DMA_TO_DEVICE); - ib_dma_unmap_single(mad_send_wr->send_buf.mad_agent->device, + dma_unmap_single(mad_send_wr->send_buf.mad_agent->device->dma_device, mad_send_wr->payload_mapping, mad_send_wr->sg_list[1].length, DMA_TO_DEVICE); queued_send_wr = NULL; @@ -2853,11 +2853,11 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, } } sg_list.length = mad_priv_dma_size(mad_priv); - sg_list.addr = ib_dma_map_single(qp_info->port_priv->device, + sg_list.addr = dma_map_single(qp_info->port_priv->device->dma_device, &mad_priv->grh, mad_priv_dma_size(mad_priv), DMA_FROM_DEVICE); - if (unlikely(ib_dma_mapping_error(qp_info->port_priv->device, + if (unlikely(dma_mapping_error(qp_info->port_priv->device->dma_device, sg_list.addr))) { ret = -ENOMEM; break; @@ -2878,7 +2878,7 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, list_del(&mad_priv->header.mad_list.list); recv_queue->count--; spin_unlock_irqrestore(&recv_queue->lock, flags); - ib_dma_unmap_single(qp_info->port_priv->device, + dma_unmap_single(qp_info->port_priv->device->dma_device, mad_priv->header.mapping, mad_priv_dma_size(mad_priv), DMA_FROM_DEVICE); @@ -2917,7 +2917,7 @@ static void cleanup_recv_queue(struct ib_mad_qp_info *qp_info) /* Remove from posted receive MAD list */ list_del(&mad_list->list); - ib_dma_unmap_single(qp_info->port_priv->device, + dma_unmap_single(qp_info->port_priv->device->dma_device, recv->header.mapping, mad_priv_dma_size(recv), DMA_FROM_DEVICE); diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c index dbfd854c32c9..f8aef874f636 100644 --- a/drivers/infiniband/core/rw.c +++ b/drivers/infiniband/core/rw.c @@ -178,7 +178,6 @@ static int rdma_rw_init_map_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp, struct scatterlist *sg, u32 sg_cnt, u32 offset, u64 remote_addr, u32 rkey, enum dma_data_direction dir) { - struct ib_device *dev = qp->pd->device; u32 max_sge = dir == DMA_TO_DEVICE ? qp->max_write_sge : qp->max_read_sge; struct ib_sge *sge; @@ -208,8 +207,8 @@ static int rdma_rw_init_map_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp, rdma_wr->wr.sg_list = sge; for (j = 0; j < nr_sge; j++, sg = sg_next(sg)) { - sge->addr = ib_sg_dma_address(dev, sg) + offset; - sge->length = ib_sg_dma_len(dev, sg) - offset; + sge->addr = sg_dma_address(sg) + offset; + sge->length = sg_dma_len(sg) - offset; sge->lkey = qp->pd->local_dma_lkey; total_len += sge->length; @@ -235,14 +234,13 @@ static int rdma_rw_init_single_wr(struct rdma_rw_ctx *ctx, struct ib_qp *qp, struct scatterlist *sg, u32 offset, u64 remote_addr, u32 rkey, enum dma_data_direction dir) { - struct ib_device *dev = qp->pd->device; struct ib_rdma_wr *rdma_wr = &ctx->single.wr; ctx->nr_ops = 1; ctx->single.sge.lkey = qp->pd->local_dma_lkey; - ctx->single.sge.addr = ib_sg_dma_address(dev, sg) + offset; - ctx->single.sge.length = ib_sg_dma_len(dev, sg) - offset; + ctx->single.sge.addr = sg_dma_address(sg) + offset; + ctx->single.sge.length = sg_dma_len(sg) - offset; memset(rdma_wr, 0, sizeof(*rdma_wr)); if (dir == DMA_TO_DEVICE) @@ -280,7 +278,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num, struct ib_device *dev = qp->pd->device; int ret; - ret = ib_dma_map_sg(dev, sg, sg_cnt, dir); + ret = dma_map_sg(dev->dma_device, sg, sg_cnt, dir); if (!ret) return -ENOMEM; sg_cnt = ret; @@ -289,7 +287,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num, * Skip to the S/G entry that sg_offset falls into: */ for (;;) { - u32 len = ib_sg_dma_len(dev, sg); + u32 len = sg_dma_len(sg); if (sg_offset < len) break; @@ -319,7 +317,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num, return ret; out_unmap_sg: - ib_dma_unmap_sg(dev, sg, sg_cnt, dir); + dma_unmap_sg(dev->dma_device, sg, sg_cnt, dir); return ret; } EXPORT_SYMBOL(rdma_rw_ctx_init); @@ -358,12 +356,12 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, return -EINVAL; } - ret = ib_dma_map_sg(dev, sg, sg_cnt, dir); + ret = dma_map_sg(dev->dma_device, sg, sg_cnt, dir); if (!ret) return -ENOMEM; sg_cnt = ret; - ret = ib_dma_map_sg(dev, prot_sg, prot_sg_cnt, dir); + ret = dma_map_sg(dev->dma_device, prot_sg, prot_sg_cnt, dir); if (!ret) { ret = -ENOMEM; goto out_unmap_sg; @@ -457,9 +455,9 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, out_free_ctx: kfree(ctx->sig); out_unmap_prot_sg: - ib_dma_unmap_sg(dev, prot_sg, prot_sg_cnt, dir); + dma_unmap_sg(dev->dma_device, prot_sg, prot_sg_cnt, dir); out_unmap_sg: - ib_dma_unmap_sg(dev, sg, sg_cnt, dir); + dma_unmap_sg(dev->dma_device, sg, sg_cnt, dir); return ret; } EXPORT_SYMBOL(rdma_rw_ctx_signature_init); @@ -606,7 +604,7 @@ void rdma_rw_ctx_destroy(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num, break; } - ib_dma_unmap_sg(qp->pd->device, sg, sg_cnt, dir); + dma_unmap_sg(qp->pd->device->dma_device, sg, sg_cnt, dir); } EXPORT_SYMBOL(rdma_rw_ctx_destroy); @@ -631,11 +629,11 @@ void rdma_rw_ctx_destroy_signature(struct rdma_rw_ctx *ctx, struct ib_qp *qp, return; ib_mr_pool_put(qp, &qp->rdma_mrs, ctx->sig->data.mr); - ib_dma_unmap_sg(qp->pd->device, sg, sg_cnt, dir); + dma_unmap_sg(qp->pd->device->dma_device, sg, sg_cnt, dir); if (ctx->sig->prot.mr) { ib_mr_pool_put(qp, &qp->rdma_mrs, ctx->sig->prot.mr); - ib_dma_unmap_sg(qp->pd->device, prot_sg, prot_sg_cnt, dir); + dma_unmap_sg(qp->pd->device->dma_device, prot_sg, prot_sg_cnt, dir); } ib_mr_pool_put(qp, &qp->sig_mrs, ctx->sig->sig_mr); diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 1e62a5f0cb28..146ebdbd3f7c 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -50,7 +50,7 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int d int i; if (umem->nmap > 0) - ib_dma_unmap_sg(dev, umem->sg_head.sgl, + dma_unmap_sg(dev->dma_device, umem->sg_head.sgl, umem->npages, DMA_BIDIRECTIONAL); @@ -214,7 +214,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, sg_list_start = sg; } - umem->nmap = ib_dma_map_sg_attrs(context->device, + umem->nmap = dma_map_sg_attrs(context->device->dma_device, umem->sg_head.sgl, umem->npages, DMA_BIDIRECTIONAL, diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c index 6b079a31dced..066628ec6ed0 100644 --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c @@ -456,11 +456,11 @@ static int ib_umem_odp_map_dma_single_page( goto out; } if (!(umem->odp_data->dma_list[page_index])) { - dma_addr = ib_dma_map_page(dev, + dma_addr = dma_map_page(dev->dma_device, page, 0, PAGE_SIZE, DMA_BIDIRECTIONAL); - if (ib_dma_mapping_error(dev, dma_addr)) { + if (dma_mapping_error(dev->dma_device, dma_addr)) { ret = -EFAULT; goto out; } @@ -645,7 +645,7 @@ void ib_umem_odp_unmap_dma_pages(struct ib_umem *umem, u64 virt, WARN_ON(!dma_addr); - ib_dma_unmap_page(dev, dma_addr, PAGE_SIZE, + dma_unmap_page(dev->dma_device, dma_addr, PAGE_SIZE, DMA_BIDIRECTIONAL); if (dma & ODP_WRITE_ALLOWED_BIT) { struct page *head_page = compound_head(page); diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 6a0fec357dae..138ac59655ab 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c @@ -584,7 +584,7 @@ static void use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct { struct mlx4_ib_proxy_sqp_hdr *hdr; - ib_dma_sync_single_for_cpu(qp->ibqp.device, + dma_sync_single_for_cpu(qp->ibqp.device->dma_device, qp->sqp_proxy_rcv[tail].map, sizeof (struct mlx4_ib_proxy_sqp_hdr), DMA_FROM_DEVICE); diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index db564ccc0f92..221fe481e6f7 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -582,7 +582,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, if (tun_qp->tx_ring[tun_tx_ix].ah) ib_destroy_ah(tun_qp->tx_ring[tun_tx_ix].ah); tun_qp->tx_ring[tun_tx_ix].ah = ah; - ib_dma_sync_single_for_cpu(&dev->ib_dev, + dma_sync_single_for_cpu(dev->ib_dev.dma_device, tun_qp->tx_ring[tun_tx_ix].buf.map, sizeof (struct mlx4_rcv_tunnel_mad), DMA_TO_DEVICE); @@ -624,7 +624,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, tun_mad->hdr.slid_mac_47_32 = cpu_to_be16(wc->slid); } - ib_dma_sync_single_for_device(&dev->ib_dev, + dma_sync_single_for_device(dev->ib_dev.dma_device, tun_qp->tx_ring[tun_tx_ix].buf.map, sizeof (struct mlx4_rcv_tunnel_mad), DMA_TO_DEVICE); @@ -1321,7 +1321,7 @@ static int mlx4_ib_post_pv_qp_buf(struct mlx4_ib_demux_pv_ctx *ctx, recv_wr.num_sge = 1; recv_wr.wr_id = (u64) index | MLX4_TUN_WRID_RECV | MLX4_TUN_SET_WRID_QPN(tun_qp->proxy_qpt); - ib_dma_sync_single_for_device(ctx->ib_dev, tun_qp->ring[index].map, + dma_sync_single_for_device(ctx->ib_dev->dma_device, tun_qp->ring[index].map, size, DMA_FROM_DEVICE); return ib_post_recv(tun_qp->qp, &recv_wr, &bad_recv_wr); } @@ -1412,14 +1412,14 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, if (sqp->tx_ring[wire_tx_ix].ah) ib_destroy_ah(sqp->tx_ring[wire_tx_ix].ah); sqp->tx_ring[wire_tx_ix].ah = ah; - ib_dma_sync_single_for_cpu(&dev->ib_dev, + dma_sync_single_for_cpu(dev->ib_dev.dma_device, sqp->tx_ring[wire_tx_ix].buf.map, sizeof (struct mlx4_mad_snd_buf), DMA_TO_DEVICE); memcpy(&sqp_mad->payload, mad, sizeof *mad); - ib_dma_sync_single_for_device(&dev->ib_dev, + dma_sync_single_for_device(dev->ib_dev.dma_device, sqp->tx_ring[wire_tx_ix].buf.map, sizeof (struct mlx4_mad_snd_buf), DMA_TO_DEVICE); @@ -1504,7 +1504,7 @@ static void mlx4_ib_multiplex_mad(struct mlx4_ib_demux_pv_ctx *ctx, struct ib_wc } /* Map transaction ID */ - ib_dma_sync_single_for_cpu(ctx->ib_dev, tun_qp->ring[wr_ix].map, + dma_sync_single_for_cpu(ctx->ib_dev->dma_device, tun_qp->ring[wr_ix].map, sizeof (struct mlx4_tunnel_mad), DMA_FROM_DEVICE); switch (tunnel->mad.mad_hdr.method) { @@ -1627,11 +1627,11 @@ static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx, tun_qp->ring[i].addr = kmalloc(rx_buf_size, GFP_KERNEL); if (!tun_qp->ring[i].addr) goto err; - tun_qp->ring[i].map = ib_dma_map_single(ctx->ib_dev, + tun_qp->ring[i].map = dma_map_single(ctx->ib_dev->dma_device, tun_qp->ring[i].addr, rx_buf_size, DMA_FROM_DEVICE); - if (ib_dma_mapping_error(ctx->ib_dev, tun_qp->ring[i].map)) { + if (dma_mapping_error(ctx->ib_dev->dma_device, tun_qp->ring[i].map)) { kfree(tun_qp->ring[i].addr); goto err; } @@ -1643,11 +1643,11 @@ static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx, if (!tun_qp->tx_ring[i].buf.addr) goto tx_err; tun_qp->tx_ring[i].buf.map = - ib_dma_map_single(ctx->ib_dev, + dma_map_single(ctx->ib_dev->dma_device, tun_qp->tx_ring[i].buf.addr, tx_buf_size, DMA_TO_DEVICE); - if (ib_dma_mapping_error(ctx->ib_dev, + if (dma_mapping_error(ctx->ib_dev->dma_device, tun_qp->tx_ring[i].buf.map)) { kfree(tun_qp->tx_ring[i].buf.addr); goto tx_err; @@ -1664,7 +1664,7 @@ static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx, tx_err: while (i > 0) { --i; - ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map, + dma_unmap_single(ctx->ib_dev->dma_device, tun_qp->tx_ring[i].buf.map, tx_buf_size, DMA_TO_DEVICE); kfree(tun_qp->tx_ring[i].buf.addr); } @@ -1674,7 +1674,7 @@ static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx, err: while (i > 0) { --i; - ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map, + dma_unmap_single(ctx->ib_dev->dma_device, tun_qp->ring[i].map, rx_buf_size, DMA_FROM_DEVICE); kfree(tun_qp->ring[i].addr); } @@ -1704,13 +1704,13 @@ static void mlx4_ib_free_pv_qp_bufs(struct mlx4_ib_demux_pv_ctx *ctx, for (i = 0; i < MLX4_NUM_TUNNEL_BUFS; i++) { - ib_dma_unmap_single(ctx->ib_dev, tun_qp->ring[i].map, + dma_unmap_single(ctx->ib_dev->dma_device, tun_qp->ring[i].map, rx_buf_size, DMA_FROM_DEVICE); kfree(tun_qp->ring[i].addr); } for (i = 0; i < MLX4_NUM_TUNNEL_BUFS; i++) { - ib_dma_unmap_single(ctx->ib_dev, tun_qp->tx_ring[i].buf.map, + dma_unmap_single(ctx->ib_dev->dma_device, tun_qp->tx_ring[i].buf.map, tx_buf_size, DMA_TO_DEVICE); kfree(tun_qp->tx_ring[i].buf.addr); if (tun_qp->tx_ring[i].ah) diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index 5d73989d9771..89297b832a9f 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c @@ -538,12 +538,12 @@ int mlx4_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, mr->npages = 0; - ib_dma_sync_single_for_cpu(ibmr->device, mr->page_map, + dma_sync_single_for_cpu(ibmr->device->dma_device, mr->page_map, mr->page_map_size, DMA_TO_DEVICE); rc = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, mlx4_set_page); - ib_dma_sync_single_for_device(ibmr->device, mr->page_map, + dma_sync_single_for_device(ibmr->device->dma_device, mr->page_map, mr->page_map_size, DMA_TO_DEVICE); return rc; diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index c068add8838b..a8c4ef02aef1 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c @@ -570,10 +570,10 @@ static int alloc_proxy_bufs(struct ib_device *dev, struct mlx4_ib_qp *qp) if (!qp->sqp_proxy_rcv[i].addr) goto err; qp->sqp_proxy_rcv[i].map = - ib_dma_map_single(dev, qp->sqp_proxy_rcv[i].addr, + dma_map_single(dev->dma_device, qp->sqp_proxy_rcv[i].addr, sizeof (struct mlx4_ib_proxy_sqp_hdr), DMA_FROM_DEVICE); - if (ib_dma_mapping_error(dev, qp->sqp_proxy_rcv[i].map)) { + if (dma_mapping_error(dev->dma_device, qp->sqp_proxy_rcv[i].map)) { kfree(qp->sqp_proxy_rcv[i].addr); goto err; } @@ -583,7 +583,7 @@ static int alloc_proxy_bufs(struct ib_device *dev, struct mlx4_ib_qp *qp) err: while (i > 0) { --i; - ib_dma_unmap_single(dev, qp->sqp_proxy_rcv[i].map, + dma_unmap_single(dev->dma_device, qp->sqp_proxy_rcv[i].map, sizeof (struct mlx4_ib_proxy_sqp_hdr), DMA_FROM_DEVICE); kfree(qp->sqp_proxy_rcv[i].addr); @@ -598,7 +598,7 @@ static void free_proxy_bufs(struct ib_device *dev, struct mlx4_ib_qp *qp) int i; for (i = 0; i < qp->rq.wqe_cnt; i++) { - ib_dma_unmap_single(dev, qp->sqp_proxy_rcv[i].map, + dma_unmap_single(dev->dma_device, qp->sqp_proxy_rcv[i].map, sizeof (struct mlx4_ib_proxy_sqp_hdr), DMA_FROM_DEVICE); kfree(qp->sqp_proxy_rcv[i].addr); @@ -3306,7 +3306,7 @@ int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, if (qp->mlx4_ib_qp_type & (MLX4_IB_QPT_PROXY_SMI_OWNER | MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI)) { - ib_dma_sync_single_for_device(ibqp->device, + dma_sync_single_for_device(ibqp->device->dma_device, qp->sqp_proxy_rcv[ind].map, sizeof (struct mlx4_ib_proxy_sqp_hdr), DMA_FROM_DEVICE); diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 00175191fdc6..68655e994bfe 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1865,7 +1865,7 @@ int mlx5_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, mr->ndescs = 0; - ib_dma_sync_single_for_cpu(ibmr->device, mr->desc_map, + dma_sync_single_for_cpu(ibmr->device->dma_device, mr->desc_map, mr->desc_size * mr->max_descs, DMA_TO_DEVICE); @@ -1875,7 +1875,7 @@ int mlx5_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, n = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, mlx5_set_page); - ib_dma_sync_single_for_device(ibmr->device, mr->desc_map, + dma_sync_single_for_device(ibmr->device->dma_device, mr->desc_map, mr->desc_size * mr->max_descs, DMA_TO_DEVICE); diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 096c4f6fbd65..0c6b0a0c607b 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -83,10 +83,10 @@ static void ipoib_cm_dma_unmap_rx(struct ipoib_dev_priv *priv, int frags, { int i; - ib_dma_unmap_single(priv->ca, mapping[0], IPOIB_CM_HEAD_SIZE, DMA_FROM_DEVICE); + dma_unmap_single(priv->ca->dma_device, mapping[0], IPOIB_CM_HEAD_SIZE, DMA_FROM_DEVICE); for (i = 0; i < frags; ++i) - ib_dma_unmap_page(priv->ca, mapping[i + 1], PAGE_SIZE, DMA_FROM_DEVICE); + dma_unmap_page(priv->ca->dma_device, mapping[i + 1], PAGE_SIZE, DMA_FROM_DEVICE); } static int ipoib_cm_post_receive_srq(struct net_device *dev, int id) @@ -158,9 +158,9 @@ static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, */ skb_reserve(skb, IPOIB_CM_RX_RESERVE); - mapping[0] = ib_dma_map_single(priv->ca, skb->data, IPOIB_CM_HEAD_SIZE, + mapping[0] = dma_map_single(priv->ca->dma_device, skb->data, IPOIB_CM_HEAD_SIZE, DMA_FROM_DEVICE); - if (unlikely(ib_dma_mapping_error(priv->ca, mapping[0]))) { + if (unlikely(dma_mapping_error(priv->ca->dma_device, mapping[0]))) { dev_kfree_skb_any(skb); return NULL; } @@ -172,9 +172,9 @@ static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, goto partial_error; skb_fill_page_desc(skb, i, page, 0, PAGE_SIZE); - mapping[i + 1] = ib_dma_map_page(priv->ca, page, + mapping[i + 1] = dma_map_page(priv->ca->dma_device, page, 0, PAGE_SIZE, DMA_FROM_DEVICE); - if (unlikely(ib_dma_mapping_error(priv->ca, mapping[i + 1]))) + if (unlikely(dma_mapping_error(priv->ca->dma_device, mapping[i + 1]))) goto partial_error; } @@ -183,10 +183,10 @@ static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, partial_error: - ib_dma_unmap_single(priv->ca, mapping[0], IPOIB_CM_HEAD_SIZE, DMA_FROM_DEVICE); + dma_unmap_single(priv->ca->dma_device, mapping[0], IPOIB_CM_HEAD_SIZE, DMA_FROM_DEVICE); for (; i > 0; --i) - ib_dma_unmap_page(priv->ca, mapping[i], PAGE_SIZE, DMA_FROM_DEVICE); + dma_unmap_page(priv->ca->dma_device, mapping[i], PAGE_SIZE, DMA_FROM_DEVICE); dev_kfree_skb_any(skb); return NULL; @@ -626,10 +626,10 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) small_skb = dev_alloc_skb(dlen + IPOIB_CM_RX_RESERVE); if (small_skb) { skb_reserve(small_skb, IPOIB_CM_RX_RESERVE); - ib_dma_sync_single_for_cpu(priv->ca, rx_ring[wr_id].mapping[0], + dma_sync_single_for_cpu(priv->ca->dma_device, rx_ring[wr_id].mapping[0], dlen, DMA_FROM_DEVICE); skb_copy_from_linear_data(skb, small_skb->data, dlen); - ib_dma_sync_single_for_device(priv->ca, rx_ring[wr_id].mapping[0], + dma_sync_single_for_device(priv->ca->dma_device, rx_ring[wr_id].mapping[0], dlen, DMA_FROM_DEVICE); skb_put(small_skb, dlen); skb = small_skb; diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 5038f9d2d753..ccf540abedac 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -92,7 +92,7 @@ void ipoib_free_ah(struct kref *kref) static void ipoib_ud_dma_unmap_rx(struct ipoib_dev_priv *priv, u64 mapping[IPOIB_UD_RX_SG]) { - ib_dma_unmap_single(priv->ca, mapping[0], + dma_unmap_single(priv->ca->dma_device, mapping[0], IPOIB_UD_BUF_SIZE(priv->max_ib_mtu), DMA_FROM_DEVICE); } @@ -139,9 +139,9 @@ static struct sk_buff *ipoib_alloc_rx_skb(struct net_device *dev, int id) skb_reserve(skb, sizeof(struct ipoib_pseudo_header)); mapping = priv->rx_ring[id].mapping; - mapping[0] = ib_dma_map_single(priv->ca, skb->data, buf_size, + mapping[0] = dma_map_single(priv->ca->dma_device, skb->data, buf_size, DMA_FROM_DEVICE); - if (unlikely(ib_dma_mapping_error(priv->ca, mapping[0]))) + if (unlikely(dma_mapping_error(priv->ca->dma_device, mapping[0]))) goto error; priv->rx_ring[id].skb = skb; @@ -278,9 +278,9 @@ int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req) int off; if (skb_headlen(skb)) { - mapping[0] = ib_dma_map_single(ca, skb->data, skb_headlen(skb), + mapping[0] = dma_map_single(ca->dma_device, skb->data, skb_headlen(skb), DMA_TO_DEVICE); - if (unlikely(ib_dma_mapping_error(ca, mapping[0]))) + if (unlikely(dma_mapping_error(ca->dma_device, mapping[0]))) return -EIO; off = 1; @@ -289,11 +289,11 @@ int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req) for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) { const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; - mapping[i + off] = ib_dma_map_page(ca, + mapping[i + off] = dma_map_page(ca->dma_device, skb_frag_page(frag), frag->page_offset, skb_frag_size(frag), DMA_TO_DEVICE); - if (unlikely(ib_dma_mapping_error(ca, mapping[i + off]))) + if (unlikely(dma_mapping_error(ca->dma_device, mapping[i + off]))) goto partial_error; } return 0; @@ -302,11 +302,11 @@ int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req) for (; i > 0; --i) { const skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1]; - ib_dma_unmap_page(ca, mapping[i - !off], skb_frag_size(frag), DMA_TO_DEVICE); + dma_unmap_page(ca->dma_device, mapping[i - !off], skb_frag_size(frag), DMA_TO_DEVICE); } if (off) - ib_dma_unmap_single(ca, mapping[0], skb_headlen(skb), DMA_TO_DEVICE); + dma_unmap_single(ca->dma_device, mapping[0], skb_headlen(skb), DMA_TO_DEVICE); return -EIO; } @@ -320,7 +320,7 @@ void ipoib_dma_unmap_tx(struct ipoib_dev_priv *priv, int off; if (skb_headlen(skb)) { - ib_dma_unmap_single(priv->ca, mapping[0], skb_headlen(skb), + dma_unmap_single(priv->ca->dma_device, mapping[0], skb_headlen(skb), DMA_TO_DEVICE); off = 1; } else @@ -329,7 +329,7 @@ void ipoib_dma_unmap_tx(struct ipoib_dev_priv *priv, for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) { const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; - ib_dma_unmap_page(priv->ca, mapping[i + off], + dma_unmap_page(priv->ca->dma_device, mapping[i + off], skb_frag_size(frag), DMA_TO_DEVICE); } } diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 9104e6b8cac9..f2b2baccfe69 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -198,9 +198,9 @@ iser_initialize_task_headers(struct iscsi_task *task, goto out; } - dma_addr = ib_dma_map_single(device->ib_device, (void *)tx_desc, + dma_addr = dma_map_single(device->ib_device->dma_device, (void *)tx_desc, ISER_HEADERS_LEN, DMA_TO_DEVICE); - if (ib_dma_mapping_error(device->ib_device, dma_addr)) { + if (dma_mapping_error(device->ib_device->dma_device, dma_addr)) { ret = -ENOMEM; goto out; } @@ -375,7 +375,7 @@ static void iscsi_iser_cleanup_task(struct iscsi_task *task) return; if (likely(tx_desc->mapped)) { - ib_dma_unmap_single(device->ib_device, tx_desc->dma_addr, + dma_unmap_single(device->ib_device->dma_device, tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); tx_desc->mapped = false; } diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 81ae2e30dd12..2e65513833bd 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -164,7 +164,7 @@ static void iser_create_send_desc(struct iser_conn *iser_conn, { struct iser_device *device = iser_conn->ib_conn.device; - ib_dma_sync_single_for_cpu(device->ib_device, + dma_sync_single_for_cpu(device->ib_device->dma_device, tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); memset(&tx_desc->iser_header, 0, sizeof(struct iser_ctrl)); @@ -180,10 +180,10 @@ static void iser_free_login_buf(struct iser_conn *iser_conn) if (!desc->req) return; - ib_dma_unmap_single(device->ib_device, desc->req_dma, + dma_unmap_single(device->ib_device->dma_device, desc->req_dma, ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE); - ib_dma_unmap_single(device->ib_device, desc->rsp_dma, + dma_unmap_single(device->ib_device->dma_device, desc->rsp_dma, ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE); kfree(desc->req); @@ -203,10 +203,10 @@ static int iser_alloc_login_buf(struct iser_conn *iser_conn) if (!desc->req) return -ENOMEM; - desc->req_dma = ib_dma_map_single(device->ib_device, desc->req, + desc->req_dma = dma_map_single(device->ib_device->dma_device, desc->req, ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE); - if (ib_dma_mapping_error(device->ib_device, + if (dma_mapping_error(device->ib_device->dma_device, desc->req_dma)) goto free_req; @@ -214,10 +214,10 @@ static int iser_alloc_login_buf(struct iser_conn *iser_conn) if (!desc->rsp) goto unmap_req; - desc->rsp_dma = ib_dma_map_single(device->ib_device, desc->rsp, + desc->rsp_dma = dma_map_single(device->ib_device->dma_device, desc->rsp, ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE); - if (ib_dma_mapping_error(device->ib_device, + if (dma_mapping_error(device->ib_device->dma_device, desc->rsp_dma)) goto free_rsp; @@ -226,7 +226,7 @@ static int iser_alloc_login_buf(struct iser_conn *iser_conn) free_rsp: kfree(desc->rsp); unmap_req: - ib_dma_unmap_single(device->ib_device, desc->req_dma, + dma_unmap_single(device->ib_device->dma_device, desc->req_dma, ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE); free_req: @@ -265,9 +265,9 @@ int iser_alloc_rx_descriptors(struct iser_conn *iser_conn, rx_desc = iser_conn->rx_descs; for (i = 0; i < iser_conn->qp_max_recv_dtos; i++, rx_desc++) { - dma_addr = ib_dma_map_single(device->ib_device, (void *)rx_desc, + dma_addr = dma_map_single(device->ib_device->dma_device, (void *)rx_desc, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); - if (ib_dma_mapping_error(device->ib_device, dma_addr)) + if (dma_mapping_error(device->ib_device->dma_device, dma_addr)) goto rx_desc_dma_map_failed; rx_desc->dma_addr = dma_addr; @@ -284,7 +284,7 @@ int iser_alloc_rx_descriptors(struct iser_conn *iser_conn, rx_desc_dma_map_failed: rx_desc = iser_conn->rx_descs; for (j = 0; j < i; j++, rx_desc++) - ib_dma_unmap_single(device->ib_device, rx_desc->dma_addr, + dma_unmap_single(device->ib_device->dma_device, rx_desc->dma_addr, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); kfree(iser_conn->rx_descs); iser_conn->rx_descs = NULL; @@ -309,7 +309,7 @@ void iser_free_rx_descriptors(struct iser_conn *iser_conn) rx_desc = iser_conn->rx_descs; for (i = 0; i < iser_conn->qp_max_recv_dtos; i++, rx_desc++) - ib_dma_unmap_single(device->ib_device, rx_desc->dma_addr, + dma_unmap_single(device->ib_device->dma_device, rx_desc->dma_addr, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); kfree(iser_conn->rx_descs); /* make sure we never redo any unmapping */ @@ -522,12 +522,12 @@ int iser_send_control(struct iscsi_conn *conn, goto send_control_error; } - ib_dma_sync_single_for_cpu(device->ib_device, desc->req_dma, + dma_sync_single_for_cpu(device->ib_device->dma_device, desc->req_dma, task->data_count, DMA_TO_DEVICE); memcpy(desc->req, task->data, task->data_count); - ib_dma_sync_single_for_device(device->ib_device, desc->req_dma, + dma_sync_single_for_device(device->ib_device->dma_device, desc->req_dma, task->data_count, DMA_TO_DEVICE); tx_dsg->addr = desc->req_dma; @@ -570,7 +570,7 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc) return; } - ib_dma_sync_single_for_cpu(ib_conn->device->ib_device, + dma_sync_single_for_cpu(ib_conn->device->ib_device->dma_device, desc->rsp_dma, ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE); @@ -583,7 +583,7 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc) iscsi_iser_recv(iser_conn->iscsi_conn, hdr, data, length); - ib_dma_sync_single_for_device(ib_conn->device->ib_device, + dma_sync_single_for_device(ib_conn->device->ib_device->dma_device, desc->rsp_dma, ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE); @@ -655,7 +655,7 @@ void iser_task_rsp(struct ib_cq *cq, struct ib_wc *wc) return; } - ib_dma_sync_single_for_cpu(ib_conn->device->ib_device, + dma_sync_single_for_cpu(ib_conn->device->ib_device->dma_device, desc->dma_addr, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); @@ -673,7 +673,7 @@ void iser_task_rsp(struct ib_cq *cq, struct ib_wc *wc) iscsi_iser_recv(iser_conn->iscsi_conn, hdr, desc->data, length); - ib_dma_sync_single_for_device(ib_conn->device->ib_device, + dma_sync_single_for_device(ib_conn->device->ib_device->dma_device, desc->dma_addr, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); @@ -724,7 +724,7 @@ void iser_dataout_comp(struct ib_cq *cq, struct ib_wc *wc) if (unlikely(wc->status != IB_WC_SUCCESS)) iser_err_comp(wc, "dataout"); - ib_dma_unmap_single(device->ib_device, desc->dma_addr, + dma_unmap_single(device->ib_device->dma_device, desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); kmem_cache_free(ig.desc_cache, desc); } diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index 9c3e9ab53a41..ae89be7d69a9 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c @@ -145,9 +145,9 @@ static void iser_data_buf_dump(struct iser_data_buf *data, for_each_sg(data->sg, sg, data->dma_nents, i) iser_dbg("sg[%d] dma_addr:0x%lX page:0x%p " "off:0x%x sz:0x%x dma_len:0x%x\n", - i, (unsigned long)ib_sg_dma_address(ibdev, sg), + i, (unsigned long)sg_dma_address(sg), sg_page(sg), sg->offset, - sg->length, ib_sg_dma_len(ibdev, sg)); + sg->length, sg_dma_len(sg)); } static void iser_dump_page_vec(struct iser_page_vec *page_vec) @@ -170,7 +170,7 @@ int iser_dma_map_task_data(struct iscsi_iser_task *iser_task, iser_task->dir[iser_dir] = 1; dev = iser_task->iser_conn->ib_conn.device->ib_device; - data->dma_nents = ib_dma_map_sg(dev, data->sg, data->size, dma_dir); + data->dma_nents = dma_map_sg(dev->dma_device, data->sg, data->size, dma_dir); if (data->dma_nents == 0) { iser_err("dma_map_sg failed!!!\n"); return -EINVAL; @@ -185,7 +185,7 @@ void iser_dma_unmap_task_data(struct iscsi_iser_task *iser_task, struct ib_device *dev; dev = iser_task->iser_conn->ib_conn.device->ib_device; - ib_dma_unmap_sg(dev, data->sg, data->size, dir); + dma_unmap_sg(dev->dma_device, data->sg, data->size, dir); } static int @@ -204,8 +204,8 @@ iser_reg_dma(struct iser_device *device, struct iser_data_buf *mem, reg->rkey = device->pd->unsafe_global_rkey; else reg->rkey = 0; - reg->sge.addr = ib_sg_dma_address(device->ib_device, &sg[0]); - reg->sge.length = ib_sg_dma_len(device->ib_device, &sg[0]); + reg->sge.addr = sg_dma_address(&sg[0]); + reg->sge.length = sg_dma_len(&sg[0]); iser_dbg("Single DMA entry: lkey=0x%x, rkey=0x%x, addr=0x%llx," " length=0x%x\n", reg->sge.lkey, reg->rkey, diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 8ae7a3beddb7..632e57f9bd58 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c @@ -1077,7 +1077,7 @@ int iser_post_send(struct ib_conn *ib_conn, struct iser_tx_desc *tx_desc, struct ib_send_wr *bad_wr, *wr = iser_tx_next_wr(tx_desc); int ib_ret; - ib_dma_sync_single_for_device(ib_conn->device->ib_device, + dma_sync_single_for_device(ib_conn->device->ib_device->dma_device, tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 314e95516068..e81c49d10d29 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -189,9 +189,9 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) rx_desc = isert_conn->rx_descs; for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { - dma_addr = ib_dma_map_single(ib_dev, (void *)rx_desc, + dma_addr = dma_map_single(ib_dev->dma_device, (void *)rx_desc, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); - if (ib_dma_mapping_error(ib_dev, dma_addr)) + if (dma_mapping_error(ib_dev->dma_device, dma_addr)) goto dma_map_fail; rx_desc->dma_addr = dma_addr; @@ -208,7 +208,7 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) dma_map_fail: rx_desc = isert_conn->rx_descs; for (j = 0; j < i; j++, rx_desc++) { - ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, + dma_unmap_single(ib_dev->dma_device, rx_desc->dma_addr, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); } kfree(isert_conn->rx_descs); @@ -229,7 +229,7 @@ isert_free_rx_descriptors(struct isert_conn *isert_conn) rx_desc = isert_conn->rx_descs; for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { - ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, + dma_unmap_single(ib_dev->dma_device, rx_desc->dma_addr, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); } @@ -410,11 +410,11 @@ isert_free_login_buf(struct isert_conn *isert_conn) { struct ib_device *ib_dev = isert_conn->device->ib_device; - ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, + dma_unmap_single(ib_dev->dma_device, isert_conn->login_rsp_dma, ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE); kfree(isert_conn->login_rsp_buf); - ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, + dma_unmap_single(ib_dev->dma_device, isert_conn->login_req_dma, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); kfree(isert_conn->login_req_buf); @@ -431,10 +431,10 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, if (!isert_conn->login_req_buf) return -ENOMEM; - isert_conn->login_req_dma = ib_dma_map_single(ib_dev, + isert_conn->login_req_dma = dma_map_single(ib_dev->dma_device, isert_conn->login_req_buf, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); - ret = ib_dma_mapping_error(ib_dev, isert_conn->login_req_dma); + ret = dma_mapping_error(ib_dev->dma_device, isert_conn->login_req_dma); if (ret) { isert_err("login_req_dma mapping error: %d\n", ret); isert_conn->login_req_dma = 0; @@ -447,10 +447,10 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, goto out_unmap_login_req_buf; } - isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev, + isert_conn->login_rsp_dma = dma_map_single(ib_dev->dma_device, isert_conn->login_rsp_buf, ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE); - ret = ib_dma_mapping_error(ib_dev, isert_conn->login_rsp_dma); + ret = dma_mapping_error(ib_dev->dma_device, isert_conn->login_rsp_dma); if (ret) { isert_err("login_rsp_dma mapping error: %d\n", ret); isert_conn->login_rsp_dma = 0; @@ -462,7 +462,7 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, out_free_login_rsp_buf: kfree(isert_conn->login_rsp_buf); out_unmap_login_req_buf: - ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, + dma_unmap_single(ib_dev->dma_device, isert_conn->login_req_dma, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); out_free_login_req_buf: kfree(isert_conn->login_req_buf); @@ -854,7 +854,7 @@ isert_login_post_send(struct isert_conn *isert_conn, struct iser_tx_desc *tx_des struct ib_send_wr send_wr, *send_wr_failed; int ret; - ib_dma_sync_single_for_device(ib_dev, tx_desc->dma_addr, + dma_sync_single_for_device(ib_dev->dma_device, tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); tx_desc->tx_cqe.done = isert_login_send_done; @@ -881,7 +881,7 @@ isert_create_send_desc(struct isert_conn *isert_conn, struct isert_device *device = isert_conn->device; struct ib_device *ib_dev = device->ib_device; - ib_dma_sync_single_for_cpu(ib_dev, tx_desc->dma_addr, + dma_sync_single_for_cpu(ib_dev->dma_device, tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); memset(&tx_desc->iser_header, 0, sizeof(struct iser_ctrl)); @@ -903,10 +903,10 @@ isert_init_tx_hdrs(struct isert_conn *isert_conn, struct ib_device *ib_dev = device->ib_device; u64 dma_addr; - dma_addr = ib_dma_map_single(ib_dev, (void *)tx_desc, + dma_addr = dma_map_single(ib_dev->dma_device, (void *)tx_desc, ISER_HEADERS_LEN, DMA_TO_DEVICE); - if (ib_dma_mapping_error(ib_dev, dma_addr)) { - isert_err("ib_dma_mapping_error() failed\n"); + if (dma_mapping_error(ib_dev->dma_device, dma_addr)) { + isert_err("dma_mapping_error() failed\n"); return -ENOMEM; } @@ -992,12 +992,12 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login, if (length > 0) { struct ib_sge *tx_dsg = &tx_desc->tx_sg[1]; - ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_rsp_dma, + dma_sync_single_for_cpu(ib_dev->dma_device, isert_conn->login_rsp_dma, length, DMA_TO_DEVICE); memcpy(isert_conn->login_rsp_buf, login->rsp_buf, length); - ib_dma_sync_single_for_device(ib_dev, isert_conn->login_rsp_dma, + dma_sync_single_for_device(ib_dev->dma_device, isert_conn->login_rsp_dma, length, DMA_TO_DEVICE); tx_dsg->addr = isert_conn->login_rsp_dma; @@ -1397,7 +1397,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) return; } - ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr, + dma_sync_single_for_cpu(ib_dev->dma_device, rx_desc->dma_addr, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n", @@ -1432,7 +1432,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) isert_rx_opcode(isert_conn, rx_desc, read_stag, read_va, write_stag, write_va); - ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr, + dma_sync_single_for_device(ib_dev->dma_device, rx_desc->dma_addr, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); } @@ -1447,7 +1447,7 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) return; } - ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_req_dma, + dma_sync_single_for_cpu(ib_dev->dma_device, isert_conn->login_req_dma, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN; @@ -1463,7 +1463,7 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) complete(&isert_conn->login_req_comp); mutex_unlock(&isert_conn->mutex); - ib_dma_sync_single_for_device(ib_dev, isert_conn->login_req_dma, + dma_sync_single_for_device(ib_dev->dma_device, isert_conn->login_req_dma, ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); } @@ -1571,7 +1571,7 @@ isert_unmap_tx_desc(struct iser_tx_desc *tx_desc, struct ib_device *ib_dev) { if (tx_desc->dma_addr != 0) { isert_dbg("unmap single for tx_desc->dma_addr\n"); - ib_dma_unmap_single(ib_dev, tx_desc->dma_addr, + dma_unmap_single(ib_dev->dma_device, tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); tx_desc->dma_addr = 0; } @@ -1583,7 +1583,7 @@ isert_completion_put(struct iser_tx_desc *tx_desc, struct isert_cmd *isert_cmd, { if (isert_cmd->pdu_buf_dma != 0) { isert_dbg("unmap single for isert_cmd->pdu_buf_dma\n"); - ib_dma_unmap_single(ib_dev, isert_cmd->pdu_buf_dma, + dma_unmap_single(ib_dev->dma_device, isert_cmd->pdu_buf_dma, isert_cmd->pdu_buf_len, DMA_TO_DEVICE); isert_cmd->pdu_buf_dma = 0; } @@ -1841,10 +1841,10 @@ isert_put_response(struct iscsi_conn *conn, struct iscsi_cmd *cmd) hton24(hdr->dlength, (u32)cmd->se_cmd.scsi_sense_length); pdu_len = cmd->se_cmd.scsi_sense_length + padding; - isert_cmd->pdu_buf_dma = ib_dma_map_single(ib_dev, + isert_cmd->pdu_buf_dma = dma_map_single(ib_dev->dma_device, (void *)cmd->sense_buffer, pdu_len, DMA_TO_DEVICE); - if (ib_dma_mapping_error(ib_dev, isert_cmd->pdu_buf_dma)) + if (dma_mapping_error(ib_dev->dma_device, isert_cmd->pdu_buf_dma)) return -ENOMEM; isert_cmd->pdu_buf_len = pdu_len; @@ -1970,10 +1970,10 @@ isert_put_reject(struct iscsi_cmd *cmd, struct iscsi_conn *conn) isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); hton24(hdr->dlength, ISCSI_HDR_LEN); - isert_cmd->pdu_buf_dma = ib_dma_map_single(ib_dev, + isert_cmd->pdu_buf_dma = dma_map_single(ib_dev->dma_device, (void *)cmd->buf_ptr, ISCSI_HDR_LEN, DMA_TO_DEVICE); - if (ib_dma_mapping_error(ib_dev, isert_cmd->pdu_buf_dma)) + if (dma_mapping_error(ib_dev->dma_device, isert_cmd->pdu_buf_dma)) return -ENOMEM; isert_cmd->pdu_buf_len = ISCSI_HDR_LEN; tx_dsg->addr = isert_cmd->pdu_buf_dma; @@ -2013,9 +2013,9 @@ isert_put_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) struct ib_sge *tx_dsg = &isert_cmd->tx_desc.tx_sg[1]; void *txt_rsp_buf = cmd->buf_ptr; - isert_cmd->pdu_buf_dma = ib_dma_map_single(ib_dev, + isert_cmd->pdu_buf_dma = dma_map_single(ib_dev->dma_device, txt_rsp_buf, txt_rsp_len, DMA_TO_DEVICE); - if (ib_dma_mapping_error(ib_dev, isert_cmd->pdu_buf_dma)) + if (dma_mapping_error(ib_dev->dma_device, isert_cmd->pdu_buf_dma)) return -ENOMEM; isert_cmd->pdu_buf_len = txt_rsp_len; diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index cd150c19d0d2..751865f0429d 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -233,9 +233,9 @@ static struct srp_iu *srp_alloc_iu(struct srp_host *host, size_t size, if (!iu->buf) goto out_free_iu; - iu->dma = ib_dma_map_single(host->srp_dev->dev, iu->buf, size, + iu->dma = dma_map_single(host->srp_dev->dev->dma_device, iu->buf, size, direction); - if (ib_dma_mapping_error(host->srp_dev->dev, iu->dma)) + if (dma_mapping_error(host->srp_dev->dev->dma_device, iu->dma)) goto out_free_buf; iu->size = size; @@ -256,7 +256,7 @@ static void srp_free_iu(struct srp_host *host, struct srp_iu *iu) if (!iu) return; - ib_dma_unmap_single(host->srp_dev->dev, iu->dma, iu->size, + dma_unmap_single(host->srp_dev->dev->dma_device, iu->dma, iu->size, iu->direction); kfree(iu->buf); kfree(iu); @@ -843,7 +843,7 @@ static void srp_free_req_data(struct srp_target_port *target, kfree(req->map_page); } if (req->indirect_dma_addr) { - ib_dma_unmap_single(ibdev, req->indirect_dma_addr, + dma_unmap_single(ibdev->dma_device, req->indirect_dma_addr, target->indirect_size, DMA_TO_DEVICE); } @@ -888,10 +888,10 @@ static int srp_alloc_req_data(struct srp_rdma_ch *ch) if (!req->indirect_desc) goto out; - dma_addr = ib_dma_map_single(ibdev, req->indirect_desc, + dma_addr = dma_map_single(ibdev->dma_device, req->indirect_desc, target->indirect_size, DMA_TO_DEVICE); - if (ib_dma_mapping_error(ibdev, dma_addr)) + if (dma_mapping_error(ibdev->dma_device, dma_addr)) goto out; req->indirect_dma_addr = dma_addr; @@ -1096,7 +1096,7 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd, ib_fmr_pool_unmap(*pfmr); } - ib_dma_unmap_sg(ibdev, scsi_sglist(scmnd), scsi_sg_count(scmnd), + dma_unmap_sg(ibdev->dma_device, scsi_sglist(scmnd), scsi_sg_count(scmnd), scmnd->sc_data_direction); } @@ -1429,9 +1429,8 @@ static int srp_map_sg_entry(struct srp_map_state *state, { struct srp_target_port *target = ch->target; struct srp_device *dev = target->srp_host->srp_dev; - struct ib_device *ibdev = dev->dev; - dma_addr_t dma_addr = ib_sg_dma_address(ibdev, sg); - unsigned int dma_len = ib_sg_dma_len(ibdev, sg); + dma_addr_t dma_addr = sg_dma_address(sg); + unsigned int dma_len = sg_dma_len(sg); unsigned int len = 0; int ret; @@ -1525,13 +1524,12 @@ static int srp_map_sg_dma(struct srp_map_state *state, struct srp_rdma_ch *ch, int count) { struct srp_target_port *target = ch->target; - struct srp_device *dev = target->srp_host->srp_dev; struct scatterlist *sg; int i; for_each_sg(scat, sg, count, i) { - srp_map_desc(state, ib_sg_dma_address(dev->dev, sg), - ib_sg_dma_len(dev->dev, sg), + srp_map_desc(state, sg_dma_address(sg), + sg_dma_len(sg), target->pd->unsafe_global_rkey); } @@ -1659,7 +1657,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, dev = target->srp_host->srp_dev; ibdev = dev->dev; - count = ib_dma_map_sg(ibdev, scat, nents, scmnd->sc_data_direction); + count = dma_map_sg(ibdev->dma_device, scat, nents, scmnd->sc_data_direction); if (unlikely(count == 0)) return -EIO; @@ -1691,9 +1689,9 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, */ struct srp_direct_buf *buf = (void *) cmd->add_data; - buf->va = cpu_to_be64(ib_sg_dma_address(ibdev, scat)); + buf->va = cpu_to_be64(sg_dma_address(scat)); buf->key = cpu_to_be32(pd->unsafe_global_rkey); - buf->len = cpu_to_be32(ib_sg_dma_len(ibdev, scat)); + buf->len = cpu_to_be32(sg_dma_len(scat)); req->nmdesc = 0; /* Debugging help. */ @@ -1707,7 +1705,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, */ indirect_hdr = (void *) cmd->add_data; - ib_dma_sync_single_for_cpu(ibdev, req->indirect_dma_addr, + dma_sync_single_for_cpu(ibdev->dma_device, req->indirect_dma_addr, target->indirect_size, DMA_TO_DEVICE); memset(&state, 0, sizeof(state)); @@ -1789,7 +1787,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, else cmd->data_in_desc_cnt = count; - ib_dma_sync_single_for_device(ibdev, req->indirect_dma_addr, table_len, + dma_sync_single_for_device(ibdev->dma_device, req->indirect_dma_addr, table_len, DMA_TO_DEVICE); map_complete: @@ -2084,9 +2082,9 @@ static int srp_response_common(struct srp_rdma_ch *ch, s32 req_delta, return 1; } - ib_dma_sync_single_for_cpu(dev, iu->dma, len, DMA_TO_DEVICE); + dma_sync_single_for_cpu(dev->dma_device, iu->dma, len, DMA_TO_DEVICE); memcpy(iu->buf, rsp, len); - ib_dma_sync_single_for_device(dev, iu->dma, len, DMA_TO_DEVICE); + dma_sync_single_for_device(dev->dma_device, iu->dma, len, DMA_TO_DEVICE); err = srp_post_send(ch, iu, len); if (err) { @@ -2144,7 +2142,7 @@ static void srp_recv_done(struct ib_cq *cq, struct ib_wc *wc) return; } - ib_dma_sync_single_for_cpu(dev, iu->dma, ch->max_ti_iu_len, + dma_sync_single_for_cpu(dev->dma_device, iu->dma, ch->max_ti_iu_len, DMA_FROM_DEVICE); opcode = *(u8 *) iu->buf; @@ -2181,7 +2179,7 @@ static void srp_recv_done(struct ib_cq *cq, struct ib_wc *wc) break; } - ib_dma_sync_single_for_device(dev, iu->dma, ch->max_ti_iu_len, + dma_sync_single_for_device(dev->dma_device, iu->dma, ch->max_ti_iu_len, DMA_FROM_DEVICE); res = srp_post_recv(ch, iu); @@ -2267,7 +2265,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) req = &ch->req_ring[idx]; dev = target->srp_host->srp_dev->dev; - ib_dma_sync_single_for_cpu(dev, iu->dma, target->max_iu_len, + dma_sync_single_for_cpu(dev->dma_device, iu->dma, target->max_iu_len, DMA_TO_DEVICE); scmnd->host_scribble = (void *) req; @@ -2302,7 +2300,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) goto err_iu; } - ib_dma_sync_single_for_device(dev, iu->dma, target->max_iu_len, + dma_sync_single_for_device(dev->dma_device, iu->dma, target->max_iu_len, DMA_TO_DEVICE); if (srp_post_send(ch, iu, len)) { @@ -2689,7 +2687,7 @@ static int srp_send_tsk_mgmt(struct srp_rdma_ch *ch, u64 req_tag, u64 lun, return -1; } - ib_dma_sync_single_for_cpu(dev, iu->dma, sizeof *tsk_mgmt, + dma_sync_single_for_cpu(dev->dma_device, iu->dma, sizeof *tsk_mgmt, DMA_TO_DEVICE); tsk_mgmt = iu->buf; memset(tsk_mgmt, 0, sizeof *tsk_mgmt); @@ -2700,7 +2698,7 @@ static int srp_send_tsk_mgmt(struct srp_rdma_ch *ch, u64 req_tag, u64 lun, tsk_mgmt->tsk_mgmt_func = func; tsk_mgmt->task_tag = req_tag; - ib_dma_sync_single_for_device(dev, iu->dma, sizeof *tsk_mgmt, + dma_sync_single_for_device(dev->dma_device, iu->dma, sizeof *tsk_mgmt, DMA_TO_DEVICE); if (srp_post_send(ch, iu, sizeof(*tsk_mgmt))) { srp_put_tx_iu(ch, iu, SRP_IU_TSK_MGMT); diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 20444a7d867d..a1c2d602a4fa 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -626,8 +626,8 @@ static struct srpt_ioctx *srpt_alloc_ioctx(struct srpt_device *sdev, if (!ioctx->buf) goto err_free_ioctx; - ioctx->dma = ib_dma_map_single(sdev->device, ioctx->buf, dma_size, dir); - if (ib_dma_mapping_error(sdev->device, ioctx->dma)) + ioctx->dma = dma_map_single(sdev->device->dma_device, ioctx->buf, dma_size, dir); + if (dma_mapping_error(sdev->device->dma_device, ioctx->dma)) goto err_free_buf; return ioctx; @@ -649,7 +649,7 @@ static void srpt_free_ioctx(struct srpt_device *sdev, struct srpt_ioctx *ioctx, if (!ioctx) return; - ib_dma_unmap_single(sdev->device, ioctx->dma, dma_size, dir); + dma_unmap_single(sdev->device->dma_device, ioctx->dma, dma_size, dir); kfree(ioctx->buf); kfree(ioctx); } @@ -1492,7 +1492,7 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch, BUG_ON(!ch); BUG_ON(!recv_ioctx); - ib_dma_sync_single_for_cpu(ch->sport->sdev->device, + dma_sync_single_for_cpu(ch->sport->sdev->device->dma_device, recv_ioctx->ioctx.dma, srp_max_req_size, DMA_FROM_DEVICE); @@ -2385,7 +2385,7 @@ static void srpt_queue_response(struct se_cmd *cmd) goto out; } - ib_dma_sync_single_for_device(sdev->device, ioctx->ioctx.dma, resp_len, + dma_sync_single_for_device(sdev->device->dma_device, ioctx->ioctx.dma, resp_len, DMA_TO_DEVICE); sge.addr = ioctx->ioctx.dma; diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 208b6a08781c..de8156847327 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -207,7 +207,7 @@ static inline size_t nvme_rdma_inline_data_size(struct nvme_rdma_queue *queue) static void nvme_rdma_free_qe(struct ib_device *ibdev, struct nvme_rdma_qe *qe, size_t capsule_size, enum dma_data_direction dir) { - ib_dma_unmap_single(ibdev, qe->dma, capsule_size, dir); + dma_unmap_single(ibdev->dma_device, qe->dma, capsule_size, dir); kfree(qe->data); } @@ -218,8 +218,8 @@ static int nvme_rdma_alloc_qe(struct ib_device *ibdev, struct nvme_rdma_qe *qe, if (!qe->data) return -ENOMEM; - qe->dma = ib_dma_map_single(ibdev, qe->data, capsule_size, dir); - if (ib_dma_mapping_error(ibdev, qe->dma)) { + qe->dma = dma_map_single(ibdev->dma_device, qe->data, capsule_size, dir); + if (dma_mapping_error(ibdev->dma_device, qe->dma)) { kfree(qe->data); return -ENOMEM; } @@ -895,7 +895,7 @@ static void nvme_rdma_unmap_data(struct nvme_rdma_queue *queue, } } - ib_dma_unmap_sg(ibdev, req->sg_table.sgl, + dma_unmap_sg(ibdev->dma_device, req->sg_table.sgl, req->nents, rq_data_dir(rq) == WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE); @@ -1008,7 +1008,7 @@ static int nvme_rdma_map_data(struct nvme_rdma_queue *queue, req->nents = blk_rq_map_sg(rq->q, rq, req->sg_table.sgl); - count = ib_dma_map_sg(ibdev, req->sg_table.sgl, req->nents, + count = dma_map_sg(ibdev->dma_device, req->sg_table.sgl, req->nents, rq_data_dir(rq) == WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE); if (unlikely(count <= 0)) { sg_free_table_chained(&req->sg_table, true); @@ -1135,7 +1135,7 @@ static void nvme_rdma_submit_async_event(struct nvme_ctrl *arg, int aer_idx) if (WARN_ON_ONCE(aer_idx != 0)) return; - ib_dma_sync_single_for_cpu(dev, sqe->dma, sizeof(*cmd), DMA_TO_DEVICE); + dma_sync_single_for_cpu(dev->dma_device, sqe->dma, sizeof(*cmd), DMA_TO_DEVICE); memset(cmd, 0, sizeof(*cmd)); cmd->common.opcode = nvme_admin_async_event; @@ -1143,7 +1143,7 @@ static void nvme_rdma_submit_async_event(struct nvme_ctrl *arg, int aer_idx) cmd->common.flags |= NVME_CMD_SGL_METABUF; nvme_rdma_set_sg_null(cmd); - ib_dma_sync_single_for_device(dev, sqe->dma, sizeof(*cmd), + dma_sync_single_for_device(dev->dma_device, sqe->dma, sizeof(*cmd), DMA_TO_DEVICE); ret = nvme_rdma_post_send(queue, sqe, &sge, 1, NULL, false); @@ -1194,7 +1194,7 @@ static int __nvme_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc, int tag) return 0; } - ib_dma_sync_single_for_cpu(ibdev, qe->dma, len, DMA_FROM_DEVICE); + dma_sync_single_for_cpu(ibdev->dma_device, qe->dma, len, DMA_FROM_DEVICE); /* * AEN requests are special as they don't time out and can * survive any kind of queue freeze and often don't respond to @@ -1207,7 +1207,7 @@ static int __nvme_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc, int tag) &cqe->result); else ret = nvme_rdma_process_nvme_rsp(queue, cqe, wc, tag); - ib_dma_sync_single_for_device(ibdev, qe->dma, len, DMA_FROM_DEVICE); + dma_sync_single_for_device(ibdev->dma_device, qe->dma, len, DMA_FROM_DEVICE); nvme_rdma_post_recv(queue, qe); return ret; @@ -1455,7 +1455,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, return BLK_MQ_RQ_QUEUE_BUSY; dev = queue->device->dev; - ib_dma_sync_single_for_cpu(dev, sqe->dma, + dma_sync_single_for_cpu(dev->dma_device, sqe->dma, sizeof(struct nvme_command), DMA_TO_DEVICE); ret = nvme_setup_cmd(ns, rq, c); @@ -1473,7 +1473,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, goto err; } - ib_dma_sync_single_for_device(dev, sqe->dma, + dma_sync_single_for_device(dev->dma_device, sqe->dma, sizeof(struct nvme_command), DMA_TO_DEVICE); if (rq->cmd_type == REQ_TYPE_FS && req_op(rq) == REQ_OP_FLUSH) diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c index 8c3760a78ac0..447ba53a9c0b 100644 --- a/drivers/nvme/target/rdma.c +++ b/drivers/nvme/target/rdma.c @@ -246,9 +246,9 @@ static int nvmet_rdma_alloc_cmd(struct nvmet_rdma_device *ndev, if (!c->nvme_cmd) goto out; - c->sge[0].addr = ib_dma_map_single(ndev->device, c->nvme_cmd, + c->sge[0].addr = dma_map_single(ndev->device->dma_device, c->nvme_cmd, sizeof(*c->nvme_cmd), DMA_FROM_DEVICE); - if (ib_dma_mapping_error(ndev->device, c->sge[0].addr)) + if (dma_mapping_error(ndev->device->dma_device, c->sge[0].addr)) goto out_free_cmd; c->sge[0].length = sizeof(*c->nvme_cmd); @@ -259,10 +259,10 @@ static int nvmet_rdma_alloc_cmd(struct nvmet_rdma_device *ndev, get_order(NVMET_RDMA_INLINE_DATA_SIZE)); if (!c->inline_page) goto out_unmap_cmd; - c->sge[1].addr = ib_dma_map_page(ndev->device, + c->sge[1].addr = dma_map_page(ndev->device->dma_device, c->inline_page, 0, NVMET_RDMA_INLINE_DATA_SIZE, DMA_FROM_DEVICE); - if (ib_dma_mapping_error(ndev->device, c->sge[1].addr)) + if (dma_mapping_error(ndev->device->dma_device, c->sge[1].addr)) goto out_free_inline_page; c->sge[1].length = NVMET_RDMA_INLINE_DATA_SIZE; c->sge[1].lkey = ndev->pd->local_dma_lkey; @@ -282,7 +282,7 @@ static int nvmet_rdma_alloc_cmd(struct nvmet_rdma_device *ndev, get_order(NVMET_RDMA_INLINE_DATA_SIZE)); } out_unmap_cmd: - ib_dma_unmap_single(ndev->device, c->sge[0].addr, + dma_unmap_single(ndev->device->dma_device, c->sge[0].addr, sizeof(*c->nvme_cmd), DMA_FROM_DEVICE); out_free_cmd: kfree(c->nvme_cmd); @@ -295,12 +295,12 @@ static void nvmet_rdma_free_cmd(struct nvmet_rdma_device *ndev, struct nvmet_rdma_cmd *c, bool admin) { if (!admin) { - ib_dma_unmap_page(ndev->device, c->sge[1].addr, + dma_unmap_page(ndev->device->dma_device, c->sge[1].addr, NVMET_RDMA_INLINE_DATA_SIZE, DMA_FROM_DEVICE); __free_pages(c->inline_page, get_order(NVMET_RDMA_INLINE_DATA_SIZE)); } - ib_dma_unmap_single(ndev->device, c->sge[0].addr, + dma_unmap_single(ndev->device->dma_device, c->sge[0].addr, sizeof(*c->nvme_cmd), DMA_FROM_DEVICE); kfree(c->nvme_cmd); } @@ -350,9 +350,9 @@ static int nvmet_rdma_alloc_rsp(struct nvmet_rdma_device *ndev, if (!r->req.rsp) goto out; - r->send_sge.addr = ib_dma_map_single(ndev->device, r->req.rsp, + r->send_sge.addr = dma_map_single(ndev->device->dma_device, r->req.rsp, sizeof(*r->req.rsp), DMA_TO_DEVICE); - if (ib_dma_mapping_error(ndev->device, r->send_sge.addr)) + if (dma_mapping_error(ndev->device->dma_device, r->send_sge.addr)) goto out_free_rsp; r->send_sge.length = sizeof(*r->req.rsp); @@ -378,7 +378,7 @@ static int nvmet_rdma_alloc_rsp(struct nvmet_rdma_device *ndev, static void nvmet_rdma_free_rsp(struct nvmet_rdma_device *ndev, struct nvmet_rdma_rsp *r) { - ib_dma_unmap_single(ndev->device, r->send_sge.addr, + dma_unmap_single(ndev->device->dma_device, r->send_sge.addr, sizeof(*r->req.rsp), DMA_TO_DEVICE); kfree(r->req.rsp); } diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 14576977200f..f2c0c60eee1d 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -925,21 +925,21 @@ kiblnd_rd_msg_size(struct kib_rdma_desc *rd, int msgtype, int n) static inline __u64 kiblnd_dma_mapping_error(struct ib_device *dev, u64 dma_addr) { - return ib_dma_mapping_error(dev, dma_addr); + return dma_mapping_error(dev->dma_device, dma_addr); } static inline __u64 kiblnd_dma_map_single(struct ib_device *dev, void *msg, size_t size, enum dma_data_direction direction) { - return ib_dma_map_single(dev, msg, size, direction); + return dma_map_single(dev->dma_device, msg, size, direction); } static inline void kiblnd_dma_unmap_single(struct ib_device *dev, __u64 addr, size_t size, enum dma_data_direction direction) { - ib_dma_unmap_single(dev, addr, size, direction); + dma_unmap_single(dev->dma_device, addr, size, direction); } #define KIBLND_UNMAP_ADDR_SET(p, m, a) do {} while (0) @@ -949,26 +949,26 @@ static inline int kiblnd_dma_map_sg(struct ib_device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction) { - return ib_dma_map_sg(dev, sg, nents, direction); + return dma_map_sg(dev->dma_device, sg, nents, direction); } static inline void kiblnd_dma_unmap_sg(struct ib_device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction) { - ib_dma_unmap_sg(dev, sg, nents, direction); + dma_unmap_sg(dev->dma_device, sg, nents, direction); } static inline __u64 kiblnd_sg_dma_address(struct ib_device *dev, struct scatterlist *sg) { - return ib_sg_dma_address(dev, sg); + return sg_dma_address(sg); } static inline unsigned int kiblnd_sg_dma_len(struct ib_device *dev, struct scatterlist *sg) { - return ib_sg_dma_len(dev, sg); + return sg_dma_len(sg); } /* XXX We use KIBLND_CONN_PARAM(e) as writable buffer, it's not strictly */ diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index de8dfb61d2b6..b4b83603b5df 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2912,224 +2912,6 @@ static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt) } /** - * ib_dma_mapping_error - check a DMA addr for error - * @dev: The device for which the dma_addr was created - * @dma_addr: The DMA address to check - */ -static inline int ib_dma_mapping_error(struct ib_device *dev, u64 dma_addr) -{ - return dma_mapping_error(dev->dma_device, dma_addr); -} - -/** - * ib_dma_map_single - Map a kernel virtual address to DMA address - * @dev: The device for which the dma_addr is to be created - * @cpu_addr: The kernel virtual address - * @size: The size of the region in bytes - * @direction: The direction of the DMA - */ -static inline u64 ib_dma_map_single(struct ib_device *dev, - void *cpu_addr, size_t size, - enum dma_data_direction direction) -{ - return dma_map_single(dev->dma_device, cpu_addr, size, direction); -} - -/** - * ib_dma_unmap_single - Destroy a mapping created by ib_dma_map_single() - * @dev: The device for which the DMA address was created - * @addr: The DMA address - * @size: The size of the region in bytes - * @direction: The direction of the DMA - */ -static inline void ib_dma_unmap_single(struct ib_device *dev, - u64 addr, size_t size, - enum dma_data_direction direction) -{ - dma_unmap_single(dev->dma_device, addr, size, direction); -} - -static inline u64 ib_dma_map_single_attrs(struct ib_device *dev, - void *cpu_addr, size_t size, - enum dma_data_direction direction, - unsigned long dma_attrs) -{ - return dma_map_single_attrs(dev->dma_device, cpu_addr, size, - direction, dma_attrs); -} - -static inline void ib_dma_unmap_single_attrs(struct ib_device *dev, - u64 addr, size_t size, - enum dma_data_direction direction, - unsigned long dma_attrs) -{ - return dma_unmap_single_attrs(dev->dma_device, addr, size, - direction, dma_attrs); -} - -/** - * ib_dma_map_page - Map a physical page to DMA address - * @dev: The device for which the dma_addr is to be created - * @page: The page to be mapped - * @offset: The offset within the page - * @size: The size of the region in bytes - * @direction: The direction of the DMA - */ -static inline u64 ib_dma_map_page(struct ib_device *dev, - struct page *page, - unsigned long offset, - size_t size, - enum dma_data_direction direction) -{ - return dma_map_page(dev->dma_device, page, offset, size, direction); -} - -/** - * ib_dma_unmap_page - Destroy a mapping created by ib_dma_map_page() - * @dev: The device for which the DMA address was created - * @addr: The DMA address - * @size: The size of the region in bytes - * @direction: The direction of the DMA - */ -static inline void ib_dma_unmap_page(struct ib_device *dev, - u64 addr, size_t size, - enum dma_data_direction direction) -{ - dma_unmap_page(dev->dma_device, addr, size, direction); -} - -/** - * ib_dma_map_sg - Map a scatter/gather list to DMA addresses - * @dev: The device for which the DMA addresses are to be created - * @sg: The array of scatter/gather entries - * @nents: The number of scatter/gather entries - * @direction: The direction of the DMA - */ -static inline int ib_dma_map_sg(struct ib_device *dev, - struct scatterlist *sg, int nents, - enum dma_data_direction direction) -{ - return dma_map_sg(dev->dma_device, sg, nents, direction); -} - -/** - * ib_dma_unmap_sg - Unmap a scatter/gather list of DMA addresses - * @dev: The device for which the DMA addresses were created - * @sg: The array of scatter/gather entries - * @nents: The number of scatter/gather entries - * @direction: The direction of the DMA - */ -static inline void ib_dma_unmap_sg(struct ib_device *dev, - struct scatterlist *sg, int nents, - enum dma_data_direction direction) -{ - dma_unmap_sg(dev->dma_device, sg, nents, direction); -} - -static inline int ib_dma_map_sg_attrs(struct ib_device *dev, - struct scatterlist *sg, int nents, - enum dma_data_direction direction, - unsigned long dma_attrs) -{ - return dma_map_sg_attrs(dev->dma_device, sg, nents, direction, - dma_attrs); -} - -static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev, - struct scatterlist *sg, int nents, - enum dma_data_direction direction, - unsigned long dma_attrs) -{ - dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction, dma_attrs); -} -/** - * ib_sg_dma_address - Return the DMA address from a scatter/gather entry - * @dev: The device for which the DMA addresses were created - * @sg: The scatter/gather entry - * - * Note: this function is obsolete. To do: change all occurrences of - * ib_sg_dma_address() into sg_dma_address(). - */ -static inline u64 ib_sg_dma_address(struct ib_device *dev, - struct scatterlist *sg) -{ - return sg_dma_address(sg); -} - -/** - * ib_sg_dma_len - Return the DMA length from a scatter/gather entry - * @dev: The device for which the DMA addresses were created - * @sg: The scatter/gather entry - * - * Note: this function is obsolete. To do: change all occurrences of - * ib_sg_dma_len() into sg_dma_len(). - */ -static inline unsigned int ib_sg_dma_len(struct ib_device *dev, - struct scatterlist *sg) -{ - return sg_dma_len(sg); -} - -/** - * ib_dma_sync_single_for_cpu - Prepare DMA region to be accessed by CPU - * @dev: The device for which the DMA address was created - * @addr: The DMA address - * @size: The size of the region in bytes - * @dir: The direction of the DMA - */ -static inline void ib_dma_sync_single_for_cpu(struct ib_device *dev, - u64 addr, - size_t size, - enum dma_data_direction dir) -{ - dma_sync_single_for_cpu(dev->dma_device, addr, size, dir); -} - -/** - * ib_dma_sync_single_for_device - Prepare DMA region to be accessed by device - * @dev: The device for which the DMA address was created - * @addr: The DMA address - * @size: The size of the region in bytes - * @dir: The direction of the DMA - */ -static inline void ib_dma_sync_single_for_device(struct ib_device *dev, - u64 addr, - size_t size, - enum dma_data_direction dir) -{ - dma_sync_single_for_device(dev->dma_device, addr, size, dir); -} - -/** - * ib_dma_alloc_coherent - Allocate memory and map it for DMA - * @dev: The device for which the DMA address is requested - * @size: The size of the region to allocate in bytes - * @dma_handle: A pointer for returning the DMA address of the region - * @flag: memory allocator flags - */ -static inline void *ib_dma_alloc_coherent(struct ib_device *dev, - size_t size, - dma_addr_t *dma_handle, - gfp_t flag) -{ - return dma_alloc_coherent(dev->dma_device, size, dma_handle, flag); -} - -/** - * ib_dma_free_coherent - Free memory allocated by ib_dma_alloc_coherent() - * @dev: The device for which the DMA addresses were allocated - * @size: The size of the region - * @cpu_addr: the address returned by ib_dma_alloc_coherent() - * @dma_handle: the DMA address returned by ib_dma_alloc_coherent() - */ -static inline void ib_dma_free_coherent(struct ib_device *dev, - size_t size, void *cpu_addr, - dma_addr_t dma_handle) -{ - dma_free_coherent(dev->dma_device, size, cpu_addr, dma_handle); -} - -/** * ib_dereg_mr - Deregisters a memory region and removes it from the * HCA translation table. * @mr: The memory region to deregister. diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index 553ed4ecb6a0..38b45a37ed18 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -294,7 +294,7 @@ recv_done(struct ib_cq *cq, struct ib_wc *wc) int16_t tag; req = NULL; - ib_dma_unmap_single(rdma->cm_id->device, c->busa, client->msize, + dma_unmap_single(rdma->cm_id->device->dma_device, c->busa, client->msize, DMA_FROM_DEVICE); if (wc->status != IB_WC_SUCCESS) @@ -339,7 +339,7 @@ send_done(struct ib_cq *cq, struct ib_wc *wc) struct p9_rdma_context *c = container_of(wc->wr_cqe, struct p9_rdma_context, cqe); - ib_dma_unmap_single(rdma->cm_id->device, + dma_unmap_single(rdma->cm_id->device->dma_device, c->busa, c->req->tc->size, DMA_TO_DEVICE); up(&rdma->sq_sem); @@ -379,10 +379,10 @@ post_recv(struct p9_client *client, struct p9_rdma_context *c) struct ib_recv_wr wr, *bad_wr; struct ib_sge sge; - c->busa = ib_dma_map_single(rdma->cm_id->device, + c->busa = dma_map_single(rdma->cm_id->device->dma_device, c->rc->sdata, client->msize, DMA_FROM_DEVICE); - if (ib_dma_mapping_error(rdma->cm_id->device, c->busa)) + if (dma_mapping_error(rdma->cm_id->device->dma_device, c->busa)) goto error; c->cqe.done = recv_done; @@ -469,10 +469,10 @@ static int rdma_request(struct p9_client *client, struct p9_req_t *req) } c->req = req; - c->busa = ib_dma_map_single(rdma->cm_id->device, + c->busa = dma_map_single(rdma->cm_id->device->dma_device, c->req->tc->sdata, c->req->tc->size, DMA_TO_DEVICE); - if (ib_dma_mapping_error(rdma->cm_id->device, c->busa)) { + if (dma_mapping_error(rdma->cm_id->device->dma_device, c->busa)) { err = -EIO; goto send_error; } diff --git a/net/rds/ib.h b/net/rds/ib.h index d21ca88ab628..02e5fe8d6af8 100644 --- a/net/rds/ib.h +++ b/net/rds/ib.h @@ -275,45 +275,6 @@ struct rds_ib_statistics { extern struct workqueue_struct *rds_ib_wq; -/* - * Fake ib_dma_sync_sg_for_{cpu,device} as long as ib_verbs.h - * doesn't define it. - */ -static inline void rds_ib_dma_sync_sg_for_cpu(struct ib_device *dev, - struct scatterlist *sglist, - unsigned int sg_dma_len, - int direction) -{ - struct scatterlist *sg; - unsigned int i; - - for_each_sg(sglist, sg, sg_dma_len, i) { - ib_dma_sync_single_for_cpu(dev, - ib_sg_dma_address(dev, sg), - ib_sg_dma_len(dev, sg), - direction); - } -} -#define ib_dma_sync_sg_for_cpu rds_ib_dma_sync_sg_for_cpu - -static inline void rds_ib_dma_sync_sg_for_device(struct ib_device *dev, - struct scatterlist *sglist, - unsigned int sg_dma_len, - int direction) -{ - struct scatterlist *sg; - unsigned int i; - - for_each_sg(sglist, sg, sg_dma_len, i) { - ib_dma_sync_single_for_device(dev, - ib_sg_dma_address(dev, sg), - ib_sg_dma_len(dev, sg), - direction); - } -} -#define ib_dma_sync_sg_for_device rds_ib_dma_sync_sg_for_device - - /* ib.c */ extern struct rds_transport rds_ib_transport; struct rds_ib_device *rds_ib_get_client_data(struct ib_device *device); diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c index 5b2ab95afa07..7bd69104e8ba 100644 --- a/net/rds/ib_cm.c +++ b/net/rds/ib_cm.c @@ -456,31 +456,31 @@ static int rds_ib_setup_qp(struct rds_connection *conn) goto out; } - ic->i_send_hdrs = ib_dma_alloc_coherent(dev, + ic->i_send_hdrs = dma_alloc_coherent(dev->dma_device, ic->i_send_ring.w_nr * sizeof(struct rds_header), &ic->i_send_hdrs_dma, GFP_KERNEL); if (!ic->i_send_hdrs) { ret = -ENOMEM; - rdsdebug("ib_dma_alloc_coherent send failed\n"); + rdsdebug("dma_alloc_coherent send failed\n"); goto out; } - ic->i_recv_hdrs = ib_dma_alloc_coherent(dev, + ic->i_recv_hdrs = dma_alloc_coherent(dev->dma_device, ic->i_recv_ring.w_nr * sizeof(struct rds_header), &ic->i_recv_hdrs_dma, GFP_KERNEL); if (!ic->i_recv_hdrs) { ret = -ENOMEM; - rdsdebug("ib_dma_alloc_coherent recv failed\n"); + rdsdebug("dma_alloc_coherent recv failed\n"); goto out; } - ic->i_ack = ib_dma_alloc_coherent(dev, sizeof(struct rds_header), + ic->i_ack = dma_alloc_coherent(dev->dma_device, sizeof(struct rds_header), &ic->i_ack_dma, GFP_KERNEL); if (!ic->i_ack) { ret = -ENOMEM; - rdsdebug("ib_dma_alloc_coherent ack failed\n"); + rdsdebug("dma_alloc_coherent ack failed\n"); goto out; } @@ -781,21 +781,21 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp) /* then free the resources that ib callbacks use */ if (ic->i_send_hdrs) - ib_dma_free_coherent(dev, + dma_free_coherent(dev->dma_device, ic->i_send_ring.w_nr * sizeof(struct rds_header), ic->i_send_hdrs, ic->i_send_hdrs_dma); if (ic->i_recv_hdrs) - ib_dma_free_coherent(dev, + dma_free_coherent(dev->dma_device, ic->i_recv_ring.w_nr * sizeof(struct rds_header), ic->i_recv_hdrs, ic->i_recv_hdrs_dma); if (ic->i_ack) - ib_dma_free_coherent(dev, sizeof(struct rds_header), + dma_free_coherent(dev->dma_device, sizeof(struct rds_header), ic->i_ack, ic->i_ack_dma); if (ic->i_sends) diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c index 4fe8f4fec4ee..150e8f756bd9 100644 --- a/net/rds/ib_fmr.c +++ b/net/rds/ib_fmr.c @@ -100,7 +100,7 @@ int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, struct rds_ib_mr *ibmr, int i, j; int ret; - sg_dma_len = ib_dma_map_sg(dev, sg, nents, DMA_BIDIRECTIONAL); + sg_dma_len = dma_map_sg(dev->dma_device, sg, nents, DMA_BIDIRECTIONAL); if (unlikely(!sg_dma_len)) { pr_warn("RDS/IB: %s failed!\n", __func__); return -EBUSY; @@ -110,8 +110,8 @@ int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, struct rds_ib_mr *ibmr, page_cnt = 0; for (i = 0; i < sg_dma_len; ++i) { - unsigned int dma_len = ib_sg_dma_len(dev, &scat[i]); - u64 dma_addr = ib_sg_dma_address(dev, &scat[i]); + unsigned int dma_len = sg_dma_len(&scat[i]); + u64 dma_addr = sg_dma_address(&scat[i]); if (dma_addr & ~PAGE_MASK) { if (i > 0) @@ -140,8 +140,8 @@ int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, struct rds_ib_mr *ibmr, page_cnt = 0; for (i = 0; i < sg_dma_len; ++i) { - unsigned int dma_len = ib_sg_dma_len(dev, &scat[i]); - u64 dma_addr = ib_sg_dma_address(dev, &scat[i]); + unsigned int dma_len = sg_dma_len(&scat[i]); + u64 dma_addr = sg_dma_address(&scat[i]); for (j = 0; j < dma_len; j += PAGE_SIZE) dma_pages[page_cnt++] = diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c index d921adc62765..e30a8c6f003f 100644 --- a/net/rds/ib_frmr.c +++ b/net/rds/ib_frmr.c @@ -169,7 +169,7 @@ static int rds_ib_map_frmr(struct rds_ib_device *rds_ibdev, ibmr->sg_dma_len = 0; frmr->sg_byte_len = 0; WARN_ON(ibmr->sg_dma_len); - ibmr->sg_dma_len = ib_dma_map_sg(dev, ibmr->sg, ibmr->sg_len, + ibmr->sg_dma_len = dma_map_sg(dev->dma_device, ibmr->sg, ibmr->sg_len, DMA_BIDIRECTIONAL); if (unlikely(!ibmr->sg_dma_len)) { pr_warn("RDS/IB: %s failed!\n", __func__); @@ -182,8 +182,8 @@ static int rds_ib_map_frmr(struct rds_ib_device *rds_ibdev, ret = -EINVAL; for (i = 0; i < ibmr->sg_dma_len; ++i) { - unsigned int dma_len = ib_sg_dma_len(dev, &ibmr->sg[i]); - u64 dma_addr = ib_sg_dma_address(dev, &ibmr->sg[i]); + unsigned int dma_len = sg_dma_len(&ibmr->sg[i]); + u64 dma_addr = sg_dma_address(&ibmr->sg[i]); frmr->sg_byte_len += dma_len; if (dma_addr & ~PAGE_MASK) { @@ -221,7 +221,7 @@ static int rds_ib_map_frmr(struct rds_ib_device *rds_ibdev, return ret; out_unmap: - ib_dma_unmap_sg(rds_ibdev->dev, ibmr->sg, ibmr->sg_len, + dma_unmap_sg(rds_ibdev->dev->dma_device, ibmr->sg, ibmr->sg_len, DMA_BIDIRECTIONAL); ibmr->sg_dma_len = 0; return ret; diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c index 977f69886c00..b8276915ab3d 100644 --- a/net/rds/ib_rdma.c +++ b/net/rds/ib_rdma.c @@ -221,11 +221,11 @@ void rds_ib_sync_mr(void *trans_private, int direction) switch (direction) { case DMA_FROM_DEVICE: - ib_dma_sync_sg_for_cpu(rds_ibdev->dev, ibmr->sg, + dma_sync_sg_for_cpu(rds_ibdev->dev->dma_device, ibmr->sg, ibmr->sg_dma_len, DMA_BIDIRECTIONAL); break; case DMA_TO_DEVICE: - ib_dma_sync_sg_for_device(rds_ibdev->dev, ibmr->sg, + dma_sync_sg_for_device(rds_ibdev->dev->dma_device, ibmr->sg, ibmr->sg_dma_len, DMA_BIDIRECTIONAL); break; } @@ -236,7 +236,7 @@ void __rds_ib_teardown_mr(struct rds_ib_mr *ibmr) struct rds_ib_device *rds_ibdev = ibmr->device; if (ibmr->sg_dma_len) { - ib_dma_unmap_sg(rds_ibdev->dev, + dma_unmap_sg(rds_ibdev->dev->dma_device, ibmr->sg, ibmr->sg_len, DMA_BIDIRECTIONAL); ibmr->sg_dma_len = 0; diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index 606a11f681d2..374a4e038b24 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -225,7 +225,7 @@ static void rds_ib_recv_clear_one(struct rds_ib_connection *ic, recv->r_ibinc = NULL; } if (recv->r_frag) { - ib_dma_unmap_sg(ic->i_cm_id->device, &recv->r_frag->f_sg, 1, DMA_FROM_DEVICE); + dma_unmap_sg(ic->i_cm_id->device->dma_device, &recv->r_frag->f_sg, 1, DMA_FROM_DEVICE); rds_ib_frag_free(ic, recv->r_frag); recv->r_frag = NULL; } @@ -331,7 +331,7 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn, if (!recv->r_frag) goto out; - ret = ib_dma_map_sg(ic->i_cm_id->device, &recv->r_frag->f_sg, + ret = dma_map_sg(ic->i_cm_id->device->dma_device, &recv->r_frag->f_sg, 1, DMA_FROM_DEVICE); WARN_ON(ret != 1); @@ -340,8 +340,8 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn, sge->length = sizeof(struct rds_header); sge = &recv->r_sge[1]; - sge->addr = ib_sg_dma_address(ic->i_cm_id->device, &recv->r_frag->f_sg); - sge->length = ib_sg_dma_len(ic->i_cm_id->device, &recv->r_frag->f_sg); + sge->addr = sg_dma_address(&recv->r_frag->f_sg); + sge->length = sg_dma_len(&recv->r_frag->f_sg); ret = 0; out: @@ -408,9 +408,7 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp) ret = ib_post_recv(ic->i_cm_id->qp, &recv->r_wr, &failed_wr); rdsdebug("recv %p ibinc %p page %p addr %lu ret %d\n", recv, recv->r_ibinc, sg_page(&recv->r_frag->f_sg), - (long) ib_sg_dma_address( - ic->i_cm_id->device, - &recv->r_frag->f_sg), + (long) sg_dma_address(&recv->r_frag->f_sg), ret); if (ret) { rds_ib_conn_error(conn, "recv post on " @@ -968,7 +966,7 @@ void rds_ib_recv_cqe_handler(struct rds_ib_connection *ic, rds_ib_stats_inc(s_ib_rx_cq_event); recv = &ic->i_recvs[rds_ib_ring_oldest(&ic->i_recv_ring)]; - ib_dma_unmap_sg(ic->i_cm_id->device, &recv->r_frag->f_sg, 1, + dma_unmap_sg(ic->i_cm_id->device->dma_device, &recv->r_frag->f_sg, 1, DMA_FROM_DEVICE); /* Also process recvs in connecting state because it is possible diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c index 84d90c97332f..bd23633e5c7a 100644 --- a/net/rds/ib_send.c +++ b/net/rds/ib_send.c @@ -74,7 +74,7 @@ static void rds_ib_send_unmap_data(struct rds_ib_connection *ic, int wc_status) { if (op->op_nents) - ib_dma_unmap_sg(ic->i_cm_id->device, + dma_unmap_sg(ic->i_cm_id->device->dma_device, op->op_sg, op->op_nents, DMA_TO_DEVICE); } @@ -84,7 +84,7 @@ static void rds_ib_send_unmap_rdma(struct rds_ib_connection *ic, int wc_status) { if (op->op_mapped) { - ib_dma_unmap_sg(ic->i_cm_id->device, + dma_unmap_sg(ic->i_cm_id->device->dma_device, op->op_sg, op->op_nents, op->op_write ? DMA_TO_DEVICE : DMA_FROM_DEVICE); op->op_mapped = 0; @@ -106,7 +106,7 @@ static void rds_ib_send_unmap_rdma(struct rds_ib_connection *ic, * handling in the ACK processing code. * * Note: There's no need to explicitly sync any RDMA buffers using - * ib_dma_sync_sg_for_cpu - the completion for the RDMA + * dma_sync_sg_for_cpu - the completion for the RDMA * operation itself unmapped the RDMA buffers, which takes care * of synching. */ @@ -125,7 +125,7 @@ static void rds_ib_send_unmap_atomic(struct rds_ib_connection *ic, { /* unmap atomic recvbuf */ if (op->op_mapped) { - ib_dma_unmap_sg(ic->i_cm_id->device, op->op_sg, 1, + dma_unmap_sg(ic->i_cm_id->device->dma_device, op->op_sg, 1, DMA_FROM_DEVICE); op->op_mapped = 0; } @@ -546,7 +546,7 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, /* map the message the first time we see it */ if (!ic->i_data_op) { if (rm->data.op_nents) { - rm->data.op_count = ib_dma_map_sg(dev, + rm->data.op_count = dma_map_sg(dev->dma_device, rm->data.op_sg, rm->data.op_nents, DMA_TO_DEVICE); @@ -640,16 +640,16 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, if (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]) { len = min(RDS_FRAG_SIZE, - ib_sg_dma_len(dev, scat) - rm->data.op_dmaoff); + sg_dma_len(scat) - rm->data.op_dmaoff); send->s_wr.num_sge = 2; - send->s_sge[1].addr = ib_sg_dma_address(dev, scat); + send->s_sge[1].addr = sg_dma_address(scat); send->s_sge[1].addr += rm->data.op_dmaoff; send->s_sge[1].length = len; bytes_sent += len; rm->data.op_dmaoff += len; - if (rm->data.op_dmaoff == ib_sg_dma_len(dev, scat)) { + if (rm->data.op_dmaoff == sg_dma_len(scat)) { scat++; rm->data.op_dmasg++; rm->data.op_dmaoff = 0; @@ -797,7 +797,7 @@ int rds_ib_xmit_atomic(struct rds_connection *conn, struct rm_atomic_op *op) rds_message_addref(container_of(send->s_op, struct rds_message, atomic)); /* map 8 byte retval buffer to the device */ - ret = ib_dma_map_sg(ic->i_cm_id->device, op->op_sg, 1, DMA_FROM_DEVICE); + ret = dma_map_sg(ic->i_cm_id->device->dma_device, op->op_sg, 1, DMA_FROM_DEVICE); rdsdebug("ic %p mapping atomic op %p. mapped %d pg\n", ic, op, ret); if (ret != 1) { rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc); @@ -807,8 +807,8 @@ int rds_ib_xmit_atomic(struct rds_connection *conn, struct rm_atomic_op *op) } /* Convert our struct scatterlist to struct ib_sge */ - send->s_sge[0].addr = ib_sg_dma_address(ic->i_cm_id->device, op->op_sg); - send->s_sge[0].length = ib_sg_dma_len(ic->i_cm_id->device, op->op_sg); + send->s_sge[0].addr = sg_dma_address(op->op_sg); + send->s_sge[0].length = sg_dma_len(op->op_sg); send->s_sge[0].lkey = ic->i_pd->local_dma_lkey; rdsdebug("rva %Lx rpa %Lx len %u\n", op->op_remote_addr, @@ -861,7 +861,7 @@ int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op) /* map the op the first time we see it */ if (!op->op_mapped) { - op->op_count = ib_dma_map_sg(ic->i_cm_id->device, + op->op_count = dma_map_sg(ic->i_cm_id->device->dma_device, op->op_sg, op->op_nents, (op->op_write) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); rdsdebug("ic %p mapping op %p: %d\n", ic, op, op->op_count); @@ -920,9 +920,9 @@ int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op) for (j = 0; j < send->s_rdma_wr.wr.num_sge && scat != &op->op_sg[op->op_count]; j++) { - len = ib_sg_dma_len(ic->i_cm_id->device, scat); + len = sg_dma_len(scat); send->s_sge[j].addr = - ib_sg_dma_address(ic->i_cm_id->device, scat); + sg_dma_address(scat); send->s_sge[j].length = len; send->s_sge[j].lkey = ic->i_pd->local_dma_lkey; diff --git a/net/sunrpc/xprtrdma/fmr_ops.c b/net/sunrpc/xprtrdma/fmr_ops.c index 1ebb09e1ac4f..e47bf78ec478 100644 --- a/net/sunrpc/xprtrdma/fmr_ops.c +++ b/net/sunrpc/xprtrdma/fmr_ops.c @@ -136,7 +136,7 @@ fmr_op_recover_mr(struct rpcrdma_mw *mw) rc = __fmr_unmap(mw); /* ORDER: then DMA unmap */ - ib_dma_unmap_sg(r_xprt->rx_ia.ri_device, + dma_unmap_sg(r_xprt->rx_ia.ri_device->dma_device, mw->mw_sg, mw->mw_nents, mw->mw_dir); if (rc) goto out_release; @@ -218,7 +218,7 @@ fmr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg, if (i == 0) goto out_dmamap_err; - if (!ib_dma_map_sg(r_xprt->rx_ia.ri_device, + if (!dma_map_sg(r_xprt->rx_ia.ri_device->dma_device, mw->mw_sg, mw->mw_nents, mw->mw_dir)) goto out_dmamap_err; @@ -284,7 +284,7 @@ fmr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) list_for_each_entry_safe(mw, tmp, &req->rl_registered, mw_list) { list_del_init(&mw->mw_list); list_del_init(&mw->fmr.fm_mr->list); - ib_dma_unmap_sg(r_xprt->rx_ia.ri_device, + dma_unmap_sg(r_xprt->rx_ia.ri_device->dma_device, mw->mw_sg, mw->mw_nents, mw->mw_dir); rpcrdma_put_mw(r_xprt, mw); } diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index 47bed5333c7f..65863a52a070 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -182,7 +182,7 @@ frwr_op_recover_mr(struct rpcrdma_mw *mw) rc = __frwr_reset_mr(ia, mw); if (state != FRMR_FLUSHED_LI) - ib_dma_unmap_sg(ia->ri_device, + dma_unmap_sg(ia->ri_device->dma_device, mw->mw_sg, mw->mw_nents, mw->mw_dir); if (rc) goto out_release; @@ -396,7 +396,7 @@ frwr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg, if (i == 0) goto out_dmamap_err; - dma_nents = ib_dma_map_sg(ia->ri_device, + dma_nents = dma_map_sg(ia->ri_device->dma_device, mw->mw_sg, mw->mw_nents, mw->mw_dir); if (!dma_nents) goto out_dmamap_err; @@ -538,7 +538,7 @@ frwr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) dprintk("RPC: %s: DMA unmapping frmr %p\n", __func__, &mw->frmr); list_del_init(&mw->mw_list); - ib_dma_unmap_sg(ia->ri_device, + dma_unmap_sg(ia->ri_device->dma_device, mw->mw_sg, mw->mw_nents, mw->mw_dir); rpcrdma_put_mw(r_xprt, mw); } diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index c52e0f2ffe52..8dbc42bd0080 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -476,7 +476,7 @@ rpcrdma_prepare_hdr_sge(struct rpcrdma_ia *ia, struct rpcrdma_req *req, } sge->length = len; - ib_dma_sync_single_for_device(ia->ri_device, sge->addr, + dma_sync_single_for_device(ia->ri_device->dma_device, sge->addr, sge->length, DMA_TO_DEVICE); req->rl_send_wr.num_sge++; return true; @@ -505,7 +505,7 @@ rpcrdma_prepare_msg_sges(struct rpcrdma_ia *ia, struct rpcrdma_req *req, sge[sge_no].addr = rdmab_addr(rb); sge[sge_no].length = xdr->head[0].iov_len; sge[sge_no].lkey = rdmab_lkey(rb); - ib_dma_sync_single_for_device(device, sge[sge_no].addr, + dma_sync_single_for_device(device->dma_device, sge[sge_no].addr, sge[sge_no].length, DMA_TO_DEVICE); /* If there is a Read chunk, the page list is being handled @@ -547,10 +547,10 @@ rpcrdma_prepare_msg_sges(struct rpcrdma_ia *ia, struct rpcrdma_req *req, goto out_mapping_overflow; len = min_t(u32, PAGE_SIZE - page_base, remaining); - sge[sge_no].addr = ib_dma_map_page(device, *ppages, + sge[sge_no].addr = dma_map_page(device->dma_device, *ppages, page_base, len, DMA_TO_DEVICE); - if (ib_dma_mapping_error(device, sge[sge_no].addr)) + if (dma_mapping_error(device->dma_device, sge[sge_no].addr)) goto out_mapping_err; sge[sge_no].length = len; sge[sge_no].lkey = lkey; @@ -574,10 +574,10 @@ rpcrdma_prepare_msg_sges(struct rpcrdma_ia *ia, struct rpcrdma_req *req, map_tail: sge_no++; - sge[sge_no].addr = ib_dma_map_page(device, page, + sge[sge_no].addr = dma_map_page(device->dma_device, page, page_base, len, DMA_TO_DEVICE); - if (ib_dma_mapping_error(device, sge[sge_no].addr)) + if (dma_mapping_error(device->dma_device, sge[sge_no].addr)) goto out_mapping_err; sge[sge_no].length = len; sge[sge_no].lkey = lkey; @@ -628,7 +628,7 @@ rpcrdma_unmap_sges(struct rpcrdma_ia *ia, struct rpcrdma_req *req) sge = &req->rl_send_sge[2]; for (count = req->rl_mapped_sges; count--; sge++) - ib_dma_unmap_page(device, sge->addr, sge->length, + dma_unmap_page(device->dma_device, sge->addr, sge->length, DMA_TO_DEVICE); req->rl_mapped_sges = 0; } diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c index 288e35c2d8f4..73f33fe09bbf 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c @@ -123,9 +123,9 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, ctxt->sge[0].lkey = rdma->sc_pd->local_dma_lkey; ctxt->sge[0].length = sndbuf->len; ctxt->sge[0].addr = - ib_dma_map_page(rdma->sc_cm_id->device, ctxt->pages[0], 0, + dma_map_page(rdma->sc_cm_id->device->dma_device, ctxt->pages[0], 0, sndbuf->len, DMA_TO_DEVICE); - if (ib_dma_mapping_error(rdma->sc_cm_id->device, ctxt->sge[0].addr)) { + if (dma_mapping_error(rdma->sc_cm_id->device->dma_device, ctxt->sge[0].addr)) { ret = -EIO; goto out_unmap; } diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 57d35fbb1c28..28768d900258 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -151,11 +151,11 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, rqstp->rq_respages = &rqstp->rq_arg.pages[pg_no+1]; rqstp->rq_next_page = rqstp->rq_respages + 1; ctxt->sge[pno].addr = - ib_dma_map_page(xprt->sc_cm_id->device, + dma_map_page(xprt->sc_cm_id->device->dma_device, head->arg.pages[pg_no], pg_off, PAGE_SIZE - pg_off, DMA_FROM_DEVICE); - ret = ib_dma_mapping_error(xprt->sc_cm_id->device, + ret = dma_mapping_error(xprt->sc_cm_id->device->dma_device, ctxt->sge[pno].addr); if (ret) goto err; @@ -271,7 +271,7 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, else clear_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags); - dma_nents = ib_dma_map_sg(xprt->sc_cm_id->device, + dma_nents = dma_map_sg(xprt->sc_cm_id->device->dma_device, frmr->sg, frmr->sg_nents, frmr->direction); if (!dma_nents) { @@ -347,7 +347,7 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, atomic_inc(&rdma_stat_read); return ret; err: - ib_dma_unmap_sg(xprt->sc_cm_id->device, + dma_unmap_sg(xprt->sc_cm_id->device->dma_device, frmr->sg, frmr->sg_nents, frmr->direction); svc_rdma_put_context(ctxt, 0); svc_rdma_put_frmr(xprt, frmr); diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index ad4d286a83c5..356c31e9468e 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -148,7 +148,7 @@ static dma_addr_t dma_map_xdr(struct svcxprt_rdma *xprt, page = virt_to_page(xdr->tail[0].iov_base); } } - dma_addr = ib_dma_map_page(xprt->sc_cm_id->device, page, xdr_off, + dma_addr = dma_map_page(xprt->sc_cm_id->device->dma_device, page, xdr_off, min_t(size_t, PAGE_SIZE, len), dir); return dma_addr; } @@ -269,7 +269,7 @@ static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp, dma_map_xdr(xprt, &rqstp->rq_res, xdr_off, sge_bytes, DMA_TO_DEVICE); xdr_off += sge_bytes; - if (ib_dma_mapping_error(xprt->sc_cm_id->device, + if (dma_mapping_error(xprt->sc_cm_id->device->dma_device, sge[sge_no].addr)) goto err; svc_rdma_count_mappings(xprt, ctxt); @@ -478,9 +478,9 @@ static int send_reply(struct svcxprt_rdma *rdma, ctxt->sge[0].lkey = rdma->sc_pd->local_dma_lkey; ctxt->sge[0].length = svc_rdma_xdr_get_reply_hdr_len(rdma_resp); ctxt->sge[0].addr = - ib_dma_map_page(rdma->sc_cm_id->device, page, 0, + dma_map_page(rdma->sc_cm_id->device->dma_device, page, 0, ctxt->sge[0].length, DMA_TO_DEVICE); - if (ib_dma_mapping_error(rdma->sc_cm_id->device, ctxt->sge[0].addr)) + if (dma_mapping_error(rdma->sc_cm_id->device->dma_device, ctxt->sge[0].addr)) goto err; svc_rdma_count_mappings(rdma, ctxt); @@ -495,7 +495,7 @@ static int send_reply(struct svcxprt_rdma *rdma, dma_map_xdr(rdma, &rqstp->rq_res, xdr_off, sge_bytes, DMA_TO_DEVICE); xdr_off += sge_bytes; - if (ib_dma_mapping_error(rdma->sc_cm_id->device, + if (dma_mapping_error(rdma->sc_cm_id->device->dma_device, ctxt->sge[sge_no].addr)) goto err; svc_rdma_count_mappings(rdma, ctxt); @@ -677,9 +677,9 @@ void svc_rdma_send_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp, /* Prepare SGE for local address */ ctxt->sge[0].lkey = xprt->sc_pd->local_dma_lkey; ctxt->sge[0].length = length; - ctxt->sge[0].addr = ib_dma_map_page(xprt->sc_cm_id->device, + ctxt->sge[0].addr = dma_map_page(xprt->sc_cm_id->device->dma_device, p, 0, length, DMA_TO_DEVICE); - if (ib_dma_mapping_error(xprt->sc_cm_id->device, ctxt->sge[0].addr)) { + if (dma_mapping_error(xprt->sc_cm_id->device->dma_device, ctxt->sge[0].addr)) { dprintk("svcrdma: Error mapping buffer for protocol error\n"); svc_rdma_put_context(ctxt, 1); return; diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index ca2799af05a6..b9e86e3f0fad 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c @@ -237,7 +237,7 @@ void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt) * last WR that uses it completes. */ if (ctxt->sge[i].lkey == lkey) - ib_dma_unmap_page(device, + dma_unmap_page(device->dma_device, ctxt->sge[i].addr, ctxt->sge[i].length, ctxt->direction); @@ -600,10 +600,10 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt, gfp_t flags) if (!page) goto err_put_ctxt; ctxt->pages[sge_no] = page; - pa = ib_dma_map_page(xprt->sc_cm_id->device, + pa = dma_map_page(xprt->sc_cm_id->device->dma_device, page, 0, PAGE_SIZE, DMA_FROM_DEVICE); - if (ib_dma_mapping_error(xprt->sc_cm_id->device, pa)) + if (dma_mapping_error(xprt->sc_cm_id->device->dma_device, pa)) goto err_put_ctxt; svc_rdma_count_mappings(xprt, ctxt); ctxt->sge[sge_no].addr = pa; @@ -941,7 +941,7 @@ void svc_rdma_put_frmr(struct svcxprt_rdma *rdma, struct svc_rdma_fastreg_mr *frmr) { if (frmr) { - ib_dma_unmap_sg(rdma->sc_cm_id->device, + dma_unmap_sg(rdma->sc_cm_id->device->dma_device, frmr->sg, frmr->sg_nents, frmr->direction); spin_lock_bh(&rdma->sc_frmr_q_lock); WARN_ON_ONCE(!list_empty(&frmr->frmr_list)); diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 11d07748f699..613040464ccc 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -179,7 +179,7 @@ rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc) rep->rr_wc_flags = wc->wc_flags; rep->rr_inv_rkey = wc->ex.invalidate_rkey; - ib_dma_sync_single_for_cpu(rep->rr_device, + dma_sync_single_for_cpu(rep->rr_device->dma_device, rdmab_addr(rep->rr_rdmabuf), rep->rr_len, DMA_FROM_DEVICE); @@ -1259,11 +1259,11 @@ __rpcrdma_dma_map_regbuf(struct rpcrdma_ia *ia, struct rpcrdma_regbuf *rb) if (rb->rg_direction == DMA_NONE) return false; - rb->rg_iov.addr = ib_dma_map_single(ia->ri_device, + rb->rg_iov.addr = dma_map_single(ia->ri_device->dma_device, (void *)rb->rg_base, rdmab_length(rb), rb->rg_direction); - if (ib_dma_mapping_error(ia->ri_device, rdmab_addr(rb))) + if (dma_mapping_error(ia->ri_device->dma_device, rdmab_addr(rb))) return false; rb->rg_device = ia->ri_device; @@ -1277,7 +1277,7 @@ rpcrdma_dma_unmap_regbuf(struct rpcrdma_regbuf *rb) if (!rpcrdma_regbuf_is_mapped(rb)) return; - ib_dma_unmap_single(rb->rg_device, rdmab_addr(rb), + dma_unmap_single(rb->rg_device->dma_device, rdmab_addr(rb), rdmab_length(rb), rb->rg_direction); rb->rg_device = NULL; } -- 2.11.0 From leon at kernel.org Thu Jan 12 13:09:30 2017 From: leon at kernel.org (Leon Romanovsky) Date: Thu, 12 Jan 2017 15:09:30 +0200 Subject: [lustre-devel] [PATCH 9/9] treewide: Inline ib_dma_map_*() functions In-Reply-To: <20170111005648.14988-10-bart.vanassche@sandisk.com> References: <20170111005648.14988-1-bart.vanassche@sandisk.com> <20170111005648.14988-10-bart.vanassche@sandisk.com> Message-ID: <20170112130930.GH20392@mtr-leonro.local> On Tue, Jan 10, 2017 at 04:56:48PM -0800, Bart Van Assche wrote: > Almost all changes in this patch except the removal of local variables > that became superfluous and the actual removal of the ib_dma_map_*() > functions have been generated as follows: > > git grep -lE 'ib_(sg_|)dma_' | > xargs -d\\n \ > sed -i -e 's/\([^[:alnum:]_]\)ib_dma_\([^(]*\)(\&\([^,]\+\),/\1dma_\2(\3.dma_device,/g' \ > -e 's/\([^[:alnum:]_]\)ib_dma_\([^(]*\)(\([^,]\+\),/\1dma_\2(\3->dma_device,/g' \ > -e 's/ib_sg_dma_\(len\|address\)(\([^,]\+\), /sg_dma_\1(/g' > > Signed-off-by: Bart Van Assche > Reviewed-by: Christoph Hellwig > Cc: Andreas Dilger > Cc: Anna Schumaker > Cc: David S. Miller > Cc: Eric Van Hensbergen > Cc: James Simmons > Cc: Latchesar Ionkov > Cc: Oleg Drokin > Cc: Ron Minnich > Cc: Trond Myklebust > Cc: devel at driverdev.osuosl.org > Cc: linux-nfs at vger.kernel.org > Cc: linux-nvme at lists.infradead.org > Cc: linux-rdma at vger.kernel.org > Cc: lustre-devel at lists.lustre.org > Cc: netdev at vger.kernel.org > Cc: rds-devel at oss.oracle.com > Cc: target-devel at vger.kernel.org > Cc: v9fs-developer at lists.sourceforge.net > --- > drivers/infiniband/core/mad.c | 28 +-- > drivers/infiniband/core/rw.c | 30 ++- > drivers/infiniband/core/umem.c | 4 +- > drivers/infiniband/core/umem_odp.c | 6 +- > drivers/infiniband/hw/mlx4/cq.c | 2 +- > drivers/infiniband/hw/mlx4/mad.c | 28 +-- > drivers/infiniband/hw/mlx4/mr.c | 4 +- > drivers/infiniband/hw/mlx4/qp.c | 10 +- > drivers/infiniband/hw/mlx5/mr.c | 4 +- For mlx5 and mlx4 parts. Acked-by: Leon Romanovsky Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From sagi at grimberg.me Thu Jan 12 11:45:31 2017 From: sagi at grimberg.me (Sagi Grimberg) Date: Thu, 12 Jan 2017 13:45:31 +0200 Subject: [lustre-devel] [PATCH 9/9] treewide: Inline ib_dma_map_*() functions In-Reply-To: <20170111005648.14988-10-bart.vanassche@sandisk.com> References: <20170111005648.14988-1-bart.vanassche@sandisk.com> <20170111005648.14988-10-bart.vanassche@sandisk.com> Message-ID: <811bac91-39f4-edac-db8a-d44989440b21@grimberg.me> Reviewed-by: Sagi Grimberg From andreas.dilger at intel.com Fri Jan 13 01:17:39 2017 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Fri, 13 Jan 2017 01:17:39 +0000 Subject: [lustre-devel] [PATCH 1/2] Fixed signedness check In-Reply-To: <20161226154339.8916-1-kedrot@gmail.com> References: <20161226154339.8916-1-kedrot@gmail.com> Message-ID: <0EF6ABF1-1E3F-46DF-90CA-DA890027DEC4@intel.com> On Dec 26, 2016, at 08:43, Guillermo O. Freschi wrote: > > Was `unsigned int`, but `enum`s are signed. Interesting that GCC didn't complain that the itree_overlap_cb() function signature didn't match the argument prototype for interval_search(): typedef enum interval_iter (*interval_callback_t)(struct interval_node *node, void *args); In the end it is a somewhat cosmetic fix, because the only enum values (1, 2) were unsigned, but good to be consistent. Thanks for the fix. > Signed-off-by: Guillermo O. Freschi Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > index a4a291acb659..f4cbc89b4f24 100644 > --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > @@ -1148,7 +1148,7 @@ static int lock_matches(struct ldlm_lock *lock, struct lock_match_data *data) > return INTERVAL_ITER_STOP; > } > > -static unsigned int itree_overlap_cb(struct interval_node *in, void *args) > +static enum interval_iter itree_overlap_cb(struct interval_node *in, void *args) > { > struct ldlm_interval *node = to_ldlm_interval(in); > struct lock_match_data *data = args; > -- > 2.11.0 > > _______________________________________________ > 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 Fri Jan 13 01:20:18 2017 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Fri, 13 Jan 2017 01:20:18 +0000 Subject: [lustre-devel] [PATCH 2/2] Style fixes In-Reply-To: <20161226154339.8916-2-kedrot@gmail.com> References: <20161226154339.8916-1-kedrot@gmail.com> <20161226154339.8916-2-kedrot@gmail.com> Message-ID: <03F47D3D-C497-4138-A168-5A4A3B20CF77@intel.com> > On Dec 26, 2016, at 08:43, Guillermo O. Freschi wrote: > > Missing braces on `if` statement; misaligned parameter. > > Signed-off-by: Guillermo O. Freschi > --- > drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > index f4cbc89b4f24..a23e7ada3891 100644 > --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > @@ -1024,11 +1024,11 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list) > if (work_list && lock->l_completion_ast) > ldlm_add_ast_work_item(lock, NULL, work_list); > > - if (res->lr_type == LDLM_PLAIN || res->lr_type == LDLM_IBITS) > + if (res->lr_type == LDLM_PLAIN || res->lr_type == LDLM_IBITS) { > ldlm_grant_lock_with_skiplist(lock); > - else if (res->lr_type == LDLM_EXTENT) > + } else if (res->lr_type == LDLM_EXTENT) { > ldlm_extent_add_lock(res, lock); > - else if (res->lr_type == LDLM_FLOCK) { > + } else if (res->lr_type == LDLM_FLOCK) { > /* > * We should not add locks to granted list in the following cases: > * - this is an UNLOCK but not a real lock; This part is fine. > @@ -1040,8 +1040,9 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list) > ldlm_is_test_lock(lock) || ldlm_is_flock_deadlock(lock)) > return; > ldlm_resource_add_lock(res, &res->lr_granted, lock); > - } else > + } else { > LBUG(); > + } > > ldlm_pool_add(&ldlm_res_to_ns(res)->ns_pool, lock); > } Fine. > @@ -1481,7 +1482,8 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill, > lustre_swab_ost_lvb_v1); > else > lvb = req_capsule_server_sized_swab_get(pill, > - &RMF_DLM_LVB, size, > + &RMF_DLM_LVB, > + size, > lustre_swab_ost_lvb_v1); Not so keen on this one, since "lustre_swab_ost_lvb_v1" can't fit after the '(' of the original function line, there isn't any benefit to aligning the other two arguments but not that one. Better to keep the indentation the same and save one line of whitespace. Can you please resubmit without this hunk. Cheers, Andreas From andreas.dilger at intel.com Fri Jan 13 01:21:12 2017 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Fri, 13 Jan 2017 01:21:12 +0000 Subject: [lustre-devel] [PATCH] staging: lustre: selftest: Make brw_inject_one_error() static In-Reply-To: <20161223154244.29145-1-Karthik.188@gmail.com> References: <20161223154244.29145-1-Karthik.188@gmail.com> Message-ID: On Dec 23, 2016, at 08:42, Karthik Nayak wrote: > > Since the function brw_inject_one_error() is used only within > brw_test.c, make it static. This was reported as a warning by sparse. > > Signed-off-by: Karthik Nayak Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lnet/selftest/brw_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c > index 67b460f..b9ac34e 100644 > --- a/drivers/staging/lustre/lnet/selftest/brw_test.c > +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c > @@ -136,7 +136,7 @@ brw_client_init(struct sfw_test_instance *tsi) > return 0; > } > > -int brw_inject_one_error(void) > +static int brw_inject_one_error(void) > { > struct timespec64 ts; > > -- > 2.10.2 > > _______________________________________________ > 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 Fri Jan 13 06:58:37 2017 From: oleg.drokin at intel.com (Oleg Drokin) Date: Fri, 13 Jan 2017 01:58:37 -0500 Subject: [lustre-devel] [PATCH 2/5] staging/lustre/mgc: Combine two seq_printf() calls into one call in lprocfs_mgc_rd_ir_state() In-Reply-To: <25b07069-c624-cdd4-ca7b-85aaae51e79e@users.sourceforge.net> References: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> <25b07069-c624-cdd4-ca7b-85aaae51e79e@users.sourceforge.net> Message-ID: On Jan 1, 2017, at 11:35 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 1 Jan 2017 15:40:29 +0100 > > Some data were printed into a sequence by two separate function calls. > Print the same data by a single function call instead. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c > index b9c522a3c7a4..a6ca48d7e96b 100644 > --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c > +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c > @@ -460,11 +460,8 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) > > imp = obd->u.cli.cl_import; > ocd = &imp->imp_connect_data; > - > - seq_printf(m, "imperative_recovery: %s\n", > + seq_printf(m, "imperative_recovery: %s\nclient_state:\n", > OCD_HAS_FLAG(ocd, IMP_RECOV) ? "ENABLED" : "DISABLED"); > - seq_printf(m, "client_state:\n"); > - Ugh, do we really need this? I know it saves one call to seq_printf, but this is not a super performance-critical code, and two calls are actually easier to read, don't you think? > spin_lock(&config_list_lock); > list_for_each_entry(cld, &config_llog_list, cld_list_chain) { > if (!cld->cld_recover) > -- > 2.11.0 From oleg.drokin at intel.com Fri Jan 13 06:59:51 2017 From: oleg.drokin at intel.com (Oleg Drokin) Date: Fri, 13 Jan 2017 01:59:51 -0500 Subject: [lustre-devel] [PATCH 4/5] staging/lustre/obdclass: Combine two seq_printf() calls into one call in lprocfs_rd_state() In-Reply-To: <92ca443f-4791-f291-e2ea-5e67e3a846ac@users.sourceforge.net> References: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> <92ca443f-4791-f291-e2ea-5e67e3a846ac@users.sourceforge.net> Message-ID: <3FDC3834-8D24-4761-81A0-5CBB763E018A@intel.com> On Jan 1, 2017, at 11:38 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 1 Jan 2017 16:26:36 +0100 > > Some data were printed into a sequence by two separate function calls. > Print the same data by a single function call instead. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c > index 3f6fcab5a1fc..a167cbe8a50e 100644 > --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c > +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c > @@ -853,10 +853,8 @@ int lprocfs_rd_state(struct seq_file *m, void *data) > return rc; > > imp = obd->u.cli.cl_import; > - > - seq_printf(m, "current_state: %s\n", > + seq_printf(m, "current_state: %s\nstate_history:\n", > ptlrpc_import_state_name(imp->imp_state)); > - seq_printf(m, "state_history:\n"); same as in that other patch - this actually makes the code a bit harder to read, what's the perceived benefit to make a change like this? > k = imp->imp_state_hist_idx; > for (j = 0; j < IMP_STATE_HIST_LEN; j++) { > struct import_state_hist *ish = > -- > 2.11.0 From gregkh at linuxfoundation.org Fri Jan 13 07:41:52 2017 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Fri, 13 Jan 2017 08:41:52 +0100 Subject: [lustre-devel] [PATCH 2/5] staging/lustre/mgc: Combine two seq_printf() calls into one call in lprocfs_mgc_rd_ir_state() In-Reply-To: References: <45ae8939-a775-865b-ade0-9e38a7ff2b5d@users.sourceforge.net> <25b07069-c624-cdd4-ca7b-85aaae51e79e@users.sourceforge.net> Message-ID: <20170113074152.GA16646@kroah.com> On Fri, Jan 13, 2017 at 01:58:37AM -0500, Oleg Drokin wrote: > > On Jan 1, 2017, at 11:35 AM, SF Markus Elfring wrote: Oleg, please realize that I have blacklisted this patch author, and don't take contributions from them, unless you, or someone else wishes to properly review and pass them on. I've found that personally, it's just a waste of time working with them, but you are free to do whatever you wish... good luck! greg k-h From dan.carpenter at oracle.com Sun Jan 15 08:14:07 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Sun, 15 Jan 2017 11:14:07 +0300 Subject: [lustre-devel] [patch] staging: lustre: ptlrpc: silence a shift wrapping warning Message-ID: <20170115081407.GA29823@mwanda> "svcpt->scp_hist_seq" is a u64 so static checkers complain that 1U should be 1ULL. I looked at REQS_SEQ_SHIFT() a little and it seems to be capped by the number of CPUs online and the amount of memory, but I think it could go above 32 possibly. Signed-off-by: Dan Carpenter --- I have not tested this change. diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 49f3e63..ae1650d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -277,7 +277,7 @@ static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt, * then we hope there will be less RPCs per bucket at some * point, and sequence will catch up again */ - svcpt->scp_hist_seq += (1U << REQS_SEQ_SHIFT(svcpt)); + svcpt->scp_hist_seq += (1ULL << REQS_SEQ_SHIFT(svcpt)); new_seq = svcpt->scp_hist_seq; } From oleg.drokin at intel.com Mon Jan 16 03:33:47 2017 From: oleg.drokin at intel.com (Oleg Drokin) Date: Sun, 15 Jan 2017 22:33:47 -0500 Subject: [lustre-devel] [patch] staging: lustre: ptlrpc: silence a shift wrapping warning In-Reply-To: <20170115081407.GA29823@mwanda> References: <20170115081407.GA29823@mwanda> Message-ID: On Jan 15, 2017, at 3:14 AM, Dan Carpenter wrote: > "svcpt->scp_hist_seq" is a u64 so static checkers complain that 1U > should be 1ULL. I looked at REQS_SEQ_SHIFT() a little and it seems to > be capped by the number of CPUs online and the amount of memory, but I > think it could go above 32 possibly. > > Signed-off-by: Dan Carpenter Reviewed-by: Oleg Drokin > --- > I have not tested this change. > > diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c > index 49f3e63..ae1650d 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/events.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c > @@ -277,7 +277,7 @@ static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt, > * then we hope there will be less RPCs per bucket at some > * point, and sequence will catch up again > */ > - svcpt->scp_hist_seq += (1U << REQS_SEQ_SHIFT(svcpt)); > + svcpt->scp_hist_seq += (1ULL << REQS_SEQ_SHIFT(svcpt)); > new_seq = svcpt->scp_hist_seq; > } > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From kaiserj at uni-mainz.de Mon Jan 16 15:28:15 2017 From: kaiserj at uni-mainz.de (=?utf-8?Q?J=C3=BCrgen_Kaiser?=) Date: Mon, 16 Jan 2017 16:28:15 +0100 Subject: [lustre-devel] Quality of Service Planning in Lustre Message-ID: Hello everyone, my name is Jürgen Kaiser and I'm a research assistant at the Johannes Gutenberg University Mainz. As part of an IPCC project, we developed a tool for handling Quality of Service requirements in Lustre. We would like to explain what we did and hear your thoughts about it. We hope that our work will help the Lustre community in the future. ==== What we did === HPC centers typically use scheduling systems such as LSF or Slurm to manage the computations of the users and the resources themselves. These schedulers force the users to define compute jobs and to submit these jobs to the schedulers. In return, the schedulers guarantee the users that their job will have the required compute resources. So far, storage bandwidth is (mostly) excluded from the list of managed resources. Unlike resources like CPU or memory, there is no easy method for schedulers to handle storage bandwidth because they lack knowledge about storage system internals. For example, a scheduler must know the placement of a file’s data on Lustre's OSTs plus the workload as well as the maximum performance of the involved parts to reason about the available read throughput for the file. It would be more practical if the storage system would provide a generic API for schedulers to set Quality of Service (QoS) configurations while abstracting the internal dependencies. With such an interface, a scheduler easily could request available storage resources. In our project, we're developing a Quality of Service Planner (QoSP) that provides this interface. Its task is to receive storage bandwidth requests (e.g. 100MB/s read throughput for files X,Y,Z for one hour), check for resource availability and, if available, guarantee the reserved resources by configuring Lustre. The main tool here is a (modified) TBF strategy in Lustre's NRS. The QoSP still is under development. You can see the code on github: https://github.com/jkaiser/qos-planner . We see further use cases beyond the HPC scheduling scenario. For example, applications could negotiate I/O Phases with the storage backend (e.g. HPC checkpoints). We would like to hear your thoughts about this project in general and about several problems we face in detail. You can find a pdf a with detailed description and discussion about some core problems we face here: https://seafile.rlp.net/f/55e4c7b619/?raw=1. Two example issues are: === The NRS and the TBF === Users require _guaranteed_ storage bandwidth to reason about the run time of their applications so that they can reserve enough time on the computation cluster. In other words: users require minimum bandwidths instead of maximum ones. The current TBF strategy, however, only supports upper thresholds. There are two options here: 1) Implement minimums indirectly. This involves a monitoring of the actual resource consumption on the OSTs and a repeatedly readjusting of TBF rules. 2) Modify the TBF so that it supports lower thresholds. Here, the NRS would try to satisfy the minimums first. This additionally has the advantage that there is no underutilized bandwidth: each job can use free resources if necessary because there is no upper limit. We would like to implement Option 2. We are in contact with DDN and discuss this work including the TBF strategy. === Handling Write Throughput === When an application requests write throughput, this usually means that it will create new files. However, at request time, these files do not exist yet, therefore the QoSP cannot know which OSTs will have to process the write throughput. Hence, the QoSP somehow must predict/determine the placement of new files on the OSTs within the Lustre system. This requires several modifications in Lustre including a new interface to query such information. We would like to discuss this issue with the Lustre community. The mentioned PDF file contains further details. We would be happy to hear your thoughts on this. Best Regards, Jürgen Kaiser -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 1536 bytes Desc: Message signed with OpenPGP using GPGMail URL: From oleg.drokin at intel.com Mon Jan 16 16:45:38 2017 From: oleg.drokin at intel.com (Oleg Drokin) Date: Mon, 16 Jan 2017 11:45:38 -0500 Subject: [lustre-devel] [PATCH v2] Style fixes In-Reply-To: <20170113204834.4941-1-kedrot@gmail.com> References: <20161226154339.8916-2-kedrot@gmail.com> <20170113204834.4941-1-kedrot@gmail.com> Message-ID: <4B1BA531-56B4-4DF2-B1BD-D7BFD5DFACA7@intel.com> On Jan 13, 2017, at 3:48 PM, Guillermo O. Freschi wrote: > Missing braces on `if` statement. > > Signed-off-by: Guillermo O. Freschi > > Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin > --- > drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > index f4cbc89b4f24..b66bc02646f1 100644 > --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c > @@ -1024,11 +1024,11 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list) > if (work_list && lock->l_completion_ast) > ldlm_add_ast_work_item(lock, NULL, work_list); > > - if (res->lr_type == LDLM_PLAIN || res->lr_type == LDLM_IBITS) > + if (res->lr_type == LDLM_PLAIN || res->lr_type == LDLM_IBITS) { > ldlm_grant_lock_with_skiplist(lock); > - else if (res->lr_type == LDLM_EXTENT) > + } else if (res->lr_type == LDLM_EXTENT) { > ldlm_extent_add_lock(res, lock); > - else if (res->lr_type == LDLM_FLOCK) { > + } else if (res->lr_type == LDLM_FLOCK) { > /* > * We should not add locks to granted list in the following cases: > * - this is an UNLOCK but not a real lock; > @@ -1040,8 +1040,9 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list) > ldlm_is_test_lock(lock) || ldlm_is_flock_deadlock(lock)) > return; > ldlm_resource_add_lock(res, &res->lr_granted, lock); > - } else > + } else { > LBUG(); > + } > > ldlm_pool_add(&ldlm_res_to_ns(res)->ns_pool, lock); > } > -- > 2.11.0 From jsimmons at infradead.org Mon Jan 16 21:00:24 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 21:00:24 +0000 (GMT) Subject: [lustre-devel] LUSTRE_LNET_CONFIG_UTILITY in lnet SysV script In-Reply-To: References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <1ea178df-8afa-135a-3bde-a2e7b7fc5e12@llnl.gov> Message-ID: > We can probably make these YAML parsing libraries mandatory and checked in the configuration step. If not > there the build doesn't move forward until they are installed. The libraries will also need to be > installed on the nodes which Lustre is deployed on. The reason for this was that SLES11 lacked yaml support. Today a search libyaml will show it is available on all the platforms lustre is supported on. Even SLES11SP4 has yaml support now. I support making this a hard requirement. > On 10 January 2017 at 12:17, Amir Shehata wrote: > The reason it is conditional is because we use 3rd party library for YAML parsing. If this is > not installed on the build system, then we wouldn't be building lnetctl in that scenario. > I agree that we should be removing DLC terminology from the code. > > thanks > amir > > On 4 January 2017 at 17:36, Christopher J. Morrone wrote: > lnetctl is currently an optional build, and its build is not even > enabled by default in the lustre spec file.  To use lnetctl exclusively, > we would need lnetctl's build would need to be unconditional. > > I don't have a problem with making the lnetctl build unconditional.  I'm > not sure why it was done that way.  Perhaps someone else can comment on > that. > > When/if lnetctl is built unconditionally, it would be nice to purge the > "DLC" terminology from the code. > > Chris > > On 01/04/2017 04:16 PM, Di Natale, Giuseppe wrote: > > Greetings, > > > > I am attempting to port the SysV lnet script as part of a transition to > > systemd. I ran into the following in lustre/scripts/lnet: > > > >         if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > > "$LUSTRE_LNET_CONFIG_FILE" ]; then > >                 $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > >         else > >                 lctl network up || exit 1 > >         fi > > > > Can the check for LUSTRE_LNET_CONFIG_UTILITY  (/usr/sbin/lnetctl by > > default) be removed so that way lnetctl is used exclusively? > > > > 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 > > > > > From jsimmons at infradead.org Mon Jan 16 21:02:10 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 21:02:10 +0000 (GMT) Subject: [lustre-devel] (no subject) In-Reply-To: <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> Message-ID: > Sounds good to me. Ideally, lnetctl should be able to do everything > that lctl could do (plus all of the new features). Has it reached > parity? If not, what else still remains to be done? No lctl pings and the peer and connection handling is missing. I did some work to support the missing features in lnetctl and combined with multi-rail should fill in the gaps. Also we are missing lnetctl ping but I think multi-rail might fix that. Not 100% sure tho. > > Chris > > On 01/10/2017 12:15 PM, Amir Shehata wrote: > > lctl usage is kept for backwards compatibility. Eventually, we should be > > moving to using lnetctl exclusively. Which lustre-release we should do > > that in, is the question. 2.10? > > > > thanks > > amir > > > > On 4 January 2017 at 16:16, Di Natale, Giuseppe > > wrote: > > > > Greetings, > > > > I am attempting to port the SysV lnet script as part of a transition > > to systemd. I ran into the following in lustre/scripts/lnet: > > > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > > "$LUSTRE_LNET_CONFIG_FILE" ]; then > > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > > else > > lctl network up || exit 1 > > fi > > > > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by > > default) be removed so that way lnetctl is used exclusively? > > > > 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 jsimmons at infradead.org Mon Jan 16 21:05:19 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 21:05:19 +0000 (GMT) Subject: [lustre-devel] (no subject) In-Reply-To: References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> Message-ID: > lnetctl was designed to control LNet only. We have not moved the rest of the lctl functionality. lctl does > a lot of other lustre specific functions. > The idea was to have lnetctl be only LNet specific, and lctl lustre specific. In essence we are attempting > to decouple LNet from lustre. There has been some talk about upstreaming LNet before lustre with all the > work that James Simmons from ORNL is doing. Already done. LNet is ahead a bit for the upstream client from master but just recently I have been backporting that work to the OpenSFS branch. Its almost synced up now. As for LNet leaving staging Greg wanted both LNet and lustre to leaving staging at the same time. > thanks > amir > > On 10 January 2017 at 14:06, Christopher J. Morrone wrote: > Sounds good to me.  Ideally, lnetctl should be able to do everything > that lctl could do (plus all of the new features).  Has it reached > parity?  If not, what else still remains to be done? > > Chris > > On 01/10/2017 12:15 PM, Amir Shehata wrote: > > lctl usage is kept for backwards compatibility. Eventually, we should be > > moving to using lnetctl exclusively. Which lustre-release we should do > > that in, is the question. 2.10? > > > > thanks > > amir > > > > On 4 January 2017 at 16:16, Di Natale, Giuseppe > > wrote: > > > >     Greetings, > > > >     I am attempting to port the SysV lnet script as part of a transition > >     to systemd. I ran into the following in lustre/scripts/lnet: > > > >             if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > >     "$LUSTRE_LNET_CONFIG_FILE" ]; then > >                     $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit 1 > >             else > >                     lctl network up || exit 1 > >             fi > > > >     Can the check for LUSTRE_LNET_CONFIG_UTILITY  (/usr/sbin/lnetctl by > >     default) be removed so that way lnetctl is used exclusively? > > > >     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 jsimmons at infradead.org Mon Jan 16 21:25:58 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 21:25:58 +0000 (GMT) Subject: [lustre-devel] (no subject) In-Reply-To: <34fdf36d-b7d2-4a50-9656-dd720d805d31@llnl.gov> References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> <30DCC240-3E47-4A2B-8C7B-B46D165C2127@intel.com> <34fdf36d-b7d2-4a50-9656-dd720d805d31@llnl.gov> Message-ID: > Right, I meant copy in lnet-specific functionality from lctl to lnetctl. > I didn't mean to sound like I was suggesting moving the rest of lctl's > non-lnet parts into lnetctl. I think Chris means is that if we make liblnetconfig mandatory then we can link lctl to that library and replace alot of the functionality lctl is doing itself with the work in liblnetconfig. Currently the library situation is a mess. We have: liblnetconfig.so (okay) libcfs.a libcfsutil.a libptlctl.a liblustreapi.so For liblustreapi.so it linked the libcfs*.a and libptlctl.a static libraries. If you look at libptlctl.a its just composed of two source files. One is debug.c which really belongs in libcfs. The other could be replaced by libnetconfig. So we can kill off libptlctl.a. For libcfsutil.a that should just merge into libcfs. > On 01/10/2017 08:18 PM, Dilger, Andreas wrote: > > It's fine to add the lnet-specific functionality from lctl to lnetctl, > > but we shouldn't remove existing functionality from lctl to avoid > > breaking scripts that may be using it today. 4+ releases after all of > > the LNet specific lctl functionality has been added to lnetctl we can > > start printing deprecation warnings, and after 8+ releases they can be > > removed. > > > > > > > > Cheers, Andreas > > > > -- > > > > Andreas Dilger > > > > Lustre Principal Architect > > > > Intel High Performance Data Division > > > > > > > > On 2017/01/10, 18:08, "lustre-devel on behalf of Amir Shehata" > > > on behalf of > > amir.shehata.whamcloud at gmail.com > > > wrote: > > > > > > > > lnetctl was designed to control LNet only. We have not moved the rest of > > the lctl functionality. lctl does a lot of other lustre specific functions. > > > > > > > > The idea was to have lnetctl be only LNet specific, and lctl lustre > > specific. In essence we are attempting to decouple LNet from lustre. > > There has been some talk about upstreaming LNet before lustre with all > > the work that James Simmons from ORNL is doing. > > > > > > > > thanks > > > > amir > > > > > > > > On 10 January 2017 at 14:06, Christopher J. Morrone > > wrote: > > > > Sounds good to me. Ideally, lnetctl should be able to do everything > > that lctl could do (plus all of the new features). Has it reached > > parity? If not, what else still remains to be done? > > > > Chris > > > > On 01/10/2017 12:15 PM, Amir Shehata wrote: > > > lctl usage is kept for backwards compatibility. Eventually, we > > should be > > > moving to using lnetctl exclusively. Which lustre-release we should do > > > that in, is the question. 2.10? > > > > > > thanks > > > amir > > > > > > On 4 January 2017 at 16:16, Di Natale, Giuseppe > > > > > >> wrote: > > > > > > Greetings, > > > > > > I am attempting to port the SysV lnet script as part of a > > transition > > > to systemd. I ran into the following in lustre/scripts/lnet: > > > > > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > > > "$LUSTRE_LNET_CONFIG_FILE" ]; then > > > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || > > exit 1 > > > else > > > lctl network up || exit 1 > > > fi > > > > > > Can the check for LUSTRE_LNET_CONFIG_UTILITY > > (/usr/sbin/lnetctl by > > > default) be removed so that way lnetctl is used exclusively? > > > > > > 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 jsimmons at infradead.org Mon Jan 16 21:28:30 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 21:28:30 +0000 (GMT) Subject: [lustre-devel] [PATCH] staging: lustre: headers: potential UAPI headers In-Reply-To: <20170103141248.GA8695@kroah.com> References: <1482167207-22800-1-git-send-email-jsimmons@infradead.org> <20170103141248.GA8695@kroah.com> Message-ID: > On Mon, Dec 19, 2016 at 12:06:47PM -0500, James Simmons wrote: > > Not for landing. This is the purposed UAPI headers > > with the removal of unlikely and debugging macros. > > This is just for feedback to see if this is acceptable > > for the upstream client. > > > > Signed-off-by: James Simmons > > --- > > .../lustre/lustre/include/lustre/lustre_fid.h | 353 +++++++++++++++++++++ > > .../lustre/lustre/include/lustre/lustre_ostid.h | 233 ++++++++++++++ > > Can you make a lustre "uapi" directory so we can see which files you > really want to be UAPI and which you don't as time goes on? Where do you want them placed? In uapi/linux/lustre or uapi/lustre. Does it matter to you? The below was to forth coming UAPI headers which from your response you seem okay with in general. > > 2 files changed, 586 insertions(+) > > create mode 100644 drivers/staging/lustre/lustre/include/lustre/lustre_fid.h > > create mode 100644 drivers/staging/lustre/lustre/include/lustre/lustre_ostid.h > > > > diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre/lustre_fid.h > > new file mode 100644 > > index 0000000..cb6afa5 > > --- /dev/null > > +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_fid.h > > @@ -0,0 +1,353 @@ > > +/* > > + * 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) 2007, 2010, Oracle and/or its affiliates. All rights reserved. > > + * Use is subject to license terms. > > + * > > + * Copyright (c) 2011, 2014, Intel Corporation. > > + * > > + * Copyright 2016 Cray Inc, all rights reserved. > > + * Author: Ben Evans. > > + * > > + * all fid manipulation functions go here > > + * > > + * FIDS are globally unique within a Lustre filessytem, and are made up > > + * of three parts: sequence, Object ID, and version. > > + * > > + */ > > +#ifndef _LUSTRE_LUSTRE_FID_H_ > > +#define _LUSTRE_LUSTRE_FID_H_ > > + > > +#include > > + > > +/** returns fid object sequence */ > > +static inline __u64 fid_seq(const struct lu_fid *fid) > > +{ > > + return fid->f_seq; > > +} > > + > > +/** returns fid object id */ > > +static inline __u32 fid_oid(const struct lu_fid *fid) > > +{ > > + return fid->f_oid; > > +} > > + > > +/** returns fid object version */ > > +static inline __u32 fid_ver(const struct lu_fid *fid) > > +{ > > + return fid->f_ver; > > +} > > + > > +static inline void fid_zero(struct lu_fid *fid) > > +{ > > + memset(fid, 0, sizeof(*fid)); > > +} > > + > > +static inline __u64 fid_ver_oid(const struct lu_fid *fid) > > +{ > > + return (__u64)fid_ver(fid) << 32 | fid_oid(fid); > > +} > > + > > +static inline bool fid_seq_is_mdt0(__u64 seq) > > +{ > > + return seq == FID_SEQ_OST_MDT0; > > +} > > + > > +static inline bool fid_seq_is_mdt(__u64 seq) > > +{ > > + return seq == FID_SEQ_OST_MDT0 || seq >= FID_SEQ_NORMAL; > > +}; > > + > > +static inline bool fid_seq_is_echo(__u64 seq) > > +{ > > + return seq == FID_SEQ_ECHO; > > +} > > + > > +static inline bool fid_is_echo(const struct lu_fid *fid) > > +{ > > + return fid_seq_is_echo(fid_seq(fid)); > > +} > > + > > +static inline bool fid_seq_is_llog(__u64 seq) > > +{ > > + return seq == FID_SEQ_LLOG; > > +} > > + > > +static inline bool fid_is_llog(const struct lu_fid *fid) > > +{ > > + /* file with OID == 0 is not llog but contains last oid */ > > + return fid_seq_is_llog(fid_seq(fid)) && fid_oid(fid) > 0; > > +} > > + > > +static inline bool fid_seq_is_rsvd(__u64 seq) > > +{ > > + return seq > FID_SEQ_OST_MDT0 && seq <= FID_SEQ_RSVD; > > +}; > > + > > +static inline bool fid_seq_is_special(__u64 seq) > > +{ > > + return seq == FID_SEQ_SPECIAL; > > +}; > > + > > +static inline bool fid_seq_is_local_file(__u64 seq) > > +{ > > + return seq == FID_SEQ_LOCAL_FILE || > > + seq == FID_SEQ_LOCAL_NAME; > > +}; > > + > > +static inline bool fid_seq_is_root(__u64 seq) > > +{ > > + return seq == FID_SEQ_ROOT; > > +} > > + > > +static inline bool fid_seq_is_dot(__u64 seq) > > +{ > > + return seq == FID_SEQ_DOT_LUSTRE; > > +} > > + > > +static inline bool fid_seq_is_default(__u64 seq) > > +{ > > + return seq == FID_SEQ_LOV_DEFAULT; > > +} > > + > > +static inline bool fid_is_mdt0(const struct lu_fid *fid) > > +{ > > + return fid_seq_is_mdt0(fid_seq(fid)); > > +} > > + > > +static inline void lu_root_fid(struct lu_fid *fid) > > +{ > > + fid->f_seq = FID_SEQ_ROOT; > > + fid->f_oid = FID_OID_ROOT; > > + fid->f_ver = 0; > > +} > > + > > +static inline void lu_echo_root_fid(struct lu_fid *fid) > > +{ > > + fid->f_seq = FID_SEQ_ROOT; > > + fid->f_oid = FID_OID_ECHO_ROOT; > > + fid->f_ver = 0; > > +} > > + > > +static inline void lu_update_log_fid(struct lu_fid *fid, __u32 index) > > +{ > > + fid->f_seq = FID_SEQ_UPDATE_LOG; > > + fid->f_oid = index; > > + fid->f_ver = 0; > > +} > > + > > +static inline void lu_update_log_dir_fid(struct lu_fid *fid, __u32 index) > > +{ > > + fid->f_seq = FID_SEQ_UPDATE_LOG_DIR; > > + fid->f_oid = index; > > + fid->f_ver = 0; > > +} > > + > > +/** > > + * Check if a fid is igif or not. > > + * \param fid the fid to be tested. > > + * \return true if the fid is an igif; otherwise false. > > + */ > > +static inline bool fid_seq_is_igif(__u64 seq) > > +{ > > + return seq >= FID_SEQ_IGIF && seq <= FID_SEQ_IGIF_MAX; > > +} > > + > > +static inline bool fid_is_igif(const struct lu_fid *fid) > > +{ > > + return fid_seq_is_igif(fid_seq(fid)); > > +} > > + > > +/** > > + * Check if a fid is idif or not. > > + * \param fid the fid to be tested. > > + * \return true if the fid is an idif; otherwise false. > > Odd kernel doc style :( > > > + */ > > +static inline bool fid_seq_is_idif(__u64 seq) > > +{ > > + return seq >= FID_SEQ_IDIF && seq <= FID_SEQ_IDIF_MAX; > > +} > > + > > +static inline bool fid_is_idif(const struct lu_fid *fid) > > +{ > > + return fid_seq_is_idif(fid_seq(fid)); > > +} > > + > > +static inline bool fid_is_local_file(const struct lu_fid *fid) > > +{ > > + return fid_seq_is_local_file(fid_seq(fid)); > > +} > > + > > +static inline bool fid_seq_is_norm(__u64 seq) > > +{ > > + return (seq >= FID_SEQ_NORMAL); > > +} > > + > > +static inline bool fid_is_norm(const struct lu_fid *fid) > > +{ > > + return fid_seq_is_norm(fid_seq(fid)); > > +} > > + > > +static inline int fid_is_layout_rbtree(const struct lu_fid *fid) > > +{ > > + return fid_seq(fid) == FID_SEQ_LAYOUT_RBTREE; > > +} > > bool? > > thanks, > > greg k-h > From jsimmons at infradead.org Mon Jan 16 21:30:03 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:03 -0500 Subject: [lustre-devel] [PATCH 00/34] staging: lustre: lnet: change lnet selftest UAPI typedefs to proper structure Message-ID: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> The upstream kernel requires proper structures so convert all the UAPI typdefs in lnetst.h. Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons James Simmons (34): staging: lustre: lnet: change lst_nid_t to proper structure staging: lustre: lnet: change lst_bid_t to proper structure staging: lustre: lnet: change lstcon_node_ent_t to proper structure staging: lustre: lnet: change lstcon_ndlist_ent_t to proper structure staging: lustre: lnet: change lstcon_test_ent_t to proper structure staging: lustre: lnet: change lstcon_batch_ent_t to proper structure staging: lustre: lnet: change lstcon_test_batch_ent_t to proper structure staging: lustre: lnet: change lstcon_rpc_ent_t to proper structure staging: lustre: lnet: change lstcon_trans_stat_t to proper structure staging: lustre: lnet: change lstio_session_new_args_t to proper structure staging: lustre: lnet: change lstio_session_info_args_t to proper structure staging: lustre: lnet: change lstio_session_end_args_t to proper structure staging: lustre: lnet: change lstio_debug_args_t to proper structure staging: lustre: lnet: change lstio_group_add_args_t to proper structure staging: lustre: lnet: change lstio_group_del_args_t to proper structure staging: lustre: lnet: change lstio_group_update_args_t to proper structure staging: lustre: lnet: change lstio_group_nodes_args_t to proper structure staging: lustre: lnet: change lstio_group_list_args_t to proper structure staging: lustre: lnet: change lstio_group_info_args_t to proper structure staging: lustre: lnet: change lstio_batch_add_args_t to proper structure staging: lustre: lnet: change lstio_batch_del_args_t to proper structure staging: lustre: lnet: change lstio_batch_run_args_t to proper structure staging: lustre: lnet: change lstio_batch_stop_args_t to proper structure staging: lustre: lnet: change lstio_batch_query_args_t to proper structure staging: lustre: lnet: change lstio_batch_list_args_t to proper structure staging: lustre: lnet: change lstio_batch_info_args_t to proper structure staging: lustre: lnet: change lstio_stat_args_t to proper structure staging: lustre: lnet: change lst_test_type_t to proper enum staging: lustre: lnet: change lstio_test_args_t to proper structure staging: lustre: lnet: change lst_brw_[type|flags]_t to proper enum staging: lustre: lnet: change lst_test_bulk_param_t to proper structure staging: lustre: lnet: change lst_test_ping_param_t to proper structure staging: lustre: lnet: change srpc_counters_t to proper structure staging: lustre: lnet: change sfw_counter_t to proper structure drivers/staging/lustre/include/linux/lnet/lnetst.h | 198 ++++++++++----------- drivers/staging/lustre/lnet/selftest/conctl.c | 76 ++++---- drivers/staging/lustre/lnet/selftest/conrpc.c | 26 +-- drivers/staging/lustre/lnet/selftest/conrpc.h | 4 +- drivers/staging/lustre/lnet/selftest/console.c | 56 +++--- drivers/staging/lustre/lnet/selftest/console.h | 24 +-- drivers/staging/lustre/lnet/selftest/framework.c | 10 +- drivers/staging/lustre/lnet/selftest/rpc.c | 6 +- drivers/staging/lustre/lnet/selftest/rpc.h | 38 ++-- drivers/staging/lustre/lnet/selftest/selftest.h | 8 +- 10 files changed, 223 insertions(+), 223 deletions(-) -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:10 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:10 -0500 Subject: [lustre-devel] [PATCH 07/34] staging: lustre: lnet: change lstcon_test_batch_ent_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-8-git-send-email-jsimmons@infradead.org> Change lstcon_test_batch_ent_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 6 +++--- drivers/staging/lustre/lnet/selftest/console.c | 10 +++++----- drivers/staging/lustre/lnet/selftest/console.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index f2b98e9..adc03fe 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -112,7 +112,7 @@ struct lstcon_batch_ent { }; /*** batch summary entry, for *** list_batch command */ -typedef struct { +struct lstcon_test_batch_ent { struct lstcon_ndlist_ent tbe_cli_nle; /* client (group) node_list * entry */ struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list @@ -121,7 +121,7 @@ struct lstcon_batch_ent { struct lstcon_test_ent tbe_test; /* test entry */ struct lstcon_batch_ent tbe_batch;/* batch entry */ } u; -} lstcon_test_batch_ent_t; /*** test/batch verbose information entry, +}; /*** test/batch verbose information entry, *** for list_batch command */ typedef struct { @@ -413,7 +413,7 @@ struct lstcon_batch_ent { int lstio_bat_server; /* IN: query server or not */ int lstio_bat_testidx; /* IN: test index */ - lstcon_test_batch_ent_t __user *lstio_bat_entp; /* OUT: batch ent */ + struct lstcon_test_batch_ent __user *lstio_bat_entp;/* OUT: batch ent */ int __user *lstio_bat_idxp; /* IN/OUT: index of node */ int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */ diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 9af761f..bf4111a 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -926,11 +926,11 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, } int -lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, +lstcon_batch_info(char *name, struct lstcon_test_batch_ent __user *ent_up, int server, int testidx, int *index_p, int *ndent_p, struct lstcon_node_ent __user *dents_up) { - lstcon_test_batch_ent_t *entp; + struct lstcon_test_batch_ent *entp; struct list_head *clilst; struct list_head *srvlst; struct lstcon_test *test = NULL; @@ -969,7 +969,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, } /* non-verbose query */ - LIBCFS_ALLOC(entp, sizeof(lstcon_test_batch_ent_t)); + LIBCFS_ALLOC(entp, sizeof(struct lstcon_test_batch_ent)); if (!entp) return -ENOMEM; @@ -989,9 +989,9 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, LST_NODE_STATE_COUNTER(ndl->ndl_node, &entp->tbe_srv_nle); rc = copy_to_user(ent_up, entp, - sizeof(lstcon_test_batch_ent_t)) ? -EFAULT : 0; + sizeof(struct lstcon_test_batch_ent)) ? -EFAULT : 0; - LIBCFS_FREE(entp, sizeof(lstcon_test_batch_ent_t)); + LIBCFS_FREE(entp, sizeof(struct lstcon_test_batch_ent)); return rc; } diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index 30d73b6..f8d61ce 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -227,7 +227,7 @@ int lstcon_test_batch_query(char *name, int testidx, struct list_head __user *result_up); int lstcon_batch_del(char *name); int lstcon_batch_list(int idx, int namelen, char __user *name_up); -int lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, +int lstcon_batch_info(char *name, struct lstcon_test_batch_ent __user *ent_up, int server, int testidx, int *index_p, int *ndent_p, struct lstcon_node_ent __user *dents_up); int lstcon_group_stat(char *grp_name, int timeout, -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:13 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:13 -0500 Subject: [lustre-devel] [PATCH 10/34] staging: lustre: lnet: change lstio_session_new_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-11-git-send-email-jsimmons@infradead.org> Change lstio_session_new_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 48dc06f..079644e 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -239,7 +239,7 @@ struct lstcon_trans_stat { } /* create a session */ -typedef struct { +struct lstio_session_new_args { int lstio_ses_key; /* IN: local key */ int lstio_ses_timeout; /* IN: session timeout */ int lstio_ses_force; /* IN: force create ? */ @@ -248,7 +248,7 @@ struct lstcon_trans_stat { struct lst_sid __user *lstio_ses_idp; /* OUT: session id */ int lstio_ses_nmlen; /* IN: name length */ char __user *lstio_ses_namep; /* IN: session name */ -} lstio_session_new_args_t; +}; /* query current session */ typedef struct { diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index a897738..9007ebf 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -42,7 +42,7 @@ #include "console.h" static int -lst_session_new_ioctl(lstio_session_new_args_t *args) +lst_session_new_ioctl(struct lstio_session_new_args *args) { char *name; int rc; @@ -855,7 +855,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) switch (opc) { case LSTIO_SESSION_NEW: - rc = lst_session_new_ioctl((lstio_session_new_args_t *)buf); + rc = lst_session_new_ioctl((struct lstio_session_new_args *)buf); break; case LSTIO_SESSION_END: rc = lst_session_end_ioctl((lstio_session_end_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:16 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:16 -0500 Subject: [lustre-devel] [PATCH 13/34] staging: lustre: lnet: change lstio_debug_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-14-git-send-email-jsimmons@infradead.org> Change lstio_debug_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index dbcfc1f..03ebdc3 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -272,7 +272,7 @@ struct lstio_session_end_args { #define LST_OPC_BATCHCLI 4 #define LST_OPC_BATCHSRV 5 -typedef struct { +struct lstio_debug_args { int lstio_dbg_key; /* IN: session key */ int lstio_dbg_type; /* IN: debug session|batch| @@ -291,7 +291,7 @@ struct lstio_session_end_args { nodes */ struct list_head __user *lstio_dbg_resultp; /* OUT: list head of result buffer */ -} lstio_debug_args_t; +}; typedef struct { int lstio_grp_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 3217447..e143e52 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -109,7 +109,7 @@ } static int -lst_debug_ioctl(lstio_debug_args_t *args) +lst_debug_ioctl(struct lstio_debug_args *args) { char *name = NULL; int client = 1; @@ -864,7 +864,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_session_info_ioctl((struct lstio_session_info_args *)buf); break; case LSTIO_DEBUG: - rc = lst_debug_ioctl((lstio_debug_args_t *)buf); + rc = lst_debug_ioctl((struct lstio_debug_args *)buf); break; case LSTIO_GROUP_ADD: rc = lst_group_add_ioctl((lstio_group_add_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:15 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:15 -0500 Subject: [lustre-devel] [PATCH 12/34] staging: lustre: lnet: change lstio_session_end_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-13-git-send-email-jsimmons@infradead.org> Change lstio_session_end_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 6dfccc5..dbcfc1f 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -262,9 +262,9 @@ struct lstio_session_info_args { }; /* delete a session */ -typedef struct { +struct lstio_session_end_args { int lstio_ses_key; /* IN: session key */ -} lstio_session_end_args_t; +}; #define LST_OPC_SESSION 1 #define LST_OPC_GROUP 2 diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index b360310..3217447 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -78,7 +78,7 @@ } static int -lst_session_end_ioctl(lstio_session_end_args_t *args) +lst_session_end_ioctl(struct lstio_session_end_args *args) { if (args->lstio_ses_key != console_session.ses_key) return -EACCES; @@ -858,7 +858,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_session_new_ioctl((struct lstio_session_new_args *)buf); break; case LSTIO_SESSION_END: - rc = lst_session_end_ioctl((lstio_session_end_args_t *)buf); + rc = lst_session_end_ioctl((struct lstio_session_end_args *)buf); break; case LSTIO_SESSION_INFO: rc = lst_session_info_ioctl((struct lstio_session_info_args *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:19 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:19 -0500 Subject: [lustre-devel] [PATCH 16/34] staging: lustre: lnet: change lstio_group_update_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-17-git-send-email-jsimmons@infradead.org> Change lstio_group_update_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 2a02ce5..ff64c2f 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -310,7 +310,7 @@ struct lstio_group_del_args { * in the group */ #define LST_GROUP_RMND 3 /* delete nodes from the group */ -typedef struct { +struct lstio_group_update_args { int lstio_grp_key; /* IN: session key */ int lstio_grp_opc; /* IN: OPC */ int lstio_grp_args; /* IN: arguments */ @@ -320,7 +320,7 @@ struct lstio_group_del_args { lnet_process_id_t __user *lstio_grp_idsp; /* IN: array of nodes */ struct list_head __user *lstio_grp_resultp; /* OUT: list head of result buffer */ -} lstio_group_update_args_t; +}; typedef struct { int lstio_grp_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 5a84c1f..0467f3f 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -256,7 +256,7 @@ } static int -lst_group_update_ioctl(lstio_group_update_args_t *args) +lst_group_update_ioctl(struct lstio_group_update_args *args) { int rc; char *name; @@ -873,7 +873,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_group_del_ioctl((struct lstio_group_del_args *)buf); break; case LSTIO_GROUP_UPDATE: - rc = lst_group_update_ioctl((lstio_group_update_args_t *)buf); + rc = lst_group_update_ioctl((struct lstio_group_update_args *)buf); break; case LSTIO_NODES_ADD: rc = lst_nodes_add_ioctl((lstio_group_nodes_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:14 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:14 -0500 Subject: [lustre-devel] [PATCH 11/34] staging: lustre: lnet: change lstio_session_info_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-12-git-send-email-jsimmons@infradead.org> Change lstio_session_info_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 079644e..6dfccc5 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -251,7 +251,7 @@ struct lstio_session_new_args { }; /* query current session */ -typedef struct { +struct lstio_session_info_args { struct lst_sid __user *lstio_ses_idp; /* OUT: session id */ int __user *lstio_ses_keyp; /* OUT: local key */ /** OUT: session features */ @@ -259,7 +259,7 @@ struct lstio_session_new_args { struct lstcon_ndlist_ent __user *lstio_ses_ndinfo;/* OUT: */ int lstio_ses_nmlen; /* IN: name length */ char __user *lstio_ses_namep; /* OUT: session name */ -} lstio_session_info_args_t; +}; /* delete a session */ typedef struct { diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 9007ebf..b360310 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -87,7 +87,7 @@ } static int -lst_session_info_ioctl(lstio_session_info_args_t *args) +lst_session_info_ioctl(struct lstio_session_info_args *args) { /* no checking of key */ @@ -861,7 +861,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_session_end_ioctl((lstio_session_end_args_t *)buf); break; case LSTIO_SESSION_INFO: - rc = lst_session_info_ioctl((lstio_session_info_args_t *)buf); + rc = lst_session_info_ioctl((struct lstio_session_info_args *)buf); break; case LSTIO_DEBUG: rc = lst_debug_ioctl((lstio_debug_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:18 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:18 -0500 Subject: [lustre-devel] [PATCH 15/34] staging: lustre: lnet: change lstio_group_del_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-16-git-send-email-jsimmons@infradead.org> Change lstio_group_del_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 7194552..2a02ce5 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -299,11 +299,11 @@ struct lstio_group_add_args { char __user *lstio_grp_namep; /* IN: group name */ }; -typedef struct { +struct lstio_group_del_args { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name length */ char __user *lstio_grp_namep; /* IN: group name */ -} lstio_group_del_args_t; +}; #define LST_GROUP_CLEAN 1 /* remove inactive nodes in the group */ #define LST_GROUP_REFRESH 2 /* refresh inactive nodes diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index c3435b4..5a84c1f 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -223,7 +223,7 @@ } static int -lst_group_del_ioctl(lstio_group_del_args_t *args) +lst_group_del_ioctl(struct lstio_group_del_args *args) { int rc; char *name; @@ -870,7 +870,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_group_add_ioctl((struct lstio_group_add_args *)buf); break; case LSTIO_GROUP_DEL: - rc = lst_group_del_ioctl((lstio_group_del_args_t *)buf); + rc = lst_group_del_ioctl((struct lstio_group_del_args *)buf); break; case LSTIO_GROUP_UPDATE: rc = lst_group_update_ioctl((lstio_group_update_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:06 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:06 -0500 Subject: [lustre-devel] [PATCH 03/34] staging: lustre: lnet: change lstcon_node_ent_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-4-git-send-email-jsimmons@infradead.org> Change lstcon_node_ent_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 8 ++++---- drivers/staging/lustre/lnet/selftest/console.c | 6 +++--- drivers/staging/lustre/lnet/selftest/console.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index b721287..3252239 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -85,10 +85,10 @@ struct lst_bid { #define LST_NODE_DOWN 0x4 /* node is down */ #define LST_NODE_UNKNOWN 0x8 /* node not in session */ -typedef struct { +struct lstcon_node_ent { lnet_process_id_t nde_id; /* id of node */ int nde_state; /* state of node */ -} lstcon_node_ent_t; /*** node entry, for list_group command */ +}; /*** node entry, for list_group command */ typedef struct { int nle_nnode; /* # of nodes */ @@ -349,7 +349,7 @@ struct lst_bid { group */ int __user *lstio_grp_idxp; /* IN/OUT: node index */ int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t __user *lstio_grp_dentsp; /* OUT: nodent array */ + struct lstcon_node_ent __user *lstio_grp_dentsp; /* OUT: nodent array */ } lstio_group_info_args_t; #define LST_DEFAULT_BATCH "batch" /* default batch name */ @@ -417,7 +417,7 @@ struct lst_bid { int __user *lstio_bat_idxp; /* IN/OUT: index of node */ int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */ - lstcon_node_ent_t __user *lstio_bat_dentsp; /* array of nodent */ + struct lstcon_node_ent __user *lstio_bat_dentsp;/* array of nodent */ } lstio_batch_info_args_t; /* add stat in session */ diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 02dbfef..8855d2e 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -741,7 +741,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, static int lstcon_nodes_getent(struct list_head *head, int *index_p, - int *count_p, lstcon_node_ent_t __user *dents_up) + int *count_p, struct lstcon_node_ent __user *dents_up) { struct lstcon_ndlink *ndl; struct lstcon_node *nd; @@ -782,7 +782,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, int lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, int *index_p, int *count_p, - lstcon_node_ent_t __user *dents_up) + struct lstcon_node_ent __user *dents_up) { lstcon_ndlist_ent_t *gentp; struct lstcon_group *grp; @@ -928,7 +928,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, int lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, int server, int testidx, int *index_p, int *ndent_p, - lstcon_node_ent_t __user *dents_up) + struct lstcon_node_ent __user *dents_up) { lstcon_test_batch_ent_t *entp; struct list_head *clilst; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index b37c37e..f6cc694 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -215,7 +215,7 @@ int lstcon_nodes_remove(char *name, int nnd, lnet_process_id_t __user *nds_up, struct list_head __user *result_up); int lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gent_up, int *index_p, int *ndent_p, - lstcon_node_ent_t __user *ndents_up); + struct lstcon_node_ent __user *ndents_up); int lstcon_group_list(int idx, int len, char __user *name_up); int lstcon_batch_add(char *name); int lstcon_batch_run(char *name, int timeout, @@ -229,7 +229,7 @@ int lstcon_test_batch_query(char *name, int testidx, int lstcon_batch_list(int idx, int namelen, char __user *name_up); int lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, int server, int testidx, int *index_p, - int *ndent_p, lstcon_node_ent_t __user *dents_up); + int *ndent_p, struct lstcon_node_ent __user *dents_up); int lstcon_group_stat(char *grp_name, int timeout, struct list_head __user *result_up); int lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up, -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:24 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:24 -0500 Subject: [lustre-devel] [PATCH 21/34] staging: lustre: lnet: change lstio_batch_del_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-22-git-send-email-jsimmons@infradead.org> Change lstio_batch_del_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 41cbe3a..c01931c 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -360,11 +360,11 @@ struct lstio_batch_add_args { char __user *lstio_bat_namep; /* IN: batch name */ }; -typedef struct { +struct lstio_batch_del_args { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ char __user *lstio_bat_namep; /* IN: batch name */ -} lstio_batch_del_args_t; +}; typedef struct { int lstio_bat_key; /* IN: session key */ -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:36 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:36 -0500 Subject: [lustre-devel] [PATCH 33/34] staging: lustre: lnet: change srpc_counters_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-34-git-send-email-jsimmons@infradead.org> Change srpc_counters_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/console.c | 4 ++-- drivers/staging/lustre/lnet/selftest/rpc.c | 6 +++--- drivers/staging/lustre/lnet/selftest/rpc.h | 2 +- drivers/staging/lustre/lnet/selftest/selftest.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index a9c5b6d..575d23a 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -501,7 +501,7 @@ struct lst_test_ping_param { int png_flags; /* reserved flags */ }; -typedef struct { +struct srpc_counters { __u32 errors; __u32 rpcs_sent; __u32 rpcs_rcvd; @@ -509,7 +509,7 @@ struct lst_test_ping_param { __u32 rpcs_expired; __u64 bulk_get; __u64 bulk_put; -} WIRE_ATTR srpc_counters_t; +} WIRE_ATTR; typedef struct { /** milliseconds since current session started */ diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index b01023c..483a1bb 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1468,14 +1468,14 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, { struct srpc_stat_reply *rep = &msg->msg_body.stat_reply; sfw_counters_t __user *sfwk_stat; - srpc_counters_t __user *srpc_stat; + struct srpc_counters __user *srpc_stat; lnet_counters_t __user *lnet_stat; if (rep->str_status) return 0; sfwk_stat = (sfw_counters_t __user *)&ent_up->rpe_payload[0]; - srpc_stat = (srpc_counters_t __user *)(sfwk_stat + 1); + srpc_stat = (struct srpc_counters __user *)(sfwk_stat + 1); lnet_stat = (lnet_counters_t __user *)(srpc_stat + 1); if (copy_to_user(sfwk_stat, &rep->str_fw, sizeof(*sfwk_stat)) || diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index ce9de8c..92cd411 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -55,7 +55,7 @@ enum srpc_state { struct srpc_service *rpc_services[SRPC_SERVICE_MAX_ID + 1]; lnet_handle_eq_t rpc_lnet_eq; /* _the_ LNet event queue */ enum srpc_state rpc_state; - srpc_counters_t rpc_counters; + struct srpc_counters rpc_counters; __u64 rpc_matchbits; /* matchbits counter */ } srpc_data; @@ -69,14 +69,14 @@ enum srpc_state { /* forward ref's */ int srpc_handle_rpc(struct swi_workitem *wi); -void srpc_get_counters(srpc_counters_t *cnt) +void srpc_get_counters(struct srpc_counters *cnt) { spin_lock(&srpc_data.rpc_glock); *cnt = srpc_data.rpc_counters; spin_unlock(&srpc_data.rpc_glock); } -void srpc_set_counters(const srpc_counters_t *cnt) +void srpc_set_counters(const struct srpc_counters *cnt) { spin_lock(&srpc_data.rpc_glock); srpc_data.rpc_counters = *cnt; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index f2987c5..a5b44db 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -162,7 +162,7 @@ struct srpc_stat_reply { __u32 str_status; struct lst_sid str_sid; sfw_counters_t str_fw; - srpc_counters_t str_rpc; + struct srpc_counters str_rpc; lnet_counters_t str_lnet; } WIRE_ATTR; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 79b05aa..1e5526c 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -453,8 +453,8 @@ struct srpc_bulk *srpc_alloc_bulk(int cpt, unsigned int off, int srpc_finish_service(struct srpc_service *sv); int srpc_service_add_buffers(struct srpc_service *sv, int nbuffer); void srpc_service_remove_buffers(struct srpc_service *sv, int nbuffer); -void srpc_get_counters(srpc_counters_t *cnt); -void srpc_set_counters(const srpc_counters_t *cnt); +void srpc_get_counters(struct srpc_counters *cnt); +void srpc_set_counters(const struct srpc_counters *cnt); extern struct cfs_wi_sched *lst_sched_serial; extern struct cfs_wi_sched **lst_sched_test; -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:23 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:23 -0500 Subject: [lustre-devel] [PATCH 20/34] staging: lustre: lnet: change lstio_batch_add_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-21-git-send-email-jsimmons@infradead.org> Change lstio_batch_add_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 715e591..41cbe3a 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -354,11 +354,11 @@ struct lstio_group_info_args { #define LST_DEFAULT_BATCH "batch" /* default batch name */ -typedef struct { +struct lstio_batch_add_args { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ char __user *lstio_bat_namep; /* IN: batch name */ -} lstio_batch_add_args_t; +}; typedef struct { int lstio_bat_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index e9b2d97..0ed59be 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -438,7 +438,7 @@ } static int -lst_batch_add_ioctl(lstio_batch_add_args_t *args) +lst_batch_add_ioctl(struct lstio_batch_add_args *args) { int rc; char *name; @@ -885,7 +885,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_group_info_ioctl((struct lstio_group_info_args *)buf); break; case LSTIO_BATCH_ADD: - rc = lst_batch_add_ioctl((lstio_batch_add_args_t *)buf); + rc = lst_batch_add_ioctl((struct lstio_batch_add_args *)buf); break; case LSTIO_BATCH_START: rc = lst_batch_run_ioctl((lstio_batch_run_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:21 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:21 -0500 Subject: [lustre-devel] [PATCH 18/34] staging: lustre: lnet: change lstio_group_list_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-19-git-send-email-jsimmons@infradead.org> Change lstio_group_list_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index bee55a0..12aa7b6 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -334,12 +334,12 @@ struct lstio_group_nodes_args { result buffer */ }; -typedef struct { +struct lstio_group_list_args { int lstio_grp_key; /* IN: session key */ int lstio_grp_idx; /* IN: group idx */ int lstio_grp_nmlen; /* IN: name len */ char __user *lstio_grp_namep; /* OUT: name */ -} lstio_group_list_args_t; +}; typedef struct { int lstio_grp_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index fe42e63..a2513d8 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -358,7 +358,7 @@ } static int -lst_group_list_ioctl(lstio_group_list_args_t *args) +lst_group_list_ioctl(struct lstio_group_list_args *args) { if (args->lstio_grp_key != console_session.ses_key) return -EACCES; @@ -879,7 +879,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_nodes_add_ioctl((struct lstio_group_nodes_args *)buf); break; case LSTIO_GROUP_LIST: - rc = lst_group_list_ioctl((lstio_group_list_args_t *)buf); + rc = lst_group_list_ioctl((struct lstio_group_list_args *)buf); break; case LSTIO_GROUP_INFO: rc = lst_group_info_ioctl((lstio_group_info_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:22 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:22 -0500 Subject: [lustre-devel] [PATCH 19/34] staging: lustre: lnet: change lstio_group_info_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-20-git-send-email-jsimmons@infradead.org> Change lstio_group_info_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 12aa7b6..715e591 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -341,7 +341,7 @@ struct lstio_group_list_args { char __user *lstio_grp_namep; /* OUT: name */ }; -typedef struct { +struct lstio_group_info_args { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name len */ char __user *lstio_grp_namep; /* IN: name */ @@ -350,7 +350,7 @@ struct lstio_group_list_args { int __user *lstio_grp_idxp; /* IN/OUT: node index */ int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */ struct lstcon_node_ent __user *lstio_grp_dentsp;/* OUT: nodent array */ -} lstio_group_info_args_t; +}; #define LST_DEFAULT_BATCH "batch" /* default batch name */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index a2513d8..e9b2d97 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -375,7 +375,7 @@ } static int -lst_group_info_ioctl(lstio_group_info_args_t *args) +lst_group_info_ioctl(struct lstio_group_info_args *args) { char *name; int ndent; @@ -882,7 +882,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_group_list_ioctl((struct lstio_group_list_args *)buf); break; case LSTIO_GROUP_INFO: - rc = lst_group_info_ioctl((lstio_group_info_args_t *)buf); + rc = lst_group_info_ioctl((struct lstio_group_info_args *)buf); break; case LSTIO_BATCH_ADD: rc = lst_batch_add_ioctl((lstio_batch_add_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:29 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:29 -0500 Subject: [lustre-devel] [PATCH 26/34] staging: lustre: lnet: change lstio_batch_info_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-27-git-send-email-jsimmons@infradead.org> Change lstio_batch_info_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 5e594f6..3427512 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -406,7 +406,7 @@ struct lstio_batch_list_args { char __user *lstio_bat_namep; /* IN: batch name */ }; -typedef struct { +struct lstio_batch_info_args { int lstio_bat_key; /* IN: session key */ int lstio_bat_nmlen; /* IN: name length */ char __user *lstio_bat_namep; /* IN: name */ @@ -418,7 +418,7 @@ struct lstio_batch_list_args { int __user *lstio_bat_idxp; /* IN/OUT: index of node */ int __user *lstio_bat_ndentp; /* IN/OUT: # of nodent */ struct lstcon_node_ent __user *lstio_bat_dentsp;/* array of nodent */ -} lstio_batch_info_args_t; +}; /* add stat in session */ typedef struct { diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index fd5eb7b..b76b62e 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -598,7 +598,7 @@ } static int -lst_batch_info_ioctl(lstio_batch_info_args_t *args) +lst_batch_info_ioctl(struct lstio_batch_info_args *args) { char *name; int rc; @@ -900,7 +900,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_batch_list_ioctl((struct lstio_batch_list_args *)buf); break; case LSTIO_BATCH_INFO: - rc = lst_batch_info_ioctl((lstio_batch_info_args_t *)buf); + rc = lst_batch_info_ioctl((struct lstio_batch_info_args *)buf); break; case LSTIO_TEST_ADD: rc = lst_test_add_ioctl((lstio_test_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:20 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:20 -0500 Subject: [lustre-devel] [PATCH 17/34] staging: lustre: lnet: change lstio_group_nodes_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-18-git-send-email-jsimmons@infradead.org> Change lstio_group_nodes_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index ff64c2f..bee55a0 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -322,7 +322,7 @@ struct lstio_group_update_args { result buffer */ }; -typedef struct { +struct lstio_group_nodes_args { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name length */ char __user *lstio_grp_namep; /* IN: group name */ @@ -332,7 +332,7 @@ struct lstio_group_update_args { lnet_process_id_t __user *lstio_grp_idsp; /* IN: nodes */ struct list_head __user *lstio_grp_resultp; /* OUT: list head of result buffer */ -} lstio_group_nodes_args_t; +}; typedef struct { int lstio_grp_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 0467f3f..fe42e63 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -313,7 +313,7 @@ } static int -lst_nodes_add_ioctl(lstio_group_nodes_args_t *args) +lst_nodes_add_ioctl(struct lstio_group_nodes_args *args) { unsigned int feats; int rc; @@ -876,7 +876,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_group_update_ioctl((struct lstio_group_update_args *)buf); break; case LSTIO_NODES_ADD: - rc = lst_nodes_add_ioctl((lstio_group_nodes_args_t *)buf); + rc = lst_nodes_add_ioctl((struct lstio_group_nodes_args *)buf); break; case LSTIO_GROUP_LIST: rc = lst_group_list_ioctl((lstio_group_list_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:25 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:25 -0500 Subject: [lustre-devel] [PATCH 22/34] staging: lustre: lnet: change lstio_batch_run_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-23-git-send-email-jsimmons@infradead.org> Change lstio_batch_run_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index c01931c..2c80c34 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -366,7 +366,7 @@ struct lstio_batch_del_args { char __user *lstio_bat_namep; /* IN: batch name */ }; -typedef struct { +struct lstio_batch_run_args { int lstio_bat_key; /* IN: session key */ int lstio_bat_timeout; /* IN: timeout for the batch */ @@ -374,7 +374,7 @@ struct lstio_batch_del_args { char __user *lstio_bat_namep; /* IN: batch name */ struct list_head __user *lstio_bat_resultp; /* OUT: list head of result buffer */ -} lstio_batch_run_args_t; +}; typedef struct { int lstio_bat_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 0ed59be..6631824 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -471,7 +471,7 @@ } static int -lst_batch_run_ioctl(lstio_batch_run_args_t *args) +lst_batch_run_ioctl(struct lstio_batch_run_args *args) { int rc; char *name; @@ -888,7 +888,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_batch_add_ioctl((struct lstio_batch_add_args *)buf); break; case LSTIO_BATCH_START: - rc = lst_batch_run_ioctl((lstio_batch_run_args_t *)buf); + rc = lst_batch_run_ioctl((struct lstio_batch_run_args *)buf); break; case LSTIO_BATCH_STOP: rc = lst_batch_stop_ioctl((lstio_batch_stop_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:27 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:27 -0500 Subject: [lustre-devel] [PATCH 24/34] staging: lustre: lnet: change lstio_batch_query_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-25-git-send-email-jsimmons@infradead.org> Change lstio_batch_query_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 9e90be1..a65309c 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -386,7 +386,7 @@ struct lstio_batch_stop_args { result buffer */ }; -typedef struct { +struct lstio_batch_query_args { int lstio_bat_key; /* IN: session key */ int lstio_bat_testidx; /* IN: test index */ int lstio_bat_client; /* IN: we testing @@ -397,7 +397,7 @@ struct lstio_batch_stop_args { char __user *lstio_bat_namep; /* IN: batch name */ struct list_head __user *lstio_bat_resultp; /* OUT: list head of result buffer */ -} lstio_batch_query_args_t; +}; typedef struct { int lstio_bat_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 78dbfa2..353008e 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -540,7 +540,7 @@ } static int -lst_batch_query_ioctl(lstio_batch_query_args_t *args) +lst_batch_query_ioctl(struct lstio_batch_query_args *args) { char *name; int rc; @@ -894,7 +894,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_batch_stop_ioctl((struct lstio_batch_stop_args *)buf); break; case LSTIO_BATCH_QUERY: - rc = lst_batch_query_ioctl((lstio_batch_query_args_t *)buf); + rc = lst_batch_query_ioctl((struct lstio_batch_query_args *)buf); break; case LSTIO_BATCH_LIST: rc = lst_batch_list_ioctl((lstio_batch_list_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:32 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:32 -0500 Subject: [lustre-devel] [PATCH 29/34] staging: lustre: lnet: change lstio_test_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-30-git-send-email-jsimmons@infradead.org> Change lstio_test_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 495cc01..fdab4b6 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -442,7 +442,7 @@ enum lst_test_type { /* create a test in a batch */ #define LST_MAX_CONCUR 1024 /* Max concurrency of test */ -typedef struct { +struct lstio_test_args { int lstio_tes_key; /* IN: session key */ int lstio_tes_bat_nmlen; /* IN: batch name len */ char __user *lstio_tes_bat_name; /* IN: batch name */ @@ -472,7 +472,7 @@ enum lst_test_type { value */ struct list_head __user *lstio_tes_resultp;/* OUT: list head of result buffer */ -} lstio_test_args_t; +}; typedef enum { LST_BRW_READ = 1, diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 9039f9f..6ca7192 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -707,7 +707,7 @@ return rc; } -static int lst_test_add_ioctl(lstio_test_args_t *args) +static int lst_test_add_ioctl(struct lstio_test_args *args) { char *batch_name; char *src_name = NULL; @@ -903,7 +903,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_batch_info_ioctl((struct lstio_batch_info_args *)buf); break; case LSTIO_TEST_ADD: - rc = lst_test_add_ioctl((lstio_test_args_t *)buf); + rc = lst_test_add_ioctl((struct lstio_test_args *)buf); break; case LSTIO_STAT_QUERY: rc = lst_stat_query_ioctl((struct lstio_stat_args *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:31 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:31 -0500 Subject: [lustre-devel] [PATCH 28/34] staging: lustre: lnet: change lst_test_type_t to proper enum In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-29-git-send-email-jsimmons@infradead.org> Change lst_test_type_t from typedef to proper enum. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 27b2bde..495cc01 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -434,10 +434,10 @@ struct lstio_stat_args { result buffer */ }; -typedef enum { +enum lst_test_type { LST_TEST_BULK = 1, LST_TEST_PING = 2 -} lst_test_type_t; +}; /* create a test in a batch */ #define LST_MAX_CONCUR 1024 /* Max concurrency of test */ -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:34 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:34 -0500 Subject: [lustre-devel] [PATCH 31/34] staging: lustre: lnet: change lst_test_bulk_param_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-32-git-send-email-jsimmons@infradead.org> Change lst_test_bulk_param_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 0279e09..d59d7ba 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -485,14 +485,14 @@ enum lst_brw_flags { LST_BRW_CHECK_FULL = 3 }; -typedef struct { +struct lst_test_bulk_param { int blk_opc; /* bulk operation code */ int blk_size; /* size (bytes) */ int blk_time; /* time of running the test*/ int blk_flags; /* reserved flags */ int blk_cli_off; /* bulk offset on client */ int blk_srv_off; /* reserved: bulk offset on server */ -} lst_test_bulk_param_t; +}; typedef struct { int png_size; /* size of ping message */ diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 3b97915..bcbe84e 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -779,7 +779,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, } static int -lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, +lstcon_bulkrpc_v0_prep(struct lst_test_bulk_param *param, struct srpc_test_reqst *req) { struct test_bulk_req *brq = &req->tsr_u.bulk_v0; @@ -793,7 +793,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, } static int -lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, bool is_client, +lstcon_bulkrpc_v1_prep(struct lst_test_bulk_param *param, bool is_client, struct srpc_test_reqst *req) { struct test_bulk_req_v1 *brq = &req->tsr_u.bulk_v1; @@ -898,10 +898,10 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, case LST_TEST_BULK: trq->tsr_service = SRPC_SERVICE_BRW; if (!(feats & LST_FEAT_BULK_LEN)) { - rc = lstcon_bulkrpc_v0_prep((lst_test_bulk_param_t *) + rc = lstcon_bulkrpc_v0_prep((struct lst_test_bulk_param *) &test->tes_param[0], trq); } else { - rc = lstcon_bulkrpc_v1_prep((lst_test_bulk_param_t *) + rc = lstcon_bulkrpc_v1_prep((struct lst_test_bulk_param *) &test->tes_param[0], trq->tsr_is_client, trq); } -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:35 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:35 -0500 Subject: [lustre-devel] [PATCH 32/34] staging: lustre: lnet: change lst_test_ping_param_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-33-git-send-email-jsimmons@infradead.org> Change lst_test_ping_param_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index d59d7ba..a9c5b6d 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -494,12 +494,12 @@ struct lst_test_bulk_param { int blk_srv_off; /* reserved: bulk offset on server */ }; -typedef struct { +struct lst_test_ping_param { int png_size; /* size of ping message */ int png_time; /* time */ int png_loop; /* loop */ int png_flags; /* reserved flags */ -} lst_test_ping_param_t; +}; typedef struct { __u32 errors; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index bcbe84e..3d325ea 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -768,7 +768,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, } static int -lstcon_pingrpc_prep(lst_test_ping_param_t *param, struct srpc_test_reqst *req) +lstcon_pingrpc_prep(struct lst_test_ping_param *param, struct srpc_test_reqst *req) { struct test_ping_req *prq = &req->tsr_u.ping; @@ -891,7 +891,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, switch (test->tes_type) { case LST_TEST_PING: trq->tsr_service = SRPC_SERVICE_PING; - rc = lstcon_pingrpc_prep((lst_test_ping_param_t *) + rc = lstcon_pingrpc_prep((struct lst_test_ping_param *) &test->tes_param[0], trq); break; -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:05 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:05 -0500 Subject: [lustre-devel] [PATCH 02/34] staging: lustre: lnet: change lst_bid_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-3-git-send-email-jsimmons@infradead.org> Change lst_bid_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/console.h | 2 +- drivers/staging/lustre/lnet/selftest/framework.c | 4 ++-- drivers/staging/lustre/lnet/selftest/rpc.h | 4 ++-- drivers/staging/lustre/lnet/selftest/selftest.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 68c7f58..b721287 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -75,9 +75,9 @@ struct lst_sid { extern struct lst_sid LST_INVALID_SID; -typedef struct { +struct lst_bid { __u64 bat_id; /* unique id in session */ -} lst_bid_t; /*** batch id (group of tests) */ +}; /*** batch id (group of tests) */ /* Status of test node */ #define LST_NODE_ACTIVE 0x1 /* node in this session */ diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index 4bf7ecd..b37c37e 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -81,7 +81,7 @@ struct lstcon_group { #define LST_BATCH_RUNNING 0xB1 /* running batch */ struct lstcon_tsb_hdr { - lst_bid_t tsb_id; /* batch ID */ + struct lst_bid tsb_id; /* batch ID */ int tsb_index; /* test index */ }; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 4100f67..5ca6712 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -316,7 +316,7 @@ } static struct sfw_batch * -sfw_find_batch(lst_bid_t bid) +sfw_find_batch(struct lst_bid bid) { struct sfw_session *sn = sfw_data.fw_session; struct sfw_batch *bat; @@ -332,7 +332,7 @@ } static struct sfw_batch * -sfw_bid2batch(lst_bid_t bid) +sfw_bid2batch(struct lst_bid bid) { struct sfw_session *sn = sfw_data.fw_session; struct sfw_batch *bat; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index 3324c3f..f2987c5 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -139,7 +139,7 @@ struct srpc_debug_reply { struct srpc_batch_reqst { __u64 bar_rpyid; /* reply buffer matchbits */ struct lst_sid bar_sid; /* session id */ - lst_bid_t bar_bid; /* batch id */ + struct lst_bid bar_bid; /* batch id */ __u32 bar_opc; /* create/start/stop batch */ __u32 bar_testidx; /* index of test */ __u32 bar_arg; /* parameters */ @@ -188,7 +188,7 @@ struct srpc_test_reqst { __u64 tsr_rpyid; /* reply buffer matchbits */ __u64 tsr_bulkid; /* bulk buffer matchbits */ struct lst_sid tsr_sid; /* session id */ - lst_bid_t tsr_bid; /* batch id */ + struct lst_bid tsr_bid; /* batch id */ __u32 tsr_service; /* test type: bulk|ping|... */ __u32 tsr_loop; /* test client loop count or * # server buffers needed diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 35f98ae..79b05aa 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -340,7 +340,7 @@ struct sfw_session { struct sfw_batch { struct list_head bat_list; /* chain on sn_batches */ - lst_bid_t bat_id; /* batch id */ + struct lst_bid bat_id; /* batch id */ int bat_error; /* error code of batch */ struct sfw_session *bat_session; /* batch's session */ atomic_t bat_nactive; /* # of active tests */ -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:07 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:07 -0500 Subject: [lustre-devel] [PATCH 04/34] staging: lustre: lnet: change lstcon_ndlist_ent_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-5-git-send-email-jsimmons@infradead.org> Change lstcon_ndlist_ent_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 16 ++++++++-------- drivers/staging/lustre/lnet/selftest/console.c | 14 +++++++------- drivers/staging/lustre/lnet/selftest/console.h | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 3252239..ec243d7 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -90,13 +90,13 @@ struct lstcon_node_ent { int nde_state; /* state of node */ }; /*** node entry, for list_group command */ -typedef struct { +struct lstcon_ndlist_ent { int nle_nnode; /* # of nodes */ int nle_nactive; /* # of active nodes */ int nle_nbusy; /* # of busy nodes */ int nle_ndown; /* # of down nodes */ int nle_nunknown; /* # of unknown nodes */ -} lstcon_ndlist_ent_t; /*** node_list entry, for list_batch command */ +}; /*** node_list entry, for list_batch command */ typedef struct { int tse_type; /* test type */ @@ -113,9 +113,9 @@ struct lstcon_node_ent { *** list_batch command */ typedef struct { - lstcon_ndlist_ent_t tbe_cli_nle; /* client (group) node_list + struct lstcon_ndlist_ent tbe_cli_nle; /* client (group) node_list * entry */ - lstcon_ndlist_ent_t tbe_srv_nle; /* server (group) node_list + struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list * entry */ union { lstcon_test_ent_t tbe_test; /* test entry */ @@ -256,7 +256,7 @@ struct lstcon_node_ent { int __user *lstio_ses_keyp; /* OUT: local key */ /** OUT: session features */ unsigned int __user *lstio_ses_featp; - lstcon_ndlist_ent_t __user *lstio_ses_ndinfo; /* OUT: */ + struct lstcon_ndlist_ent __user *lstio_ses_ndinfo;/* OUT: */ int lstio_ses_nmlen; /* IN: name length */ char __user *lstio_ses_namep; /* OUT: session name */ } lstio_session_info_args_t; @@ -345,11 +345,11 @@ struct lstcon_node_ent { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name len */ char __user *lstio_grp_namep; /* IN: name */ - lstcon_ndlist_ent_t __user *lstio_grp_entp; /* OUT: description of - group */ + struct lstcon_ndlist_ent __user *lstio_grp_entp;/* OUT: description of + group */ int __user *lstio_grp_idxp; /* IN/OUT: node index */ int __user *lstio_grp_ndentp; /* IN/OUT: # of nodent */ - struct lstcon_node_ent __user *lstio_grp_dentsp; /* OUT: nodent array */ + struct lstcon_node_ent __user *lstio_grp_dentsp;/* OUT: nodent array */ } lstio_group_info_args_t; #define LST_DEFAULT_BATCH "batch" /* default batch name */ diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 8855d2e..9af761f 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -780,11 +780,11 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, } int -lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, +lstcon_group_info(char *name, struct lstcon_ndlist_ent __user *gents_p, int *index_p, int *count_p, struct lstcon_node_ent __user *dents_up) { - lstcon_ndlist_ent_t *gentp; + struct lstcon_ndlist_ent *gentp; struct lstcon_group *grp; struct lstcon_ndlink *ndl; int rc; @@ -805,7 +805,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, } /* non-verbose query */ - LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t)); + LIBCFS_ALLOC(gentp, sizeof(struct lstcon_ndlist_ent)); if (!gentp) { CERROR("Can't allocate ndlist_ent\n"); lstcon_group_decref(grp); @@ -817,9 +817,9 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp); rc = copy_to_user(gents_p, gentp, - sizeof(lstcon_ndlist_ent_t)) ? -EFAULT : 0; + sizeof(struct lstcon_ndlist_ent)) ? -EFAULT : 0; - LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t)); + LIBCFS_FREE(gentp, sizeof(struct lstcon_ndlist_ent)); lstcon_group_decref(grp); @@ -1778,10 +1778,10 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, int lstcon_session_info(struct lst_sid __user *sid_up, int __user *key_up, unsigned __user *featp, - lstcon_ndlist_ent_t __user *ndinfo_up, + struct lstcon_ndlist_ent __user *ndinfo_up, char __user *name_up, int len) { - lstcon_ndlist_ent_t *entp; + struct lstcon_ndlist_ent *entp; struct lstcon_ndlink *ndl; int rc = 0; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index f6cc694..30d73b6 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -194,7 +194,7 @@ struct lstcon_session { int lstcon_session_new(char *name, int key, unsigned int version, int timeout, int flags, struct lst_sid __user *sid_up); int lstcon_session_info(struct lst_sid __user *sid_up, int __user *key, - unsigned __user *verp, lstcon_ndlist_ent_t __user *entp, + unsigned __user *verp, struct lstcon_ndlist_ent __user *entp, char __user *name_up, int len); int lstcon_session_end(void); int lstcon_session_debug(int timeout, struct list_head __user *result_up); @@ -213,7 +213,7 @@ int lstcon_nodes_add(char *name, int nnd, lnet_process_id_t __user *nds_up, unsigned int *featp, struct list_head __user *result_up); int lstcon_nodes_remove(char *name, int nnd, lnet_process_id_t __user *nds_up, struct list_head __user *result_up); -int lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gent_up, +int lstcon_group_info(char *name, struct lstcon_ndlist_ent __user *gent_up, int *index_p, int *ndent_p, struct lstcon_node_ent __user *ndents_up); int lstcon_group_list(int idx, int len, char __user *name_up); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:09 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:09 -0500 Subject: [lustre-devel] [PATCH 06/34] staging: lustre: lnet: change lstcon_batch_ent_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-7-git-send-email-jsimmons@infradead.org> Change lstcon_batch_ent_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index f197eb3..f2b98e9 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -105,11 +105,11 @@ struct lstcon_test_ent { }; /*** test summary entry, for *** list_batch command */ -typedef struct { +struct lstcon_batch_ent { int bae_state; /* batch status */ int bae_timeout; /* batch timeout */ int bae_ntest; /* # of tests in the batch */ -} lstcon_batch_ent_t; /*** batch summary entry, for +}; /*** batch summary entry, for *** list_batch command */ typedef struct { @@ -119,7 +119,7 @@ struct lstcon_test_ent { * entry */ union { struct lstcon_test_ent tbe_test; /* test entry */ - lstcon_batch_ent_t tbe_batch; /* batch entry */ + struct lstcon_batch_ent tbe_batch;/* batch entry */ } u; } lstcon_test_batch_ent_t; /*** test/batch verbose information entry, *** for list_batch command */ -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:11 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:11 -0500 Subject: [lustre-devel] [PATCH 08/34] staging: lustre: lnet: change lstcon_rpc_ent_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-9-git-send-email-jsimmons@infradead.org> Change lstcon_rpc_ent_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/conrpc.h | 2 +- drivers/staging/lustre/lnet/selftest/console.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index adc03fe..f5c68c1 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -124,7 +124,7 @@ struct lstcon_test_batch_ent { }; /*** test/batch verbose information entry, *** for list_batch command */ -typedef struct { +struct lstcon_rpc_ent { struct list_head rpe_link; /* link chain */ lnet_process_id_t rpe_peer; /* peer's id */ struct timeval rpe_stamp; /* time stamp of RPC */ @@ -135,7 +135,7 @@ struct lstcon_test_batch_ent { int rpe_fwk_errno; /* framework errno */ int rpe_priv[4]; /* private data */ char rpe_payload[0]; /* private reply payload */ -} lstcon_rpc_ent_t; +}; typedef struct { int trs_rpc_stat[4]; /* RPCs stat (0: total diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 84ae010..bc924f9 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -469,7 +469,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, { struct list_head tmp; struct list_head __user *next; - lstcon_rpc_ent_t *ent; + struct lstcon_rpc_ent *ent; struct srpc_generic_reply *rep; struct lstcon_rpc *crpc; struct srpc_msg *msg; @@ -492,7 +492,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, next = tmp.next; - ent = list_entry(next, lstcon_rpc_ent_t, rpe_link); + ent = list_entry(next, struct lstcon_rpc_ent, rpe_link); LASSERT(crpc->crp_stamp); diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h b/drivers/staging/lustre/lnet/selftest/conrpc.h index e629e87..ad0a49e 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.h +++ b/drivers/staging/lustre/lnet/selftest/conrpc.h @@ -103,7 +103,7 @@ struct lstcon_rpc_trans { typedef int (*lstcon_rpc_cond_func_t)(int, struct lstcon_node *, void *); typedef int (*lstcon_rpc_readent_func_t)(int, struct srpc_msg *, - lstcon_rpc_ent_t __user *); + struct lstcon_rpc_ent __user *); int lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, unsigned int version, struct lstcon_rpc **crpc); diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index bf4111a..b01023c 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -368,7 +368,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, static int lstcon_sesrpc_readent(int transop, struct srpc_msg *msg, - lstcon_rpc_ent_t __user *ent_up) + struct lstcon_rpc_ent __user *ent_up) { struct srpc_debug_reply *rep; @@ -1385,7 +1385,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, static int lstcon_tsbrpc_readent(int transop, struct srpc_msg *msg, - lstcon_rpc_ent_t __user *ent_up) + struct lstcon_rpc_ent __user *ent_up) { struct srpc_batch_reply *rep = &msg->msg_body.bat_reply; @@ -1464,7 +1464,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, static int lstcon_statrpc_readent(int transop, struct srpc_msg *msg, - lstcon_rpc_ent_t __user *ent_up) + struct lstcon_rpc_ent __user *ent_up) { struct srpc_stat_reply *rep = &msg->msg_body.stat_reply; sfw_counters_t __user *sfwk_stat; -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:04 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:04 -0500 Subject: [lustre-devel] [PATCH 01/34] staging: lustre: lnet: change lst_nid_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-2-git-send-email-jsimmons@infradead.org> Change lst_nid_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 12 ++++----- drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- drivers/staging/lustre/lnet/selftest/console.c | 12 ++++----- drivers/staging/lustre/lnet/selftest/console.h | 8 +++--- drivers/staging/lustre/lnet/selftest/framework.c | 4 +-- drivers/staging/lustre/lnet/selftest/rpc.h | 30 +++++++++++----------- drivers/staging/lustre/lnet/selftest/selftest.h | 2 +- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 8a84888..68c7f58 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -68,12 +68,12 @@ #define LSTIO_BATCH_QUERY 0xC27 /* query batch status */ #define LSTIO_STAT_QUERY 0xC30 /* get stats */ -typedef struct { +struct lst_sid { lnet_nid_t ses_nid; /* nid of console node */ __u64 ses_stamp; /* time stamp */ -} lst_sid_t; /*** session id */ +}; /*** session id */ -extern lst_sid_t LST_INVALID_SID; +extern struct lst_sid LST_INVALID_SID; typedef struct { __u64 bat_id; /* unique id in session */ @@ -131,7 +131,7 @@ int rpe_state; /* peer's state */ int rpe_rpc_errno; /* RPC errno */ - lst_sid_t rpe_sid; /* peer's session id */ + struct lst_sid rpe_sid; /* peer's session id */ int rpe_fwk_errno; /* framework errno */ int rpe_priv[4]; /* private data */ char rpe_payload[0]; /* private reply payload */ @@ -245,14 +245,14 @@ int lstio_ses_force; /* IN: force create ? */ /** IN: session features */ unsigned int lstio_ses_feats; - lst_sid_t __user *lstio_ses_idp; /* OUT: session id */ + struct lst_sid __user *lstio_ses_idp; /* OUT: session id */ int lstio_ses_nmlen; /* IN: name length */ char __user *lstio_ses_namep; /* IN: session name */ } lstio_session_new_args_t; /* query current session */ typedef struct { - lst_sid_t __user *lstio_ses_idp; /* OUT: session id */ + struct lst_sid __user *lstio_ses_idp; /* OUT: session id */ int __user *lstio_ses_keyp; /* OUT: local key */ /** OUT: session features */ unsigned int __user *lstio_ses_featp; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 994422c..84ae010 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -519,7 +519,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, /* RPC is done */ rep = (struct srpc_generic_reply *)&msg->msg_body.reply; - if (copy_to_user(&ent->rpe_sid, &rep->sid, sizeof(lst_sid_t)) || + if (copy_to_user(&ent->rpe_sid, &rep->sid, sizeof(rep->sid)) || copy_to_user(&ent->rpe_fwk_errno, &rep->status, sizeof(rep->status))) return -EFAULT; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 1456d239..02dbfef 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1688,14 +1688,14 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, } int -lstcon_session_match(lst_sid_t sid) +lstcon_session_match(struct lst_sid sid) { return (console_session.ses_id.ses_nid == sid.ses_nid && console_session.ses_id.ses_stamp == sid.ses_stamp) ? 1 : 0; } static void -lstcon_new_session_id(lst_sid_t *sid) +lstcon_new_session_id(struct lst_sid *sid) { lnet_process_id_t id; @@ -1708,7 +1708,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, int lstcon_session_new(char *name, int key, unsigned int feats, - int timeout, int force, lst_sid_t __user *sid_up) + int timeout, int force, struct lst_sid __user *sid_up) { int rc = 0; int i; @@ -1767,7 +1767,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, } if (!copy_to_user(sid_up, &console_session.ses_id, - sizeof(lst_sid_t))) + sizeof(struct lst_sid))) return rc; lstcon_session_end(); @@ -1776,7 +1776,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, } int -lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up, +lstcon_session_info(struct lst_sid __user *sid_up, int __user *key_up, unsigned __user *featp, lstcon_ndlist_ent_t __user *ndinfo_up, char __user *name_up, int len) @@ -1796,7 +1796,7 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, LST_NODE_STATE_COUNTER(ndl->ndl_node, entp); if (copy_to_user(sid_up, &console_session.ses_id, - sizeof(lst_sid_t)) || + sizeof(*sid_up)) || copy_to_user(key_up, &console_session.ses_key, sizeof(*key_up)) || copy_to_user(featp, &console_session.ses_features, diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index 5dc1de4..4bf7ecd 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -140,7 +140,7 @@ struct lstcon_test { struct lstcon_session { struct mutex ses_mutex; /* only 1 thread in session */ - lst_sid_t ses_id; /* global session id */ + struct lst_sid ses_id; /* global session id */ int ses_key; /* local session key */ int ses_state; /* state of session */ int ses_timeout; /* timeout in seconds */ @@ -190,10 +190,10 @@ struct lstcon_session { int lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_hdr *hdr); int lstcon_console_init(void); int lstcon_console_fini(void); -int lstcon_session_match(lst_sid_t sid); +int lstcon_session_match(struct lst_sid sid); int lstcon_session_new(char *name, int key, unsigned int version, - int timeout, int flags, lst_sid_t __user *sid_up); -int lstcon_session_info(lst_sid_t __user *sid_up, int __user *key, + int timeout, int flags, struct lst_sid __user *sid_up); +int lstcon_session_info(struct lst_sid __user *sid_up, int __user *key, unsigned __user *verp, lstcon_ndlist_ent_t __user *entp, char __user *name_up, int len); int lstcon_session_end(void); diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 48dcc330..4100f67 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -39,7 +39,7 @@ #include "selftest.h" -lst_sid_t LST_INVALID_SID = {LNET_NID_ANY, -1}; +struct lst_sid LST_INVALID_SID = {LNET_NID_ANY, -1}; static int session_timeout = 100; module_param(session_timeout, int, 0444); @@ -254,7 +254,7 @@ } static inline void -sfw_init_session(struct sfw_session *sn, lst_sid_t sid, +sfw_init_session(struct sfw_session *sn, struct lst_sid sid, unsigned int features, const char *name) { struct stt_timer *timer = &sn->sn_timer; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index f353a63..3324c3f 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -75,43 +75,43 @@ struct srpc_generic_reqst { struct srpc_generic_reply { __u32 status; - lst_sid_t sid; + struct lst_sid sid; } WIRE_ATTR; /* FRAMEWORK RPCs */ struct srpc_mksn_reqst { __u64 mksn_rpyid; /* reply buffer matchbits */ - lst_sid_t mksn_sid; /* session id */ + struct lst_sid mksn_sid; /* session id */ __u32 mksn_force; /* use brute force */ char mksn_name[LST_NAME_SIZE]; } WIRE_ATTR; /* make session request */ struct srpc_mksn_reply { __u32 mksn_status; /* session status */ - lst_sid_t mksn_sid; /* session id */ + struct lst_sid mksn_sid; /* session id */ __u32 mksn_timeout; /* session timeout */ char mksn_name[LST_NAME_SIZE]; } WIRE_ATTR; /* make session reply */ struct srpc_rmsn_reqst { __u64 rmsn_rpyid; /* reply buffer matchbits */ - lst_sid_t rmsn_sid; /* session id */ + struct lst_sid rmsn_sid; /* session id */ } WIRE_ATTR; /* remove session request */ struct srpc_rmsn_reply { __u32 rmsn_status; - lst_sid_t rmsn_sid; /* session id */ + struct lst_sid rmsn_sid; /* session id */ } WIRE_ATTR; /* remove session reply */ struct srpc_join_reqst { __u64 join_rpyid; /* reply buffer matchbits */ - lst_sid_t join_sid; /* session id to join */ + struct lst_sid join_sid; /* session id to join */ char join_group[LST_NAME_SIZE]; /* group name */ } WIRE_ATTR; struct srpc_join_reply { __u32 join_status; /* returned status */ - lst_sid_t join_sid; /* session id */ + struct lst_sid join_sid; /* session id */ __u32 join_timeout; /* # seconds' inactivity to * expire */ @@ -120,13 +120,13 @@ struct srpc_join_reply { struct srpc_debug_reqst { __u64 dbg_rpyid; /* reply buffer matchbits */ - lst_sid_t dbg_sid; /* session id */ + struct lst_sid dbg_sid; /* session id */ __u32 dbg_flags; /* bitmap of debug */ } WIRE_ATTR; struct srpc_debug_reply { __u32 dbg_status; /* returned code */ - lst_sid_t dbg_sid; /* session id */ + struct lst_sid dbg_sid; /* session id */ __u32 dbg_timeout; /* session timeout */ __u32 dbg_nbatch; /* # of batches in the node */ char dbg_name[LST_NAME_SIZE]; /* session name */ @@ -138,7 +138,7 @@ struct srpc_debug_reply { struct srpc_batch_reqst { __u64 bar_rpyid; /* reply buffer matchbits */ - lst_sid_t bar_sid; /* session id */ + struct lst_sid bar_sid; /* session id */ lst_bid_t bar_bid; /* batch id */ __u32 bar_opc; /* create/start/stop batch */ __u32 bar_testidx; /* index of test */ @@ -147,20 +147,20 @@ struct srpc_batch_reqst { struct srpc_batch_reply { __u32 bar_status; /* status of request */ - lst_sid_t bar_sid; /* session id */ + struct lst_sid bar_sid; /* session id */ __u32 bar_active; /* # of active tests in batch/test */ __u32 bar_time; /* remained time */ } WIRE_ATTR; struct srpc_stat_reqst { __u64 str_rpyid; /* reply buffer matchbits */ - lst_sid_t str_sid; /* session id */ + struct lst_sid str_sid; /* session id */ __u32 str_type; /* type of stat */ } WIRE_ATTR; struct srpc_stat_reply { __u32 str_status; - lst_sid_t str_sid; + struct lst_sid str_sid; sfw_counters_t str_fw; srpc_counters_t str_rpc; lnet_counters_t str_lnet; @@ -187,7 +187,7 @@ struct test_ping_req { struct srpc_test_reqst { __u64 tsr_rpyid; /* reply buffer matchbits */ __u64 tsr_bulkid; /* bulk buffer matchbits */ - lst_sid_t tsr_sid; /* session id */ + struct lst_sid tsr_sid; /* session id */ lst_bid_t tsr_bid; /* batch id */ __u32 tsr_service; /* test type: bulk|ping|... */ __u32 tsr_loop; /* test client loop count or @@ -207,7 +207,7 @@ struct srpc_test_reqst { struct srpc_test_reply { __u32 tsr_status; /* returned code */ - lst_sid_t tsr_sid; + struct lst_sid tsr_sid; } WIRE_ATTR; /* TEST RPCs */ diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index c8833a0..35f98ae 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -322,7 +322,7 @@ struct srpc_service { struct sfw_session { struct list_head sn_list; /* chain on fw_zombie_sessions */ - lst_sid_t sn_id; /* unique identifier */ + struct lst_sid sn_id; /* unique identifier */ unsigned int sn_timeout; /* # seconds' inactivity to expire */ int sn_timer_active; unsigned int sn_features; -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:28 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:28 -0500 Subject: [lustre-devel] [PATCH 25/34] staging: lustre: lnet: change lstio_batch_list_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-26-git-send-email-jsimmons@infradead.org> Change lstio_batch_list_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index a65309c..5e594f6 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -399,12 +399,12 @@ struct lstio_batch_query_args { result buffer */ }; -typedef struct { +struct lstio_batch_list_args { int lstio_bat_key; /* IN: session key */ int lstio_bat_idx; /* IN: index */ int lstio_bat_nmlen; /* IN: name length */ char __user *lstio_bat_namep; /* IN: batch name */ -} lstio_batch_list_args_t; +}; typedef struct { int lstio_bat_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 353008e..fd5eb7b 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -581,7 +581,7 @@ } static int -lst_batch_list_ioctl(lstio_batch_list_args_t *args) +lst_batch_list_ioctl(struct lstio_batch_list_args *args) { if (args->lstio_bat_key != console_session.ses_key) return -EACCES; @@ -897,7 +897,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_batch_query_ioctl((struct lstio_batch_query_args *)buf); break; case LSTIO_BATCH_LIST: - rc = lst_batch_list_ioctl((lstio_batch_list_args_t *)buf); + rc = lst_batch_list_ioctl((struct lstio_batch_list_args *)buf); break; case LSTIO_BATCH_INFO: rc = lst_batch_info_ioctl((lstio_batch_info_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:30 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:30 -0500 Subject: [lustre-devel] [PATCH 27/34] staging: lustre: lnet: change lstio_stat_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-28-git-send-email-jsimmons@infradead.org> Change lstio_stat_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 3427512..27b2bde 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -421,7 +421,7 @@ struct lstio_batch_info_args { }; /* add stat in session */ -typedef struct { +struct lstio_stat_args { int lstio_sta_key; /* IN: session key */ int lstio_sta_timeout; /* IN: timeout for stat request */ @@ -432,7 +432,7 @@ struct lstio_batch_info_args { lnet_process_id_t __user *lstio_sta_idsp; /* IN: pid */ struct list_head __user *lstio_sta_resultp; /* OUT: list head of result buffer */ -} lstio_stat_args_t; +}; typedef enum { LST_TEST_BULK = 1, diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index b76b62e..9039f9f 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -662,7 +662,7 @@ } static int -lst_stat_query_ioctl(lstio_stat_args_t *args) +lst_stat_query_ioctl(struct lstio_stat_args *args) { int rc; char *name = NULL; @@ -906,7 +906,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_test_add_ioctl((lstio_test_args_t *)buf); break; case LSTIO_STAT_QUERY: - rc = lst_stat_query_ioctl((lstio_stat_args_t *)buf); + rc = lst_stat_query_ioctl((struct lstio_stat_args *)buf); break; default: rc = -EINVAL; -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:12 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:12 -0500 Subject: [lustre-devel] [PATCH 09/34] staging: lustre: lnet: change lstcon_trans_stat_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-10-git-send-email-jsimmons@infradead.org> Change lstcon_trans_stat_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 34 +++++++++++----------- drivers/staging/lustre/lnet/selftest/conctl.c | 4 +-- drivers/staging/lustre/lnet/selftest/conrpc.c | 8 ++--- drivers/staging/lustre/lnet/selftest/conrpc.h | 2 +- drivers/staging/lustre/lnet/selftest/console.h | 4 +-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index f5c68c1..48dc06f 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -137,7 +137,7 @@ struct lstcon_rpc_ent { char rpe_payload[0]; /* private reply payload */ }; -typedef struct { +struct lstcon_trans_stat { int trs_rpc_stat[4]; /* RPCs stat (0: total 1: failed 2: finished @@ -146,94 +146,94 @@ struct lstcon_rpc_ent { int trs_fwk_stat[8]; /* framework stat */ int trs_fwk_errno; /* errno of the first remote error */ void *trs_fwk_private; /* private framework stat */ -} lstcon_trans_stat_t; +}; static inline int -lstcon_rpc_stat_total(lstcon_trans_stat_t *stat, int inc) +lstcon_rpc_stat_total(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_rpc_stat[0] : stat->trs_rpc_stat[0]; } static inline int -lstcon_rpc_stat_success(lstcon_trans_stat_t *stat, int inc) +lstcon_rpc_stat_success(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_rpc_stat[1] : stat->trs_rpc_stat[1]; } static inline int -lstcon_rpc_stat_failure(lstcon_trans_stat_t *stat, int inc) +lstcon_rpc_stat_failure(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_rpc_stat[2] : stat->trs_rpc_stat[2]; } static inline int -lstcon_sesop_stat_success(lstcon_trans_stat_t *stat, int inc) +lstcon_sesop_stat_success(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0]; } static inline int -lstcon_sesop_stat_failure(lstcon_trans_stat_t *stat, int inc) +lstcon_sesop_stat_failure(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1]; } static inline int -lstcon_sesqry_stat_active(lstcon_trans_stat_t *stat, int inc) +lstcon_sesqry_stat_active(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0]; } static inline int -lstcon_sesqry_stat_busy(lstcon_trans_stat_t *stat, int inc) +lstcon_sesqry_stat_busy(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1]; } static inline int -lstcon_sesqry_stat_unknown(lstcon_trans_stat_t *stat, int inc) +lstcon_sesqry_stat_unknown(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2]; } static inline int -lstcon_tsbop_stat_success(lstcon_trans_stat_t *stat, int inc) +lstcon_tsbop_stat_success(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0]; } static inline int -lstcon_tsbop_stat_failure(lstcon_trans_stat_t *stat, int inc) +lstcon_tsbop_stat_failure(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1]; } static inline int -lstcon_tsbqry_stat_idle(lstcon_trans_stat_t *stat, int inc) +lstcon_tsbqry_stat_idle(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0]; } static inline int -lstcon_tsbqry_stat_run(lstcon_trans_stat_t *stat, int inc) +lstcon_tsbqry_stat_run(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1]; } static inline int -lstcon_tsbqry_stat_failure(lstcon_trans_stat_t *stat, int inc) +lstcon_tsbqry_stat_failure(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[2] : stat->trs_fwk_stat[2]; } static inline int -lstcon_statqry_stat_success(lstcon_trans_stat_t *stat, int inc) +lstcon_statqry_stat_success(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[0] : stat->trs_fwk_stat[0]; } static inline int -lstcon_statqry_stat_failure(lstcon_trans_stat_t *stat, int inc) +lstcon_statqry_stat_failure(struct lstcon_trans_stat *stat, int inc) { return inc ? ++stat->trs_fwk_stat[1] : stat->trs_fwk_stat[1]; } diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 9438302..a897738 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -851,7 +851,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) goto out; } - memset(&console_session.ses_trans_stat, 0, sizeof(lstcon_trans_stat_t)); + memset(&console_session.ses_trans_stat, 0, sizeof(struct lstcon_trans_stat)); switch (opc) { case LSTIO_SESSION_NEW: @@ -913,7 +913,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) } if (copy_to_user(data->ioc_pbuf2, &console_session.ses_trans_stat, - sizeof(lstcon_trans_stat_t))) + sizeof(struct lstcon_trans_stat))) rc = -EFAULT; out: mutex_unlock(&console_session.ses_mutex); diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index bc924f9..3b97915 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -43,7 +43,7 @@ #include "console.h" void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, - struct lstcon_node *, lstcon_trans_stat_t *); + struct lstcon_node *, struct lstcon_trans_stat *); static void lstcon_rpc_done(struct srpc_client_rpc *rpc) @@ -420,7 +420,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, } void -lstcon_rpc_trans_stat(struct lstcon_rpc_trans *trans, lstcon_trans_stat_t *stat) +lstcon_rpc_trans_stat(struct lstcon_rpc_trans *trans, struct lstcon_trans_stat *stat) { struct lstcon_rpc *crpc; struct srpc_msg *rep; @@ -964,7 +964,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, struct srpc_msg *msg, - struct lstcon_node *nd, lstcon_trans_stat_t *stat) + struct lstcon_node *nd, struct lstcon_trans_stat *stat) { struct srpc_rmsn_reply *rmsn_rep; struct srpc_debug_reply *dbg_rep; @@ -1320,7 +1320,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, lstcon_rpc_trans_stat(console_session.ses_ping, lstcon_trans_stat()); lstcon_rpc_trans_destroy(console_session.ses_ping); - memset(lstcon_trans_stat(), 0, sizeof(lstcon_trans_stat_t)); + memset(lstcon_trans_stat(), 0, sizeof(struct lstcon_trans_stat)); console_session.ses_ping = NULL; } diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h b/drivers/staging/lustre/lnet/selftest/conrpc.h index ad0a49e..7141d2c 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.h +++ b/drivers/staging/lustre/lnet/selftest/conrpc.h @@ -125,7 +125,7 @@ int lstcon_rpc_trans_ndlist(struct list_head *ndlist, void *arg, lstcon_rpc_cond_func_t condition, struct lstcon_rpc_trans **transpp); void lstcon_rpc_trans_stat(struct lstcon_rpc_trans *trans, - lstcon_trans_stat_t *stat); + struct lstcon_trans_stat *stat); int lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, struct list_head __user *head_up, lstcon_rpc_readent_func_t readent); diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index f8d61ce..05b4b70 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -158,7 +158,7 @@ struct lstcon_session { char ses_name[LST_NAME_SIZE];/* session name */ struct lstcon_rpc_trans *ses_ping; /* session pinger */ struct stt_timer ses_ping_timer; /* timer for pinger */ - lstcon_trans_stat_t ses_trans_stat; /* transaction stats */ + struct lstcon_trans_stat ses_trans_stat; /* transaction stats */ struct list_head ses_trans_list; /* global list of transaction */ struct list_head ses_grp_list; /* global list of groups */ @@ -173,7 +173,7 @@ struct lstcon_session { extern struct lstcon_session console_session; -static inline lstcon_trans_stat_t * +static inline struct lstcon_trans_stat * lstcon_trans_stat(void) { return &console_session.ses_trans_stat; -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:33 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:33 -0500 Subject: [lustre-devel] [PATCH 30/34] staging: lustre: lnet: change lst_brw_[type|flags]_t to proper enum In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-31-git-send-email-jsimmons@infradead.org> Change lst_brw_[type|flags]_t from typedef to proper enum. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index fdab4b6..0279e09 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -474,16 +474,16 @@ struct lstio_test_args { result buffer */ }; -typedef enum { +enum lst_brw_type { LST_BRW_READ = 1, LST_BRW_WRITE = 2 -} lst_brw_type_t; +}; -typedef enum { +enum lst_brw_flags { LST_BRW_CHECK_NONE = 1, LST_BRW_CHECK_SIMPLE = 2, LST_BRW_CHECK_FULL = 3 -} lst_brw_flags_t; +}; typedef struct { int blk_opc; /* bulk operation code */ -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:37 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:37 -0500 Subject: [lustre-devel] [PATCH 34/34] staging: lustre: lnet: change sfw_counter_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-35-git-send-email-jsimmons@infradead.org> Change sfw_counter_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/console.c | 4 ++-- drivers/staging/lustre/lnet/selftest/framework.c | 2 +- drivers/staging/lustre/lnet/selftest/rpc.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 575d23a..c81c246 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -511,13 +511,13 @@ struct srpc_counters { __u64 bulk_put; } WIRE_ATTR; -typedef struct { +struct sfw_counters { /** milliseconds since current session started */ __u32 running_ms; __u32 active_batches; __u32 zombie_sessions; __u32 brw_errors; __u32 ping_errors; -} WIRE_ATTR sfw_counters_t; +} WIRE_ATTR; #endif diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 483a1bb..4e7e5c8 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1467,14 +1467,14 @@ static void lstcon_group_ndlink_release(struct lstcon_group *, struct lstcon_rpc_ent __user *ent_up) { struct srpc_stat_reply *rep = &msg->msg_body.stat_reply; - sfw_counters_t __user *sfwk_stat; + struct sfw_counters __user *sfwk_stat; struct srpc_counters __user *srpc_stat; lnet_counters_t __user *lnet_stat; if (rep->str_status) return 0; - sfwk_stat = (sfw_counters_t __user *)&ent_up->rpe_payload[0]; + sfwk_stat = (struct sfw_counters __user *)&ent_up->rpe_payload[0]; srpc_stat = (struct srpc_counters __user *)(sfwk_stat + 1); lnet_stat = (lnet_counters_t __user *)(srpc_stat + 1); diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 5ca6712..436aef3 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -361,7 +361,7 @@ sfw_get_stats(struct srpc_stat_reqst *request, struct srpc_stat_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; - sfw_counters_t *cnt = &reply->str_fw; + struct sfw_counters *cnt = &reply->str_fw; struct sfw_batch *bat; reply->str_sid = !sn ? LST_INVALID_SID : sn->sn_id; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index a5b44db..418c9c9 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -161,7 +161,7 @@ struct srpc_stat_reqst { struct srpc_stat_reply { __u32 str_status; struct lst_sid str_sid; - sfw_counters_t str_fw; + struct sfw_counters str_fw; struct srpc_counters str_rpc; lnet_counters_t str_lnet; } WIRE_ATTR; -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:17 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:17 -0500 Subject: [lustre-devel] [PATCH 14/34] staging: lustre: lnet: change lstio_group_add_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-15-git-send-email-jsimmons@infradead.org> Change lstio_group_add_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 03ebdc3..7194552 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -293,11 +293,11 @@ struct lstio_debug_args { result buffer */ }; -typedef struct { +struct lstio_group_add_args { int lstio_grp_key; /* IN: session key */ int lstio_grp_nmlen; /* IN: name length */ char __user *lstio_grp_namep; /* IN: group name */ -} lstio_group_add_args_t; +}; typedef struct { int lstio_grp_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index e143e52..c3435b4 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -190,7 +190,7 @@ } static int -lst_group_add_ioctl(lstio_group_add_args_t *args) +lst_group_add_ioctl(struct lstio_group_add_args *args) { char *name; int rc; @@ -867,7 +867,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_debug_ioctl((struct lstio_debug_args *)buf); break; case LSTIO_GROUP_ADD: - rc = lst_group_add_ioctl((lstio_group_add_args_t *)buf); + rc = lst_group_add_ioctl((struct lstio_group_add_args *)buf); break; case LSTIO_GROUP_DEL: rc = lst_group_del_ioctl((lstio_group_del_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:26 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:26 -0500 Subject: [lustre-devel] [PATCH 23/34] staging: lustre: lnet: change lstio_batch_stop_args_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-24-git-send-email-jsimmons@infradead.org> Change lstio_batch_stop_args_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index 2c80c34..9e90be1 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -376,7 +376,7 @@ struct lstio_batch_run_args { result buffer */ }; -typedef struct { +struct lstio_batch_stop_args { int lstio_bat_key; /* IN: session key */ int lstio_bat_force; /* IN: abort unfinished test RPC */ @@ -384,7 +384,7 @@ struct lstio_batch_run_args { char __user *lstio_bat_namep; /* IN: batch name */ struct list_head __user *lstio_bat_resultp; /* OUT: list head of result buffer */ -} lstio_batch_stop_args_t; +}; typedef struct { int lstio_bat_key; /* IN: session key */ diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 6631824..78dbfa2 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -505,7 +505,7 @@ } static int -lst_batch_stop_ioctl(lstio_batch_stop_args_t *args) +lst_batch_stop_ioctl(struct lstio_batch_stop_args *args) { int rc; char *name; @@ -891,7 +891,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) rc = lst_batch_run_ioctl((struct lstio_batch_run_args *)buf); break; case LSTIO_BATCH_STOP: - rc = lst_batch_stop_ioctl((lstio_batch_stop_args_t *)buf); + rc = lst_batch_stop_ioctl((struct lstio_batch_stop_args *)buf); break; case LSTIO_BATCH_QUERY: rc = lst_batch_query_ioctl((lstio_batch_query_args_t *)buf); -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 16 21:30:08 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 16 Jan 2017 16:30:08 -0500 Subject: [lustre-devel] [PATCH 05/34] staging: lustre: lnet: change lstcon_test_ent_t to proper structure In-Reply-To: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> References: <1484602237-30867-1-git-send-email-jsimmons@infradead.org> Message-ID: <1484602237-30867-6-git-send-email-jsimmons@infradead.org> Change lstcon_test_ent_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24188 Reviewed-by: Andreas Dilger Reviewed-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lnetst.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h b/drivers/staging/lustre/include/linux/lnet/lnetst.h index ec243d7..f197eb3 100644 --- a/drivers/staging/lustre/include/linux/lnet/lnetst.h +++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h @@ -98,11 +98,11 @@ struct lstcon_ndlist_ent { int nle_nunknown; /* # of unknown nodes */ }; /*** node_list entry, for list_batch command */ -typedef struct { +struct lstcon_test_ent { int tse_type; /* test type */ int tse_loop; /* loop count */ int tse_concur; /* concurrency of test */ -} lstcon_test_ent_t; /*** test summary entry, for +}; /*** test summary entry, for *** list_batch command */ typedef struct { @@ -118,7 +118,7 @@ struct lstcon_ndlist_ent { struct lstcon_ndlist_ent tbe_srv_nle; /* server (group) node_list * entry */ union { - lstcon_test_ent_t tbe_test; /* test entry */ + struct lstcon_test_ent tbe_test; /* test entry */ lstcon_batch_ent_t tbe_batch; /* batch entry */ } u; } lstcon_test_batch_ent_t; /*** test/batch verbose information entry, -- 1.8.3.1 From gregkh at linuxfoundation.org Tue Jan 17 07:41:40 2017 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Tue, 17 Jan 2017 08:41:40 +0100 Subject: [lustre-devel] [PATCH] staging: lustre: headers: potential UAPI headers In-Reply-To: References: <1482167207-22800-1-git-send-email-jsimmons@infradead.org> <20170103141248.GA8695@kroah.com> Message-ID: <20170117074140.GA19328@kroah.com> On Mon, Jan 16, 2017 at 09:28:30PM +0000, James Simmons wrote: > > > On Mon, Dec 19, 2016 at 12:06:47PM -0500, James Simmons wrote: > > > Not for landing. This is the purposed UAPI headers > > > with the removal of unlikely and debugging macros. > > > This is just for feedback to see if this is acceptable > > > for the upstream client. > > > > > > Signed-off-by: James Simmons > > > --- > > > .../lustre/lustre/include/lustre/lustre_fid.h | 353 +++++++++++++++++++++ > > > .../lustre/lustre/include/lustre/lustre_ostid.h | 233 ++++++++++++++ > > > > Can you make a lustre "uapi" directory so we can see which files you > > really want to be UAPI and which you don't as time goes on? > > Where do you want them placed? In uapi/linux/lustre or uapi/lustre. Does > it matter to you? The below was to forth coming UAPI headers which from > your response you seem okay with in general. How many .h files are there going to be? It's just a single filesystem, shouldn't you just need a single file? If so, how about drivers/staging/lustre/include/uapi/lustre.h ? If you really need multiple .h files, put them all in the same uapi/ directory with a lustre_ prefix, you don't need a whole subdir just for yourself, right? thanks, greg k-h From jinshan.xiong at intel.com Tue Jan 17 19:51:11 2017 From: jinshan.xiong at intel.com (Xiong, Jinshan) Date: Tue, 17 Jan 2017 19:51:11 +0000 Subject: [lustre-devel] Design proposal for client-side compression In-Reply-To: <1484223328.3937.60.camel@informatik.uni-hamburg.de> References: <1483967258.2622.24.camel@informatik.uni-hamburg.de> <1484223328.3937.60.camel@informatik.uni-hamburg.de> Message-ID: Hi Anna, Please see inserted lines. On Jan 12, 2017, at 4:15 AM, Anna Fuchs > wrote: Hello all, thank you for the responses. Jinshan, I assume the purpose of this proposal is to fully utilize the CPU cycles on the client nodes to compress and decompress data, because there are much more client nodes than server nodes. After data is compressed, it will need less network bandwidth to transfer it to server and write them back to storage. Yes, that is our goal for the moment. cool. This should be a good approach. There would be more changes to implement this feature: 1. I guess dmu_read() needs change as well to transfer compressed data back to client, otherwise how it would improve readahead performance. Please let me know if I overlooked something; Sure, I might have shortened my explanation too much. The read path will be affected for providing compressed data and record-wise "metadata" back to the client. The client will then decompress it. 2. read-modify-write on client chunks - if only partial chunk is modified on the client side, the OSC will have to read the chunk back, uncompress it, and modify the data in chunk, and compress it again to get ready for write back. We may have to maintain a separate chunk cache on the OSC layer; We keep the rmw problem in mind and will definitely need to work on optimization once the basic functionality is done. When compressing only sub-stripes (record size), we already hope to reduce the performance loss since we do not need to transfer and decompress the whole stripe anymore. We would want to keep the compressed data within bd_enc_vec and uncompressed in the normal vector. The space for that vector is allocated in sptlrpc_enc_pool_get_pages. Are those not cached? Could you give me some hints for the approach and what to look at? Is it a right place at all? I don’t think sptlrpc page pool will cache any data. However, it’s the right place to do compress in the sptlrpc layer, you just extend the sptlrpc for a new flavor. With that being said, we’re going to have two options to support partial block write: 1. In the OSC I/O engine, it only submits ZFS block size aligned plain data to ptlrpc layer and it does compress in the new flavor of sptlrpc. When partial blocks are written, the OSC will have to issue read RPC if the corresponding data belonging to the same block are not cached; 2. Or we can just disable this optimization that means plain data will be issued to the sever for partial block written. It only do compress for full blocks. I feel the option 2 would be much simpler but needs some requirements to the workload to take full advantage, e.g. if applications are writing bulk and sequential data. Though, the naive prototype I am currently working on is very memory intensive anyway (additional buffers, many copies). There is much work for me until I can dive into optimizations... 3. the OST should grant LDLM lock to align with ZFS block size otherwise it will be very complex if the OSC has to request locks to do RMW; I am not very familiar with the locking in Lustre yet. You mean, once we want to modify part of the data on OST, we want to have a lock for the complete chunk (record), right? Currently, Lustre can do byte-range locks, instead we wanted record-ranged in this case? Right now Lustre aligns BRW lock by the page size on the client side. Please check the code and comments in function ldlm_extent_internal_policy_fixup(). Since client doesn’t provide the page size to server explicitly, the code just guess it by the req_end. In the new code with this feature supported, the LDLM lock should be aligned to MAX(zfs_block_size, req_align). 4. OSD-ZFS can dynamically extend the block size by the write pattern, so we need to disable it to accommodate this feature; We thought to set the sizes from Lustre (client or later server) and force ZFS to use them. ZFS itself will not be able to change any layouts. Sounds good to me. There is a work in progress to support setting block size from client side in LU-8591. Matt, a possible feature is to enable ZFS to decompress the data I would recommend that you plan to integrate this compression with ZFS from the beginning, by using compression formats that ZFS already supports (e.g. lz4), or by adding support in ZFS for the algorithm you will use for Lustre. This will provide better flexibility and compatibility. We currently experiment with lz4 fast, which our students try to submit to the linux kernel. The ZFS patch for that will hopefully follow soon. We thought it would be nice to have the opportunity to use some brand new algorithms on the client within Lustre even if they are not yet supported by ZFS. Though it is great that the ZFS community is open to integrate new features so we probably could completely match our needs. That’ll be cool. I think ZFS community should be open to accept new algorithm. Please make a patch and submit it to https://github.com/zfsonlinux/zfs/issues Also, I agree with what Jinshan said below. Assuming that you want to do compressed read as well, you will need to add a compressed read function to the DMU. For compressed send/receive we only added compressed write to the DMU, because zfs send reads directly from the ARC (which can do compressed read). We are working on it right now, the functionality should be similar to the write case or do I miss some fundamental issues? It should be similar to write case, i.e., to bypass the layer of dmu buffer. Jinshan Best regards, Anna _______________________________________________ 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 morrone2 at llnl.gov Tue Jan 17 21:32:23 2017 From: morrone2 at llnl.gov (Christopher J. Morrone) Date: Tue, 17 Jan 2017 13:32:23 -0800 Subject: [lustre-devel] (no subject) In-Reply-To: References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> Message-ID: On 01/16/2017 01:02 PM, James Simmons wrote: > >> Sounds good to me. Ideally, lnetctl should be able to do everything >> that lctl could do (plus all of the new features). Has it reached >> parity? If not, what else still remains to be done? > > No lctl pings and the peer and connection handling is missing. I did > some work to support the missing features in lnetctl and combined with > multi-rail should fill in the gaps. Also we are missing lnetctl ping > but I think multi-rail might fix that. Not 100% sure tho. Thanks, James. That is the information that I was looking for. Chris From anna.fuchs at informatik.uni-hamburg.de Wed Jan 18 14:19:45 2017 From: anna.fuchs at informatik.uni-hamburg.de (Anna Fuchs) Date: Wed, 18 Jan 2017 15:19:45 +0100 Subject: [lustre-devel] Design proposal for client-side compression In-Reply-To: References: <1483967258.2622.24.camel@informatik.uni-hamburg.de> <1484223328.3937.60.camel@informatik.uni-hamburg.de> Message-ID: <1484749185.3965.114.camel@informatik.uni-hamburg.de> Hello,  thanks again.  > I don’t think sptlrpc page pool will cache any data. Ok, I will look at the caching within OSC in more detail. > However, it’s the right place to do compress in the sptlrpc layer, > you just extend the sptlrpc for a new flavor. Well, during my master's thesis, I have already tried to introduce compression in form of a new flavor for GSS. Unfortunately, I had huge problems to get GSS to work at all (later 2.7 or first of 2.8 versions). The plain or null flavors for testing didn't work and any other approach required Kerberos (which I also couldn't make work :( ). Probably I just missed something, but it led me to the idea to make it close to, but yet independent from GSS. As far I understood, currently only the RPC but not the data is handled by GSS on the client side?  And from what I have seen, when using GSS, the number of niobufs within the RPC is restricted to 1; for compression we would need more. Also, the flavor is set per RPC, we need it per niobuf. Though it might be just implementation details, wouldn't you currently prefer to keep it separate to avoid mixing up bugs from our new feature and changes to GSS? Currently I try my change within sptlrpc_cli_wrap_bulk in sec.c just before wrapping the bulks with GSS mechanisms.  > > With that being said, we’re going to have two options to support > partial block write: > > 1. In the OSC I/O engine, it only submits ZFS block size aligned > plain data to ptlrpc layer and it does compress in the new flavor of > sptlrpc. When partial blocks are written, the OSC will have to issue > read RPC if the corresponding data belonging to the same block are > not cached; > > 2. Or we can just disable this optimization that means plain data > will be issued to the sever for partial block written. It only do > compress for full blocks. > > I feel the option 2 would be much simpler but needs some requirements > to the workload to take full advantage, e.g. if applications are > writing bulk and sequential data. Sounds good. In my thesis I have already spent some thoughts to the RMW issues. In some cases it might be the best to let the server decompress the specific data chunks (which is planned in the future anyway) and skip compression for partial writes.  > > Right now Lustre aligns BRW lock by the page size on the client side. > Please check the code and comments in function > ldlm_extent_internal_policy_fixup(). Since client doesn’t provide the > page size to server explicitly, the code just guess it by the > req_end. > > In the new code with this feature supported, the LDLM lock should be > aligned to MAX(zfs_block_size, req_align). > > Sounds good to me. There is a work in progress to support setting > block size from client side in LU-8591. Thanks for the hints! > > >   > > > Also, I agree with what Jinshan said below.  Assuming that you > > > want > > > to do compressed read as well, you will need to add a compressed > > > read > > > function to the DMU.  For compressed send/receive we only added > > > compressed write to the DMU, because zfs send reads directly from > > > the > > > ARC (which can do compressed read). > >   > > We are working on it right now, the functionality should be similar > > to > > the write case or do I miss some fundamental issues?  > > It should be similar to write case, i.e., to bypass the layer of dmu > buffer. Our first approach for read is currently the following:  Once compression is enabled, for OSTs we call the modified dmu_read with the logical (uncompressed) data size. ZFS notices, the requested data is compressed and delivers the physical (compressed) data size, the used algorithm and the actual data of size psize. Lustre gets the psize somehow together with the data. Psize would be used to ensure that the "received" amount of data, which differs from requested logical size, is correct.  Bypass the dbufs - you mean to transfer the data directly from ARC to the client? > Jinshan Be > > > st regards, Anna From bevans at cray.com Wed Jan 18 20:08:31 2017 From: bevans at cray.com (Ben Evans) Date: Wed, 18 Jan 2017 20:08:31 +0000 Subject: [lustre-devel] Proposal for JobID caching Message-ID: Overview The Lustre filesystem added the ability to track I/O performance of a job across a cluster. The initial algorithm was relatively simplistic: for every I/O, look up the job ID of the process and include it in the RPC being sent to the server. This imposed a non-trivial performance impact on client I/O performance. An additional algorithm was introduced to handle the single job per node case, where instead of looking up the job ID of the process, Lustre simply accesses the value of a variable set through the proc interface. This improved performance greatly, but only functions when a single job is being run. A new approach is needed for multiple job per node systems. Proposed Solution The proposed solution to this is to create a small PID->JobID table in kernel memory. When a process performs an IO, a lookup is done in the table for the PID, if a JobID exists for that PID, it is used, otherwise it is retrieved via the same methods as the original Jobstats algorithm. Once located the JobID is stored in a PID/JobID table in memory. The existing cfs_hash_table structure and functions will be used to implement the table. Rationale This reduces the number of calls into userspace, minimizing the time taken on each I/O. It also easily supports multiple job per node scenarios, and like other proposed solutions has no issue with multiple jobs performing I/O on the same file at the same time. Requirements · Performance cannot significantly detract from baseline performance without jobstats · Supports multiple jobs per node · Coordination with the scheduler is not required, but interfaces may be provided · Supports multiple PIDs per job New Data Structures pid_to_jobid { struct hlist_node pj_hash; u54 pj_pid; char pj_jobid[LUSTRE_JOBID_SIZE]; spinlock_t jp_lock; time_t jp_time; } Proc Variables Writing to /proc/fs/lustre/jobid_name while not in "nodelocal" mode will cause all entries in the cache for that jobID to be removed from the cache Populating the Cache When lustre_get_jobid is called, the process, and in the cached mode, first a check will be done in the cache for a valid PID to JobID mapping. If none exists, it uses the same mechanisms to get the JobID and populates the appropriate PID to JobID map. If a lookup is performed and the PID to JobID mapping exists, but is more than 30 seconds old, the JobID is refreshed. Purging the Cache The cache can be purged of a specific job by writing the JobID to the jobid_name proc file. Any items in the cache that are more than 300 seconds out of date will also be purged at this time. -------------- next part -------------- An HTML attachment was scrubbed... URL: From amir.shehata.whamcloud at gmail.com Wed Jan 18 20:10:42 2017 From: amir.shehata.whamcloud at gmail.com (Amir Shehata) Date: Wed, 18 Jan 2017 12:10:42 -0800 Subject: [lustre-devel] (no subject) In-Reply-To: References: <974262C966B9F640899A48EB96313E9A318459F8@PRDEXMBX-08.the-lab.llnl.gov> <67f5b76c-cadb-747b-cb90-b2b40ca30c65@llnl.gov> Message-ID: We have a patch for lnetctl ping coming in soon. On 16 January 2017 at 13:02, James Simmons wrote: > > > Sounds good to me. Ideally, lnetctl should be able to do everything > > that lctl could do (plus all of the new features). Has it reached > > parity? If not, what else still remains to be done? > > No lctl pings and the peer and connection handling is missing. I did > some work to support the missing features in lnetctl and combined with > multi-rail should fill in the gaps. Also we are missing lnetctl ping > but I think multi-rail might fix that. Not 100% sure tho. > > > > > Chris > > > > On 01/10/2017 12:15 PM, Amir Shehata wrote: > > > lctl usage is kept for backwards compatibility. Eventually, we should > be > > > moving to using lnetctl exclusively. Which lustre-release we should do > > > that in, is the question. 2.10? > > > > > > thanks > > > amir > > > > > > On 4 January 2017 at 16:16, Di Natale, Giuseppe > > > wrote: > > > > > > Greetings, > > > > > > I am attempting to port the SysV lnet script as part of a > transition > > > to systemd. I ran into the following in lustre/scripts/lnet: > > > > > > if [ -x $LUSTRE_LNET_CONFIG_UTILITY -a -f > > > "$LUSTRE_LNET_CONFIG_FILE" ]; then > > > $LUSTRE_LNET_CONFIG_UTILITY lnet configure || exit > 1 > > > else > > > lctl network up || exit 1 > > > fi > > > > > > Can the check for LUSTRE_LNET_CONFIG_UTILITY (/usr/sbin/lnetctl by > > > default) be removed so that way lnetctl is used exclusively? > > > > > > Thanks, > > > Giuseppe Di Natale > > > > > > _______________________________________________ > > > lustre-devel mailing list > > > lustre-devel at lists.lustre.org 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.drokin at intel.com Wed Jan 18 20:39:36 2017 From: oleg.drokin at intel.com (Oleg Drokin) Date: Wed, 18 Jan 2017 15:39:36 -0500 Subject: [lustre-devel] Proposal for JobID caching In-Reply-To: References: Message-ID: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> On Jan 18, 2017, at 3:08 PM, Ben Evans wrote: > Overview > The Lustre filesystem added the ability to track I/O performance of a job across a cluster. The initial algorithm was relatively simplistic: for every I/O, look up the job ID of the process and include it in the RPC being sent to the server. This imposed a non-trivial performance impact on client I/O performance. > An additional algorithm was introduced to handle the single job per node case, where instead of looking up the job ID of the process, Lustre simply accesses the value of a variable set through the proc interface. This improved performance greatly, but only functions when a single job is being run. > A new approach is needed for multiple job per node systems. > > Proposed Solution > The proposed solution to this is to create a small PID->JobID table in kernel memory. When a process performs an IO, a lookup is done in the table for the PID, if a JobID exists for that PID, it is used, otherwise it is retrieved via the same methods as the original Jobstats algorithm. Once located the JobID is stored in a PID/JobID table in memory. The existing cfs_hash_table structure and functions will be used to implement the table. > > Rationale > This reduces the number of calls into userspace, minimizing the time taken on each I/O. It also easily supports multiple job per node scenarios, and like other proposed solutions has no issue with multiple jobs performing I/O on the same file at the same time. > > Requirements > · Performance cannot significantly detract from baseline performance without jobstats > · Supports multiple jobs per node > · Coordination with the scheduler is not required, but interfaces may be provided > · Supports multiple PIDs per job > > New Data Structures > pid_to_jobid { > struct hlist_node pj_hash; > u54 pj_pid; > char pj_jobid[LUSTRE_JOBID_SIZE]; > spinlock_t jp_lock; > time_t jp_time; > } > Proc Variables > Writing to /proc/fs/lustre/jobid_name while not in “nodelocal” mode will cause all entries in the cache for that jobID to be removed from the cache > > Populating the Cache > When lustre_get_jobid is called, the process, and in the cached mode, first a check will be done in the cache for a valid PID to JobID mapping. If none exists, it uses the same mechanisms to get the JobID and populates the appropriate PID to JobID map. > If a lookup is performed and the PID to JobID mapping exists, but is more than 30 seconds old, the JobID is refreshed. > Purging the Cache > The cache can be purged of a specific job by writing the JobID to the jobid_name proc file. Any items in the cache that are more than 300 seconds out of date will also be purged at this time. I'd much rather prefer you go to the table that's populated outside of the kernel somehow. Let's be realistic, poking around in userspace process environments for random strings is not such a great idea at all even though it did look like a good idea in the past for simplicity reasons. Similar to nodelocal, we probably just switch to a method where you call a particular lctl command that would mark the whole session as belonging to some job. This might take several forms, e.g. nodelocal itself could be extended to only apply to a current namespace/container But if you do really run different jobs in the global namespace, we probably can probably just make the lctl to spawn a shell with commands that all would be marked as a particular job? Or we can probably trace the parent of lctl and mark that so that all its children become somehow marked too. Bye, Oleg From bevans at cray.com Wed Jan 18 22:35:51 2017 From: bevans at cray.com (Ben Evans) Date: Wed, 18 Jan 2017 22:35:51 +0000 Subject: [lustre-devel] Proposal for JobID caching In-Reply-To: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> References: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> Message-ID: On 1/18/17, 3:39 PM, "Oleg Drokin" wrote: > >On Jan 18, 2017, at 3:08 PM, Ben Evans wrote: > >> Overview >> The Lustre filesystem added the ability to track I/O >>performance of a job across a cluster. The initial algorithm was >>relatively simplistic: for every I/O, look up the job ID of the process >>and include it in the RPC being sent to the server. This imposed a >>non-trivial performance impact on client I/O performance. >> An additional algorithm was introduced to handle the single >>job per node case, where instead of looking up the job ID of the >>process, Lustre simply accesses the value of a variable set through the >>proc interface. This improved performance greatly, but only functions >>when a single job is being run. >> A new approach is needed for multiple job per node systems. >> >> Proposed Solution >> The proposed solution to this is to create a small >>PID->JobID table in kernel memory. When a process performs an IO, a >>lookup is done in the table for the PID, if a JobID exists for that PID, >>it is used, otherwise it is retrieved via the same methods as the >>original Jobstats algorithm. Once located the JobID is stored in a >>PID/JobID table in memory. The existing cfs_hash_table structure and >>functions will be used to implement the table. >> >> Rationale >> This reduces the number of calls into userspace, minimizing >>the time taken on each I/O. It also easily supports multiple job per >>node scenarios, and like other proposed solutions has no issue with >>multiple jobs performing I/O on the same file at the same time. >> >> Requirements >> · Performance cannot significantly detract from baseline >>performance without jobstats >> · Supports multiple jobs per node >> · Coordination with the scheduler is not required, but interfaces >>may be provided >> · Supports multiple PIDs per job >> >> New Data Structures >> pid_to_jobid { >> struct hlist_node pj_hash; >> u54 pj_pid; >> char pj_jobid[LUSTRE_JOBID_SIZE]; >> spinlock_t jp_lock; >> time_t jp_time; >> } >> Proc Variables >> Writing to /proc/fs/lustre/jobid_name while not in ³nodelocal² mode >>will cause all entries in the cache for that jobID to be removed from >>the cache >> >> Populating the Cache >> When lustre_get_jobid is called, the process, and in the >>cached mode, first a check will be done in the cache for a valid PID to >>JobID mapping. If none exists, it uses the same mechanisms to get the >>JobID and populates the appropriate PID to JobID map. >> If a lookup is performed and the PID to JobID mapping exists, but is >>more than 30 seconds old, the JobID is refreshed. >> Purging the Cache >> The cache can be purged of a specific job by writing the >>JobID to the jobid_name proc file. Any items in the cache that are more >>than 300 seconds out of date will also be purged at this time. > > >I'd much rather prefer you go to the table that's populated outside of >the kernel >somehow. >Let's be realistic, poking around in userspace process environments for >random >strings is not such a great idea at all even though it did look like a >good idea >in the past for simplicity reasons. On the upside, there's far less of that going on now, since the results are cached via pid. I'm unaware of a table that exists in userspace that maps PIDs to Jobs. >Similar to nodelocal, we probably just switch to a method where you call a >particular lctl command that would mark the whole session as belonging >to some job. This might take several forms, e.g. nodelocal itself could >be extended to only apply to a current namespace/container That would make sense, but would need to requirement that each job has it's own namespace/container. >But if you do really run different jobs in the global namespace, we >probably can >probably just make the lctl to spawn a shell with commands that all would >be marked as a particular job? Or we can probably trace the parent of >lctl and >mark that so that all its children become somehow marked too. One of the things that came up during this is how do you handle a random user who logs into a compute node and runs something like rsync? The more conditions we place around getting jobstats to function properly, the harder these types of behaviors are to track down. One thing I was thinking was that if jobstats is enabled, that the fallback if no JobID can be found is to simply use the taskname_uid method, so an admin would see rsync.1234 pop up on your monitoring dashboard. -Ben From oleg.drokin at intel.com Wed Jan 18 22:56:27 2017 From: oleg.drokin at intel.com (Oleg Drokin) Date: Wed, 18 Jan 2017 17:56:27 -0500 Subject: [lustre-devel] Proposal for JobID caching In-Reply-To: References: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> Message-ID: <0DF0E294-1740-4669-9389-5CE0ECC15AEE@intel.com> On Jan 18, 2017, at 5:35 PM, Ben Evans wrote: > > > On 1/18/17, 3:39 PM, "Oleg Drokin" wrote: > >> >> On Jan 18, 2017, at 3:08 PM, Ben Evans wrote: >> >>> Overview >>> The Lustre filesystem added the ability to track I/O >>> performance of a job across a cluster. The initial algorithm was >>> relatively simplistic: for every I/O, look up the job ID of the process >>> and include it in the RPC being sent to the server. This imposed a >>> non-trivial performance impact on client I/O performance. >>> An additional algorithm was introduced to handle the single >>> job per node case, where instead of looking up the job ID of the >>> process, Lustre simply accesses the value of a variable set through the >>> proc interface. This improved performance greatly, but only functions >>> when a single job is being run. >>> A new approach is needed for multiple job per node systems. >>> >>> Proposed Solution >>> The proposed solution to this is to create a small >>> PID->JobID table in kernel memory. When a process performs an IO, a >>> lookup is done in the table for the PID, if a JobID exists for that PID, >>> it is used, otherwise it is retrieved via the same methods as the >>> original Jobstats algorithm. Once located the JobID is stored in a >>> PID/JobID table in memory. The existing cfs_hash_table structure and >>> functions will be used to implement the table. >>> >>> Rationale >>> This reduces the number of calls into userspace, minimizing >>> the time taken on each I/O. It also easily supports multiple job per >>> node scenarios, and like other proposed solutions has no issue with >>> multiple jobs performing I/O on the same file at the same time. >>> >>> Requirements >>> · Performance cannot significantly detract from baseline >>> performance without jobstats >>> · Supports multiple jobs per node >>> · Coordination with the scheduler is not required, but interfaces >>> may be provided >>> · Supports multiple PIDs per job >>> >>> New Data Structures >>> pid_to_jobid { >>> struct hlist_node pj_hash; >>> u54 pj_pid; >>> char pj_jobid[LUSTRE_JOBID_SIZE]; >>> spinlock_t jp_lock; >>> time_t jp_time; >>> } >>> Proc Variables >>> Writing to /proc/fs/lustre/jobid_name while not in ³nodelocal² mode >>> will cause all entries in the cache for that jobID to be removed from >>> the cache >>> >>> Populating the Cache >>> When lustre_get_jobid is called, the process, and in the >>> cached mode, first a check will be done in the cache for a valid PID to >>> JobID mapping. If none exists, it uses the same mechanisms to get the >>> JobID and populates the appropriate PID to JobID map. >>> If a lookup is performed and the PID to JobID mapping exists, but is >>> more than 30 seconds old, the JobID is refreshed. >>> Purging the Cache >>> The cache can be purged of a specific job by writing the >>> JobID to the jobid_name proc file. Any items in the cache that are more >>> than 300 seconds out of date will also be purged at this time. >> >> >> I'd much rather prefer you go to the table that's populated outside of >> the kernel >> somehow. >> Let's be realistic, poking around in userspace process environments for >> random >> strings is not such a great idea at all even though it did look like a >> good idea >> in the past for simplicity reasons. > > On the upside, there's far less of that going on now, since the results > are cached via pid. I'm unaware of a table that exists in userspace that > maps PIDs to Jobs. there is not. >> Similar to nodelocal, we probably just switch to a method where you call a >> particular lctl command that would mark the whole session as belonging >> to some job. This might take several forms, e.g. nodelocal itself could >> be extended to only apply to a current namespace/container > > That would make sense, but would need to requirement that each job has > it's own namespace/container. Only if you run multiple jobs per node at the same time, otherwise just do the nodelocal for hte global root namespace. >> But if you do really run different jobs in the global namespace, we >> probably can >> probably just make the lctl to spawn a shell with commands that all would >> be marked as a particular job? Or we can probably trace the parent of >> lctl and >> mark that so that all its children become somehow marked too. > > One of the things that came up during this is how do you handle a random > user who logs into a compute node and runs something like rsync? The more Current scheme does not handle it either, unles you use nodelocal and then their actions would attribute to the job currently running (not super ideal as well), I imagine there's a legitimate reason for users to log into the nodes running unrelated jobs? > conditions we place around getting jobstats to function properly, the > harder these types of behaviors are to track down. One thing I was > thinking was that if jobstats is enabled, that the fallback if no JobID > can be found is to simply use the taskname_uid method, so an admin would > see rsync.1234 pop up on your monitoring dashboard. If you have every node into its own container, then the global namespace could be set to "unscheduledcommand-$hostname" or some such and every container would get its own jobid. This does require containers of course. Or if we set the id based on the process group, then again they would get that and anything outside would get something default helping you. From andreas.dilger at intel.com Thu Jan 19 00:32:23 2017 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Thu, 19 Jan 2017 00:32:23 +0000 Subject: [lustre-devel] Quality of Service Planning in Lustre In-Reply-To: References: Message-ID: <6A9C4AF6-5F51-4DFB-9CC0-0FFC4CEFC49B@intel.com> On Jan 16, 2017, at 08:28, Jürgen Kaiser wrote: > > Hello everyone, > > my name is Jürgen Kaiser and I'm a research assistant at the Johannes Gutenberg University Mainz. As part of an IPCC project, we developed a tool for handling Quality of Service requirements in Lustre. We would like to explain what we did and hear your thoughts about it. We hope that our work will help the Lustre community in the future. > > ==== What we did === > > HPC centers typically use scheduling systems such as LSF or Slurm to manage the computations of the users and the resources themselves. These schedulers force the users to define compute jobs and to submit these jobs to the schedulers. In return, the schedulers guarantee the users that their job will have the required compute resources. So far, storage bandwidth is (mostly) excluded from the list of managed resources. Unlike resources like CPU or memory, there is no easy method for schedulers to handle storage bandwidth because they lack knowledge about storage system internals. For example, a scheduler must know the placement of a file’s data on Lustre's OSTs plus the workload as well as the maximum performance of the involved parts to reason about the available read throughput for the file. > > It would be more practical if the storage system would provide a generic API for schedulers to set Quality of Service (QoS) configurations while abstracting the internal dependencies. With such an interface, a scheduler easily could request available storage resources. In our project, we're developing a Quality of Service Planner (QoSP) that provides this interface. Its task is to receive storage bandwidth requests (e.g. 100MB/s read throughput for files X,Y,Z for one hour), check for resource availability and, if available, guarantee the reserved resources by configuring Lustre. The main tool here is a (modified) TBF strategy in Lustre's NRS. I think there is an open question about what sort of granularity of I/O bandwidth an application needs in order to do its job. I think the main goal of the user is to avoid having their job contend with another large job that is consuming all of the bandwidth for a long period of time, but they don't necessarily need real-time I/O guarantees. At the same time, from process scheduling on CPUs we know the most globally efficient scheduling algorithm is "shortest job first", so that small jobs can complete their I/O quickly and return to computation, while the large job is going to take a long time in either case. It may be that instead of working on hard bandwidth guarantees (i.e job A needs 100MB/s, while job B needs 500MB/s), which is hard for users to determine (they want to get the maximum bandwidth all of the time?) it might be better to have jobs provide information about how large their I/O is going to be, and how often. That is something that users can determine quite easily from one run to the next, and would allow a global scheduler to know that job A wants to read 10 GB of files every 10 minutes, while job B wants to write 10TB of data every 60 minutes, and when job A starts its read it should preempt job B (if currently doing I/O) so it can complete all of its reads quickly and go back to work, and job B will still be writing that 10TB long after job A has finished. > The QoSP still is under development. You can see the code on github: https://github.com/jkaiser/qos-planner . We see further use cases beyond the HPC scheduling scenario. For example, applications could negotiate I/O Phases with the storage backend (e.g. HPC checkpoints). We would like to hear your thoughts about this project in general and about several problems we face in detail. You can find a pdf a with detailed description and discussion about some core problems we face here: https://seafile.rlp.net/f/55e4c7b619/?raw=1. Two example issues are: > > === The NRS and the TBF === > > Users require _guaranteed_ storage bandwidth to reason about the run time of their applications so that they can reserve enough time on the computation cluster. In other words: users require minimum bandwidths instead of maximum ones. The current TBF strategy, however, only supports upper thresholds. There are two options here: > 1) Implement minimums indirectly. This involves a monitoring of the actual resource consumption on the OSTs and a repeatedly readjusting of TBF rules. > 2) Modify the TBF so that it supports lower thresholds. Here, the NRS would try to satisfy the minimums first. This additionally has the advantage that there is no underutilized bandwidth: each job can use free resources if necessary because there is no upper limit. > > We would like to implement Option 2. We are in contact with DDN and discuss this work including the TBF strategy. Good to hear that you are in contact with DDN on this, since they are the TBF developers and are already working to improve that code, and can help as needed for global NRS scheduling. > === Handling Write Throughput === > > When an application requests write throughput, this usually means that it will create new files. However, at request time, these files do not exist yet, therefore the QoSP cannot know which OSTs will have to process the write throughput. Hence, the QoSP somehow must predict/determine the placement of new files on the OSTs within the Lustre system. This requires several modifications in Lustre including a new interface to query such information. We would like to discuss this issue with the Lustre community. The mentioned PDF file contains further details. We would be happy to hear your thoughts on this. If the application provides the output directory for the new files, the number of files, and the size, the QoSP can have a very good idea of which OSTs will be used. In most cases, the number of files exceeds the OST count, or a single file will be striped across all OSTs so the I/O will be evenly balanced across OSTs and it doesn't matter what the exact file placement will be. If something like an OST pool is set on the directory, this can also be determined by "lfs getstripe" or llapi_layout_get_by_path() or similar. I think fine-grained scheduling of the I/O performance of every file in the filesystem is not necessary to achieve improvements in aggregate I/O performance across jobs. High-level prioritization of jobs is probably enough to gain the majority of performance improvements possible. For example, if the QoSP knows two jobs have similar I/O times during their busy period, and are contending for writes on OSTs then the first job to submit RPCs can have a short-term but significant boost in I/O priority so it can complete all of its I/O before the second job does. Even if the jobs do I/O at the same frequency (e.g. every 60 minutes) this would naturally offset the two jobs in time to avoid contention in the future. If the QoSP doesn't get any information about a job, it could potentially generate this dynamically from the job's previous I/O submissions (e.g. steady-state reader/writer of N MB/s, bursty every X seconds for Y GB, etc) to use it for later submissions and/or dump this in the job epilog so the user knows what information to submit for later test runs. I suspect that even if the user is specifying the job I/O pattern explicitly, this should only be taken as "initial values" and the QoSP should determine what actual I/O pattern the job has (and report large discrepancies in the epilog). The I/O pattern may change significantly based on input parameters, changes to the system, etc. that make the user-provided data inaccurate. Cheers, Andreas From bevans at cray.com Thu Jan 19 15:19:35 2017 From: bevans at cray.com (Ben Evans) Date: Thu, 19 Jan 2017 15:19:35 +0000 Subject: [lustre-devel] Proposal for JobID caching In-Reply-To: <0DF0E294-1740-4669-9389-5CE0ECC15AEE@intel.com> References: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> <0DF0E294-1740-4669-9389-5CE0ECC15AEE@intel.com> Message-ID: On 1/18/17, 5:56 PM, "Oleg Drokin" wrote: > >On Jan 18, 2017, at 5:35 PM, Ben Evans wrote: > >> >> >> On 1/18/17, 3:39 PM, "Oleg Drokin" wrote: >> >>> >>> On Jan 18, 2017, at 3:08 PM, Ben Evans wrote: >>> >>>> Overview >>>> The Lustre filesystem added the ability to track I/O >>>> performance of a job across a cluster. The initial algorithm was >>>> relatively simplistic: for every I/O, look up the job ID of the >>>>process >>>> and include it in the RPC being sent to the server. This imposed a >>>> non-trivial performance impact on client I/O performance. >>>> An additional algorithm was introduced to handle the single >>>> job per node case, where instead of looking up the job ID of the >>>> process, Lustre simply accesses the value of a variable set through >>>>the >>>> proc interface. This improved performance greatly, but only functions >>>> when a single job is being run. >>>> A new approach is needed for multiple job per node systems. >>>> >>>> Proposed Solution >>>> The proposed solution to this is to create a small >>>> PID->JobID table in kernel memory. When a process performs an IO, a >>>> lookup is done in the table for the PID, if a JobID exists for that >>>>PID, >>>> it is used, otherwise it is retrieved via the same methods as the >>>> original Jobstats algorithm. Once located the JobID is stored in a >>>> PID/JobID table in memory. The existing cfs_hash_table structure and >>>> functions will be used to implement the table. >>>> >>>> Rationale >>>> This reduces the number of calls into userspace, minimizing >>>> the time taken on each I/O. It also easily supports multiple job per >>>> node scenarios, and like other proposed solutions has no issue with >>>> multiple jobs performing I/O on the same file at the same time. >>>> >>>> Requirements >>>> · Performance cannot significantly detract from baseline >>>> performance without jobstats >>>> · Supports multiple jobs per node >>>> · Coordination with the scheduler is not required, but interfaces >>>> may be provided >>>> · Supports multiple PIDs per job >>>> >>>> New Data Structures >>>> pid_to_jobid { >>>> struct hlist_node pj_hash; >>>> u54 pj_pid; >>>> char pj_jobid[LUSTRE_JOBID_SIZE]; >>>> spinlock_t jp_lock; >>>> time_t jp_time; >>>> } >>>> Proc Variables >>>> Writing to /proc/fs/lustre/jobid_name while not in ³nodelocal² mode >>>> will cause all entries in the cache for that jobID to be removed from >>>> the cache >>>> >>>> Populating the Cache >>>> When lustre_get_jobid is called, the process, and in the >>>> cached mode, first a check will be done in the cache for a valid PID >>>>to >>>> JobID mapping. If none exists, it uses the same mechanisms to get the >>>> JobID and populates the appropriate PID to JobID map. >>>> If a lookup is performed and the PID to JobID mapping exists, but is >>>> more than 30 seconds old, the JobID is refreshed. >>>> Purging the Cache >>>> The cache can be purged of a specific job by writing the >>>> JobID to the jobid_name proc file. Any items in the cache that are >>>>more >>>> than 300 seconds out of date will also be purged at this time. >>> >>> >>> I'd much rather prefer you go to the table that's populated outside of >>> the kernel >>> somehow. >>> Let's be realistic, poking around in userspace process environments for >>> random >>> strings is not such a great idea at all even though it did look like a >>> good idea >>> in the past for simplicity reasons. >> >> On the upside, there's far less of that going on now, since the results >> are cached via pid. I'm unaware of a table that exists in userspace >>that >> maps PIDs to Jobs. > >there is not. > >>> Similar to nodelocal, we probably just switch to a method where you >>>call a >>> particular lctl command that would mark the whole session as belonging >>> to some job. This might take several forms, e.g. nodelocal itself could >>> be extended to only apply to a current namespace/container >> >> That would make sense, but would need to requirement that each job has >> it's own namespace/container. > >Only if you run multiple jobs per node at the same time, >otherwise just do the nodelocal for hte global root namespace. Agreed, this is supposed to handle the multiple jobs per node case. > >>> But if you do really run different jobs in the global namespace, we >>> probably can >>> probably just make the lctl to spawn a shell with commands that all >>>would >>> be marked as a particular job? Or we can probably trace the parent of >>> lctl and >>> mark that so that all its children become somehow marked too. >> >> One of the things that came up during this is how do you handle a random >> user who logs into a compute node and runs something like rsync? The >>more > >Current scheme does not handle it either, unles you use nodelocal and >then their >actions would attribute to the job currently running (not super ideal as >well), >I imagine there's a legitimate reason for users to log into the nodes >running >unrelated jobs? The current scheme does handle it, if you use the procname_uid setting. > >> conditions we place around getting jobstats to function properly, the >> harder these types of behaviors are to track down. One thing I was >> thinking was that if jobstats is enabled, that the fallback if no JobID >> can be found is to simply use the taskname_uid method, so an admin would >> see rsync.1234 pop up on your monitoring dashboard. > >If you have every node into its own container, then the global namespace >could >be set to "unscheduledcommand-$hostname" or some such and every container >would get its own jobid. or simply default to the existing procname_uid setting. > >This does require containers of course. Or if we set the id based on the >process group, >then again they would get that and anything outside would get something >default helping you. > From oleg.drokin at intel.com Thu Jan 19 16:28:55 2017 From: oleg.drokin at intel.com (Oleg Drokin) Date: Thu, 19 Jan 2017 11:28:55 -0500 Subject: [lustre-devel] Proposal for JobID caching In-Reply-To: References: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> <0DF0E294-1740-4669-9389-5CE0ECC15AEE@intel.com> Message-ID: <9F262189-77A8-4CF7-8EE3-C8D79E6FBD4B@intel.com> On Jan 19, 2017, at 10:19 AM, Ben Evans wrote: > > > On 1/18/17, 5:56 PM, "Oleg Drokin" wrote: > >> >> On Jan 18, 2017, at 5:35 PM, Ben Evans wrote: >> >>>> But if you do really run different jobs in the global namespace, we >>>> probably can >>>> probably just make the lctl to spawn a shell with commands that all >>>> would >>>> be marked as a particular job? Or we can probably trace the parent of >>>> lctl and >>>> mark that so that all its children become somehow marked too. >>> >>> One of the things that came up during this is how do you handle a random >>> user who logs into a compute node and runs something like rsync? The >>> more >> >> Current scheme does not handle it either, unles you use nodelocal and >> then their >> actions would attribute to the job currently running (not super ideal as >> well), >> I imagine there's a legitimate reason for users to log into the nodes >> running >> unrelated jobs? > > The current scheme does handle it, if you use the procname_uid setting. But then that's the only thing it handles, you don't get the actual jobid this way. What you are looking for is a fallback if a command is not actually part of any known job, I though, otherwise use the jobid that was somehow detected. Or were you thinking of somehow mapping this on management nodes then from node+pid into known jobs? >>> conditions we place around getting jobstats to function properly, the >>> harder these types of behaviors are to track down. One thing I was >>> thinking was that if jobstats is enabled, that the fallback if no JobID >>> can be found is to simply use the taskname_uid method, so an admin would >>> see rsync.1234 pop up on your monitoring dashboard. >> >> If you have every node into its own container, then the global namespace >> could >> be set to "unscheduledcommand-$hostname" or some such and every container >> would get its own jobid. > > or simply default to the existing procname_uid setting. Yes, that too. From andreas.dilger at intel.com Fri Jan 20 21:50:18 2017 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Fri, 20 Jan 2017 21:50:18 +0000 Subject: [lustre-devel] Proposal for JobID caching In-Reply-To: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> References: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> Message-ID: <9BEFFD88-0537-43AB-8352-6477F30906DA@intel.com> On Jan 18, 2017, at 13:39, Oleg Drokin wrote: > > > On Jan 18, 2017, at 3:08 PM, Ben Evans wrote: > >> Overview >> The Lustre filesystem added the ability to track I/O performance of a job across a cluster. The initial algorithm was relatively simplistic: for every I/O, look up the job ID of the process and include it in the RPC being sent to the server. This imposed a non-trivial performance impact on client I/O performance. >> An additional algorithm was introduced to handle the single job per node case, where instead of looking up the job ID of the process, Lustre simply accesses the value of a variable set through the proc interface. This improved performance greatly, but only functions when a single job is being run. >> A new approach is needed for multiple job per node systems. >> >> Proposed Solution >> The proposed solution to this is to create a small PID->JobID table in kernel memory. When a process performs an IO, a lookup is done in the table for the PID, if a JobID exists for that PID, it is used, otherwise it is retrieved via the same methods as the original Jobstats algorithm. Once located the JobID is stored in a PID/JobID table in memory. The existing cfs_hash_table structure and functions will be used to implement the table. >> >> Rationale >> This reduces the number of calls into userspace, minimizing the time taken on each I/O. It also easily supports multiple job per node scenarios, and like other proposed solutions has no issue with multiple jobs performing I/O on the same file at the same time. >> >> Requirements >> · Performance cannot significantly detract from baseline performance without jobstats >> · Supports multiple jobs per node >> · Coordination with the scheduler is not required, but interfaces may be provided >> · Supports multiple PIDs per job >> >> New Data Structures >> pid_to_jobid { >> struct hlist_node pj_hash; >> u54 pj_pid; >> char pj_jobid[LUSTRE_JOBID_SIZE]; >> spinlock_t jp_lock; >> time_t jp_time; >> } >> Proc Variables >> Writing to /proc/fs/lustre/jobid_name while not in “nodelocal” mode will cause all entries in the cache for that jobID to be removed from the cache >> >> Populating the Cache >> When lustre_get_jobid is called, the process, and in the cached mode, first a check will be done in the cache for a valid PID to JobID mapping. If none exists, it uses the same mechanisms to get the JobID and populates the appropriate PID to JobID map. >> If a lookup is performed and the PID to JobID mapping exists, but is more than 30 seconds old, the JobID is refreshed. >> Purging the Cache >> The cache can be purged of a specific job by writing the JobID to the jobid_name proc file. Any items in the cache that are more than 300 seconds out of date will also be purged at this time. > > > I'd much rather prefer you go to the table that's populated outside of the kernel > somehow. > Let's be realistic, poking around in userspace process environments for random > strings is not such a great idea at all even though it did look like a good idea > in the past for simplicity reasons. > Similar to nodelocal, we probably just switch to a method where you call a > particular lctl command that would mark the whole session as belonging > to some job. This might take several forms, e.g. nodelocal itself could > be extended to only apply to a current namespace/container > But if you do really run different jobs in the global namespace, we probably can > probably just make the lctl to spawn a shell with commands that all would > be marked as a particular job? Or we can probably trace the parent of lctl and > mark that so that all its children become somehow marked too. Having lctl spawn a shell or requiring everything to run in a container is impractical for users, and will just make it harder to use JobID, IMHO. The job scheduler is _already_ storing the JobID in the process environment so that it is available to all of the threads running as part of the job. The question is how the job prolog script can communicate the JobID directly to Lustre without using a global /proc file? Doing an upcall to userspace per JobID lookup is going to be *worse* for performance than the current searching through the process environment. I'm not against Ben's proposal to implement a cache in the kernel for different processes. It is unfortunate that we can't have proper thread-local storage for Lustre, so a hash table is probably reasonable for this (there may be thousands of threads involved). I don't think the cl_env struct would be useful, since it is not tied to a specific thread (AFAIK), but rather assigned as different threads enter/exit kernel context. Note that we already have similar time-limited caches for the identity upcall and FMD (lustre/ofd/ofd_fmd.c), so it may be useful to see whether the code can be shared. Another (not very nice) option to avoid looking through the environment variables (which IMHO isn't so bad, even though the upstream folks don't like it) is to associate the JobID set via /proc with a process group internally and look the PGID up in the kernel to find the JobID. That can be repeated each time a new JobID is set via /proc, since the PGID would stick around for each new job/shell/process created under the PGID. It won't be as robust as looking up the JobID in the environment, but probably good enough for most uses. I would definitely also be in favor of having some way to fall back to procname_uid if the PGID cannot be found, the job environment variable is not available, and there is nothing in nodelocal. Cheers, Andreas From bevans at cray.com Fri Jan 20 22:00:21 2017 From: bevans at cray.com (Ben Evans) Date: Fri, 20 Jan 2017 22:00:21 +0000 Subject: [lustre-devel] Proposal for JobID caching In-Reply-To: <9BEFFD88-0537-43AB-8352-6477F30906DA@intel.com> References: <6E2CFE03-A158-4D82-82BA-AF0A175AA358@intel.com> <9BEFFD88-0537-43AB-8352-6477F30906DA@intel.com> Message-ID: On 1/20/17, 4:50 PM, "Dilger, Andreas" wrote: >On Jan 18, 2017, at 13:39, Oleg Drokin wrote: >> >> >> On Jan 18, 2017, at 3:08 PM, Ben Evans wrote: >> >>> Overview >>> The Lustre filesystem added the ability to track I/O >>>performance of a job across a cluster. The initial algorithm was >>>relatively simplistic: for every I/O, look up the job ID of the >>>process and include it in the RPC being sent to the server. This >>>imposed a non-trivial performance impact on client I/O performance. >>> An additional algorithm was introduced to handle the single >>>job per node case, where instead of looking up the job ID of the >>>process, Lustre simply accesses the value of a variable set through the >>>proc interface. This improved performance greatly, but only functions >>>when a single job is being run. >>> A new approach is needed for multiple job per node systems. >>> >>> Proposed Solution >>> The proposed solution to this is to create a small >>>PID->JobID table in kernel memory. When a process performs an IO, a >>>lookup is done in the table for the PID, if a JobID exists for that >>>PID, it is used, otherwise it is retrieved via the same methods as the >>>original Jobstats algorithm. Once located the JobID is stored in a >>>PID/JobID table in memory. The existing cfs_hash_table structure and >>>functions will be used to implement the table. >>> >>> Rationale >>> This reduces the number of calls into userspace, minimizing >>>the time taken on each I/O. It also easily supports multiple job per >>>node scenarios, and like other proposed solutions has no issue with >>>multiple jobs performing I/O on the same file at the same time. >>> >>> Requirements >>> · Performance cannot significantly detract from baseline >>>performance without jobstats >>> · Supports multiple jobs per node >>> · Coordination with the scheduler is not required, but interfaces >>>may be provided >>> · Supports multiple PIDs per job >>> >>> New Data Structures >>> pid_to_jobid { >>> struct hlist_node pj_hash; >>> u54 pj_pid; >>> char pj_jobid[LUSTRE_JOBID_SIZE]; >>> spinlock_t jp_lock; >>> time_t jp_time; >>> } >>> Proc Variables >>> Writing to /proc/fs/lustre/jobid_name while not in ³nodelocal² mode >>>will cause all entries in the cache for that jobID to be removed from >>>the cache >>> >>> Populating the Cache >>> When lustre_get_jobid is called, the process, and in the >>>cached mode, first a check will be done in the cache for a valid PID to >>>JobID mapping. If none exists, it uses the same mechanisms to get the >>>JobID and populates the appropriate PID to JobID map. >>> If a lookup is performed and the PID to JobID mapping exists, but is >>>more than 30 seconds old, the JobID is refreshed. >>> Purging the Cache >>> The cache can be purged of a specific job by writing the >>>JobID to the jobid_name proc file. Any items in the cache that are >>>more than 300 seconds out of date will also be purged at this time. >> >> >> I'd much rather prefer you go to the table that's populated outside of >>the kernel >> somehow. >> Let's be realistic, poking around in userspace process environments for >>random >> strings is not such a great idea at all even though it did look like a >>good idea >> in the past for simplicity reasons. >> Similar to nodelocal, we probably just switch to a method where you >>call a >> particular lctl command that would mark the whole session as belonging >> to some job. This might take several forms, e.g. nodelocal itself could >> be extended to only apply to a current namespace/container >> But if you do really run different jobs in the global namespace, we >>probably can >> probably just make the lctl to spawn a shell with commands that all >>would >> be marked as a particular job? Or we can probably trace the parent of >>lctl and >> mark that so that all its children become somehow marked too. > >Having lctl spawn a shell or requiring everything to run in a container >is impractical for users, and will just make it harder to use JobID, >IMHO. The job scheduler is _already_ storing the JobID in the process >environment so that it is available to all of the threads running as part >of the job. The question is how the job prolog script can communicate >the JobID directly to Lustre without using a global /proc file? Doing an >upcall to userspace per JobID lookup is going to be *worse* for >performance than the current searching through the process environment. > >I'm not against Ben's proposal to implement a cache in the kernel for >different processes. It is unfortunate that we can't have proper >thread-local storage for Lustre, so a hash table is probably reasonable >for this (there may be thousands of threads involved). I don't think the >cl_env struct would be useful, since it is not tied to a specific thread >(AFAIK), but rather assigned as different threads enter/exit kernel >context. Note that we already have similar time-limited caches for the >identity upcall and FMD (lustre/ofd/ofd_fmd.c), so it may be useful to >see whether the code can be shared. I'll take a look at those, but implementing the hash table was a pretty simple solution, I need to work out a few kinks with memory leaks before doing real performance tests on it to make sure it performs similarly to nodelocal. >Another (not very nice) option to avoid looking through the environment >variables (which IMHO isn't so bad, even though the upstream folks don't >like it) is to associate the JobID set via /proc with a process group >internally and look the PGID up in the kernel to find the JobID. That >can be repeated each time a new JobID is set via /proc, since the PGID >would stick around for each new job/shell/process created under the PGID. > It won't be as robust as looking up the JobID in the environment, but >probably good enough for most uses. > >I would definitely also be in favor of having some way to fall back to >procname_uid if the PGID cannot be found, the job environment variable is >not available, and there is nothing in nodelocal. That's simple enough. From jsimmons at infradead.org Fri Jan 20 23:33:11 2017 From: jsimmons at infradead.org (James Simmons) Date: Fri, 20 Jan 2017 23:33:11 +0000 (GMT) Subject: [lustre-devel] [PATCH] staging: lustre: headers: potential UAPI headers In-Reply-To: <20170117074140.GA19328@kroah.com> References: <1482167207-22800-1-git-send-email-jsimmons@infradead.org> <20170103141248.GA8695@kroah.com> <20170117074140.GA19328@kroah.com> Message-ID: > > > On Mon, Dec 19, 2016 at 12:06:47PM -0500, James Simmons wrote: > > > > Not for landing. This is the purposed UAPI headers > > > > with the removal of unlikely and debugging macros. > > > > This is just for feedback to see if this is acceptable > > > > for the upstream client. > > > > > > > > Signed-off-by: James Simmons > > > > --- > > > > .../lustre/lustre/include/lustre/lustre_fid.h | 353 +++++++++++++++++++++ > > > > .../lustre/lustre/include/lustre/lustre_ostid.h | 233 ++++++++++++++ > > > > > > Can you make a lustre "uapi" directory so we can see which files you > > > really want to be UAPI and which you don't as time goes on? > > > > Where do you want them placed? In uapi/linux/lustre or uapi/lustre. Does > > it matter to you? The below was to forth coming UAPI headers which from > > your response you seem okay with in general. > > How many .h files are there going to be? It's just a single filesystem, > shouldn't you just need a single file? If so, how about > drivers/staging/lustre/include/uapi/lustre.h > ? > > If you really need multiple .h files, put them all in the same uapi/ > directory with a lustre_ prefix, you don't need a whole subdir just for > yourself, right? We have 12 UAPI headers and yes they all begin with lustre_*. Okay I will create a driver/staging/lustre/include/uapi/linux directory and start moving headers there. From jsimmons at infradead.org Fri Jan 20 23:34:15 2017 From: jsimmons at infradead.org (James Simmons) Date: Fri, 20 Jan 2017 23:34:15 +0000 (GMT) Subject: [lustre-devel] [PATCH] staging: lustre: use i_blocksize() In-Reply-To: References: <0a58b38c7ddfbbc8f56cb8d815114bd4357a6016.1484895399.git.geliangtang@gmail.com> Message-ID: > Since i_blocksize() helper has been defined in fs.h, use it instead > of open-coding. The i_blocksize() work hasn't landed to the staging-next tree so this can't land just yet. > Signed-off-by: Geliang Tang > --- > drivers/staging/lustre/lustre/llite/file.c | 2 +- > drivers/staging/lustre/lustre/obdclass/obdo.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c > index d93f06a..3ee546f 100644 > --- a/drivers/staging/lustre/lustre/llite/file.c > +++ b/drivers/staging/lustre/lustre/llite/file.c > @@ -2967,7 +2967,7 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat) > stat->atime = inode->i_atime; > stat->mtime = inode->i_mtime; > stat->ctime = inode->i_ctime; > - stat->blksize = 1 << inode->i_blkbits; > + stat->blksize = i_blocksize(inode); > > stat->nlink = inode->i_nlink; > stat->size = i_size_read(inode); > diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c > index b1dfa16..b9be7db 100644 > --- a/drivers/staging/lustre/lustre/obdclass/obdo.c > +++ b/drivers/staging/lustre/lustre/obdclass/obdo.c > @@ -84,7 +84,7 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid) > newvalid |= OBD_MD_FLBLOCKS; > } > if (valid & OBD_MD_FLBLKSZ) { /* optimal block size */ > - dst->o_blksize = 1 << src->i_blkbits; > + dst->o_blksize = i_blocksize(src); > newvalid |= OBD_MD_FLBLKSZ; > } > if (valid & OBD_MD_FLTYPE) { > -- > 2.9.3 > > From gregkh at linuxfoundation.org Sat Jan 21 09:24:59 2017 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Sat, 21 Jan 2017 10:24:59 +0100 Subject: [lustre-devel] [PATCH] staging: lustre: headers: potential UAPI headers In-Reply-To: References: <1482167207-22800-1-git-send-email-jsimmons@infradead.org> <20170103141248.GA8695@kroah.com> <20170117074140.GA19328@kroah.com> Message-ID: <20170121092459.GA29138@kroah.com> On Fri, Jan 20, 2017 at 11:33:11PM +0000, James Simmons wrote: > > > > > On Mon, Dec 19, 2016 at 12:06:47PM -0500, James Simmons wrote: > > > > > Not for landing. This is the purposed UAPI headers > > > > > with the removal of unlikely and debugging macros. > > > > > This is just for feedback to see if this is acceptable > > > > > for the upstream client. > > > > > > > > > > Signed-off-by: James Simmons > > > > > --- > > > > > .../lustre/lustre/include/lustre/lustre_fid.h | 353 +++++++++++++++++++++ > > > > > .../lustre/lustre/include/lustre/lustre_ostid.h | 233 ++++++++++++++ > > > > > > > > Can you make a lustre "uapi" directory so we can see which files you > > > > really want to be UAPI and which you don't as time goes on? > > > > > > Where do you want them placed? In uapi/linux/lustre or uapi/lustre. Does > > > it matter to you? The below was to forth coming UAPI headers which from > > > your response you seem okay with in general. > > > > How many .h files are there going to be? It's just a single filesystem, > > shouldn't you just need a single file? If so, how about > > drivers/staging/lustre/include/uapi/lustre.h > > ? > > > > If you really need multiple .h files, put them all in the same uapi/ > > directory with a lustre_ prefix, you don't need a whole subdir just for > > yourself, right? > > We have 12 UAPI headers and yes they all begin with lustre_*. Okay I will > create a driver/staging/lustre/include/uapi/linux directory and start > moving headers there. 12 seems like a lot just for a single, tiny, filesystem :) But moving them all to a single directory will see where we can later merge them together, sounds like a good plan. thanks, greg k-h From jsimmons at infradead.org Sun Jan 22 00:40:25 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:25 -0500 Subject: [lustre-devel] [PATCH 1/8] staging: lustre: lnet: change lnet_handle_wire_t to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485045632-5886-2-git-send-email-jsimmons@infradead.org> Change lnet_handle_wire_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 4 ++-- drivers/staging/lustre/include/linux/lnet/types.h | 12 ++++++------ drivers/staging/lustre/lnet/lnet/api-ni.c | 10 +++++----- drivers/staging/lustre/lnet/lnet/lib-move.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-msg.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index a59c5e99c..363342f 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -78,7 +78,7 @@ static inline int lnet_is_route_alive(lnet_route_t *route) return route->lr_downis == 0; } -static inline int lnet_is_wire_handle_none(lnet_handle_wire_t *wh) +static inline int lnet_is_wire_handle_none(struct lnet_handle_wire *wh) { return (wh->wh_interface_cookie == LNET_WIRE_HANDLE_COOKIE_NONE && wh->wh_object_cookie == LNET_WIRE_HANDLE_COOKIE_NONE); @@ -323,7 +323,7 @@ void lnet_res_lh_initialize(struct lnet_res_container *rec, } static inline lnet_libmd_t * -lnet_wire_handle2md(lnet_handle_wire_t *wh) +lnet_wire_handle2md(struct lnet_handle_wire *wh) { /* ALWAYS called with resource lock held */ lnet_libhandle_t *lh; diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 8ca1e9d..1787089 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -127,10 +127,10 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num) * reboots). The object cookie only matches one object on that interface * during that object's lifetime (i.e. no cookie re-use). */ -typedef struct { +struct lnet_handle_wire { __u64 wh_interface_cookie; __u64 wh_object_cookie; -} WIRE_ATTR lnet_handle_wire_t; +} WIRE_ATTR; typedef enum { LNET_MSG_ACK = 0, @@ -147,13 +147,13 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num) * end. */ typedef struct lnet_ack { - lnet_handle_wire_t dst_wmd; + struct lnet_handle_wire dst_wmd; __u64 match_bits; __u32 mlength; } WIRE_ATTR lnet_ack_t; typedef struct lnet_put { - lnet_handle_wire_t ack_wmd; + struct lnet_handle_wire ack_wmd; __u64 match_bits; __u64 hdr_data; __u32 ptl_index; @@ -161,7 +161,7 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num) } WIRE_ATTR lnet_put_t; typedef struct lnet_get { - lnet_handle_wire_t return_wmd; + struct lnet_handle_wire return_wmd; __u64 match_bits; __u32 ptl_index; __u32 src_offset; @@ -169,7 +169,7 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num) } WIRE_ATTR lnet_get_t; typedef struct lnet_reply { - lnet_handle_wire_t dst_wmd; + struct lnet_handle_wire dst_wmd; } WIRE_ATTR lnet_reply_t; typedef struct lnet_hello { diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index b2ba10d..3a7788c 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -190,11 +190,11 @@ static void lnet_assert_wire_constants(void) CLASSERT(LNET_MSG_HELLO == 4); /* Checks for struct ptl_handle_wire_t */ - CLASSERT((int)sizeof(lnet_handle_wire_t) == 16); - CLASSERT((int)offsetof(lnet_handle_wire_t, wh_interface_cookie) == 0); - CLASSERT((int)sizeof(((lnet_handle_wire_t *)0)->wh_interface_cookie) == 8); - CLASSERT((int)offsetof(lnet_handle_wire_t, wh_object_cookie) == 8); - CLASSERT((int)sizeof(((lnet_handle_wire_t *)0)->wh_object_cookie) == 8); + CLASSERT((int)sizeof(struct lnet_handle_wire) == 16); + CLASSERT((int)offsetof(struct lnet_handle_wire, wh_interface_cookie) == 0); + CLASSERT((int)sizeof(((struct lnet_handle_wire *)0)->wh_interface_cookie) == 8); + CLASSERT((int)offsetof(struct lnet_handle_wire, wh_object_cookie) == 8); + CLASSERT((int)sizeof(((struct lnet_handle_wire *)0)->wh_object_cookie) == 8); /* Checks for struct lnet_magicversion_t */ CLASSERT((int)sizeof(lnet_magicversion_t) == 8); diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index f3dd6e4..595fde8 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -1326,7 +1326,7 @@ { struct lnet_match_info info; lnet_hdr_t *hdr = &msg->msg_hdr; - lnet_handle_wire_t reply_wmd; + struct lnet_handle_wire reply_wmd; int rc; /* Convert get fields to host byte order */ diff --git a/drivers/staging/lustre/lnet/lnet/lib-msg.c b/drivers/staging/lustre/lnet/lnet/lib-msg.c index 0897e58..1262616 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-msg.c +++ b/drivers/staging/lustre/lnet/lnet/lib-msg.c @@ -361,7 +361,7 @@ static int lnet_complete_msg_locked(lnet_msg_t *msg, int cpt) { - lnet_handle_wire_t ack_wmd; + struct lnet_handle_wire ack_wmd; int rc; int status = msg->msg_ev.status; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 22 00:40:24 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:24 -0500 Subject: [lustre-devel] [PATCH 0/8] staging: lustre: lnet: change wire protocol typedefs to proper structure Message-ID: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> The upstream kernel requires proper structures so convert nearly all the LNet wire protocols typedefs in the LNet core. Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons James Simmons (8): staging: lustre: lnet: change lnet_handle_wire_t to proper structure staging: lustre: lnet: change lnet_ping_info_t to proper structure staging: lustre: lnet: change lnet_ni_status_t to proper structure staging: lustre: lnet: change lnet_process_id_packed_t to proper structure staging: lustre: lnet: change lnet_acceptor_connreq_t to proper structure staging: lustre: lnet: change lnet_magicversion_t to proper structure staging: lustre: lnet: change lnet_hdr_t to proper structure staging: lustre: lnet: change msg union in struct lnet_hdr to proper structure .../staging/lustre/include/linux/lnet/lib-lnet.h | 14 +- .../staging/lustre/include/linux/lnet/lib-types.h | 10 +- .../staging/lustre/include/linux/lnet/socklnd.h | 2 +- drivers/staging/lustre/include/linux/lnet/types.h | 70 ++++----- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 6 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 14 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 26 ++-- drivers/staging/lustre/lnet/lnet/acceptor.c | 6 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 170 ++++++++++----------- drivers/staging/lustre/lnet/lnet/lib-move.c | 20 +-- drivers/staging/lustre/lnet/lnet/lib-msg.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 2 +- drivers/staging/lustre/lnet/lnet/net_fault.c | 4 +- drivers/staging/lustre/lnet/lnet/router.c | 10 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 10 +- drivers/staging/lustre/lnet/selftest/framework.c | 8 +- drivers/staging/lustre/lnet/selftest/selftest.h | 2 +- 19 files changed, 191 insertions(+), 191 deletions(-) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 22 00:40:28 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:28 -0500 Subject: [lustre-devel] [PATCH 4/8] staging: lustre: lnet: change lnet_process_id_packed_t to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485045632-5886-5-git-send-email-jsimmons@infradead.org> Change lnet_process_id_packed_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/types.h | 4 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 10 +++++----- drivers/staging/lustre/lnet/selftest/framework.c | 8 ++++---- drivers/staging/lustre/lnet/selftest/selftest.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 405bbc6..3c3b6676 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -115,11 +115,11 @@ static inline __u32 LNET_MKNET(__u32 type, __u32 num) #define WIRE_ATTR __packed /* Packed version of lnet_process_id_t to transfer via network */ -typedef struct { +struct lnet_process_id_packed { /* node id / process id */ lnet_nid_t nid; lnet_pid_t pid; -} WIRE_ATTR lnet_process_id_packed_t; +} WIRE_ATTR; /* * The wire handle's interface cookie only matches one network interface in diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 3d325ea..c6a683b 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -698,17 +698,17 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, return 0; } -static lnet_process_id_packed_t * +static struct lnet_process_id_packed * lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov) { - lnet_process_id_packed_t *pid; + struct lnet_process_id_packed *pid; int i; i = idx / SFW_ID_PER_PAGE; LASSERT(i < nkiov); - pid = (lnet_process_id_packed_t *)page_address(kiov[i].bv_page); + pid = (struct lnet_process_id_packed *)page_address(kiov[i].bv_page); return &pid[idx % SFW_ID_PER_PAGE]; } @@ -717,7 +717,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, lstcon_dstnodes_prep(struct lstcon_group *grp, int idx, int dist, int span, int nkiov, lnet_kiov_t *kiov) { - lnet_process_id_packed_t *pid; + struct lnet_process_id_packed *pid; struct lstcon_ndlink *ndl; struct lstcon_node *nd; int start; @@ -823,7 +823,7 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, npg = sfw_id_pages(test->tes_span); nob = !(feats & LST_FEAT_BULK_LEN) ? npg * PAGE_SIZE : - sizeof(lnet_process_id_packed_t) * test->tes_span; + sizeof(struct lnet_process_id_packed) * test->tes_span; } rc = lstcon_rpc_prep(nd, SRPC_SERVICE_TEST, feats, npg, nob, crpc); diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 436aef3..9dd4e1a 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -777,14 +777,14 @@ LASSERT(bk); LASSERT(bk->bk_niov * SFW_ID_PER_PAGE >= (unsigned int)ndest); LASSERT((unsigned int)bk->bk_len >= - sizeof(lnet_process_id_packed_t) * ndest); + sizeof(struct lnet_process_id_packed) * ndest); sfw_unpack_addtest_req(msg); memcpy(&tsi->tsi_u, &req->tsr_u, sizeof(tsi->tsi_u)); for (i = 0; i < ndest; i++) { - lnet_process_id_packed_t *dests; - lnet_process_id_packed_t id; + struct lnet_process_id_packed *dests; + struct lnet_process_id_packed id; int j; dests = page_address(bk->bk_iovs[i / SFW_ID_PER_PAGE].bv_page); @@ -1164,7 +1164,7 @@ len = npg * PAGE_SIZE; } else { - len = sizeof(lnet_process_id_packed_t) * + len = sizeof(struct lnet_process_id_packed) * request->tsr_ndest; } diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 1e5526c..f259480 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -396,7 +396,7 @@ struct sfw_test_instance { * pages are not used */ #define SFW_MAX_CONCUR LST_MAX_CONCUR -#define SFW_ID_PER_PAGE (PAGE_SIZE / sizeof(lnet_process_id_packed_t)) +#define SFW_ID_PER_PAGE (PAGE_SIZE / sizeof(struct lnet_process_id_packed)) #define SFW_MAX_NDESTS (LNET_MAX_IOV * SFW_ID_PER_PAGE) #define sfw_id_pages(n) (((n) + SFW_ID_PER_PAGE - 1) / SFW_ID_PER_PAGE) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 22 00:40:31 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:31 -0500 Subject: [lustre-devel] [PATCH 7/8] staging: lustre: lnet: change lnet_hdr_t to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485045632-5886-8-git-send-email-jsimmons@infradead.org> Change lnet_hdr_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 8 +- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- .../staging/lustre/include/linux/lnet/socklnd.h | 2 +- drivers/staging/lustre/include/linux/lnet/types.h | 6 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 6 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 10 +-- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 22 ++--- drivers/staging/lustre/lnet/lnet/api-ni.c | 96 +++++++++++----------- drivers/staging/lustre/lnet/lnet/lib-move.c | 18 ++-- drivers/staging/lustre/lnet/lnet/lib-msg.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 2 +- drivers/staging/lustre/lnet/lnet/net_fault.c | 4 +- 14 files changed, 91 insertions(+), 91 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 8f164a9..3d19402 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -552,7 +552,7 @@ void lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md, void lnet_portals_destroy(void); /* message functions */ -int lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, +int lnet_parse(lnet_ni_t *ni, struct lnet_hdr *hdr, lnet_nid_t fromnid, void *private, int rdma_req); int lnet_parse_local(lnet_ni_t *ni, lnet_msg_t *msg); int lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg); @@ -579,7 +579,7 @@ void lnet_drop_message(lnet_ni_t *ni, int cpt, void *private, int lnet_msg_containers_create(void); char *lnet_msgtyp2str(int type); -void lnet_print_hdr(lnet_hdr_t *hdr); +void lnet_print_hdr(struct lnet_hdr *hdr); int lnet_fail_nid(lnet_nid_t nid, unsigned int threshold); /** \addtogroup lnet_fault_simulation @{ */ @@ -588,7 +588,7 @@ void lnet_drop_message(lnet_ni_t *ni, int cpt, void *private, int lnet_fault_init(void); void lnet_fault_fini(void); -bool lnet_drop_rule_match(lnet_hdr_t *hdr); +bool lnet_drop_rule_match(struct lnet_hdr *hdr); int lnet_delay_rule_add(struct lnet_fault_attr *attr); int lnet_delay_rule_del(lnet_nid_t src, lnet_nid_t dst, bool shutdown); @@ -596,7 +596,7 @@ int lnet_delay_rule_list(int pos, struct lnet_fault_attr *attr, struct lnet_fault_stat *stat); void lnet_delay_rule_reset(void); void lnet_delay_rule_check(void); -bool lnet_delay_rule_match_locked(lnet_hdr_t *hdr, struct lnet_msg *msg); +bool lnet_delay_rule_match_locked(struct lnet_hdr *hdr, struct lnet_msg *msg); /** @} lnet_fault_simulation */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 942549b..9850398 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -105,7 +105,7 @@ lnet_kiov_t *msg_kiov; lnet_event_t msg_ev; - lnet_hdr_t msg_hdr; + struct lnet_hdr msg_hdr; } lnet_msg_t; typedef struct lnet_libhandle { diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index bc32403..7d24a91 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -60,7 +60,7 @@ } WIRE_ATTR ksock_hello_msg_t; typedef struct { - lnet_hdr_t ksnm_hdr; /* lnet hdr */ + struct lnet_hdr ksnm_hdr; /* lnet hdr */ /* * ksnm_payload is removed because of winnt compiler's limitation: diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index a6233be..1448fa4 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -177,7 +177,7 @@ struct lnet_handle_wire { __u32 type; } WIRE_ATTR lnet_hello_t; -typedef struct { +struct lnet_hdr { lnet_nid_t dest_nid; lnet_nid_t src_nid; lnet_pid_t dest_pid; @@ -192,7 +192,7 @@ struct lnet_handle_wire { lnet_reply_t reply; lnet_hello_t hello; } msg; -} WIRE_ATTR lnet_hdr_t; +} WIRE_ATTR; /* * A HELLO message contains a magic number and protocol version @@ -202,7 +202,7 @@ struct lnet_handle_wire { * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is * running the same protocol and to find out its NID. These LNDs should * exchange HELLO messages when a connection is first established. Individual - * LNDs can put whatever else they fancy in lnet_hdr_t::msg. + * LNDs can put whatever else they fancy in struct lnet_hdr::msg. */ struct lnet_magicversion { __u32 magic; /* LNET_PROTO_TCP_MAGIC */ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 1457697..2cb4298 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -364,7 +364,7 @@ struct kib_connparams { } WIRE_ATTR; struct kib_immediate_msg { - lnet_hdr_t ibim_hdr; /* portals header */ + struct lnet_hdr ibim_hdr; /* portals header */ char ibim_payload[0]; /* piggy-backed payload */ } WIRE_ATTR; @@ -380,7 +380,7 @@ struct kib_rdma_desc { } WIRE_ATTR; struct kib_putreq_msg { - lnet_hdr_t ibprm_hdr; /* portals header */ + struct lnet_hdr ibprm_hdr; /* portals header */ __u64 ibprm_cookie; /* opaque completion cookie */ } WIRE_ATTR; @@ -391,7 +391,7 @@ struct kib_putack_msg { } WIRE_ATTR; struct kib_get_msg { - lnet_hdr_t ibgm_hdr; /* portals header */ + struct lnet_hdr ibgm_hdr; /* portals header */ __u64 ibgm_cookie; /* opaque completion cookie */ struct kib_rdma_desc ibgm_rd; /* rdma descriptor */ } WIRE_ATTR; diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index c7917ab..14dbc53 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -1490,7 +1490,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, int kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) { - lnet_hdr_t *hdr = &lntmsg->msg_hdr; + struct lnet_hdr *hdr = &lntmsg->msg_hdr; int type = lntmsg->msg_type; lnet_process_id_t target = lntmsg->msg_target; int target_is_router = lntmsg->msg_target_is_router; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 842c453..9e86563 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -373,7 +373,7 @@ struct ksock_conn { * V2.x message takes the * whole struct * V1.x message is a bare - * lnet_hdr_t, it's stored in + * struct lnet_hdr, it's stored in * ksnc_msg.ksm_u.lnetmsg */ /* WRITER */ diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 42b67b0..3531e7d 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -1073,14 +1073,14 @@ struct ksock_route * break; case KSOCK_PROTO_V1: - /* Receiving bare lnet_hdr_t */ + /* Receiving bare struct lnet_hdr */ conn->ksnc_rx_state = SOCKNAL_RX_LNET_HEADER; - conn->ksnc_rx_nob_wanted = sizeof(lnet_hdr_t); - conn->ksnc_rx_nob_left = sizeof(lnet_hdr_t); + conn->ksnc_rx_nob_wanted = sizeof(struct lnet_hdr); + conn->ksnc_rx_nob_left = sizeof(struct lnet_hdr); conn->ksnc_rx_iov = (struct kvec *)&conn->ksnc_rx_iov_space; conn->ksnc_rx_iov[0].iov_base = &conn->ksnc_msg.ksm_u.lnetmsg; - conn->ksnc_rx_iov[0].iov_len = sizeof(lnet_hdr_t); + conn->ksnc_rx_iov[0].iov_len = sizeof(struct lnet_hdr); break; default: @@ -1126,7 +1126,7 @@ struct ksock_route * static int ksocknal_process_receive(struct ksock_conn *conn) { - lnet_hdr_t *lhdr; + struct lnet_hdr *lhdr; lnet_process_id_t *id; int rc; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c index 420597b..b36f181 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c @@ -291,7 +291,7 @@ } else { nob = tx->tx_lnetmsg->msg_len + ((conn->ksnc_proto == &ksocknal_protocol_v1x) ? - sizeof(lnet_hdr_t) : sizeof(ksock_msg_t)); + sizeof(struct lnet_hdr) : sizeof(ksock_msg_t)); } /* default checking for typed connection */ @@ -459,23 +459,23 @@ ksocknal_send_hello_v1(struct ksock_conn *conn, ksock_hello_msg_t *hello) { struct socket *sock = conn->ksnc_sock; - lnet_hdr_t *hdr; + struct lnet_hdr *hdr; struct lnet_magicversion *hmv; int rc; int i; - CLASSERT(sizeof(struct lnet_magicversion) == offsetof(lnet_hdr_t, src_nid)); + CLASSERT(sizeof(struct lnet_magicversion) == offsetof(struct lnet_hdr, src_nid)); LIBCFS_ALLOC(hdr, sizeof(*hdr)); if (!hdr) { - CERROR("Can't allocate lnet_hdr_t\n"); + CERROR("Can't allocate struct lnet_hdr\n"); return -ENOMEM; } hmv = (struct lnet_magicversion *)&hdr->dest_nid; /* - * Re-organize V2.x message header to V1.x (lnet_hdr_t) + * Re-organize V2.x message header to V1.x (struct lnet_hdr) * header and send out */ hmv->magic = cpu_to_le32(LNET_PROTO_TCP_MAGIC); @@ -577,18 +577,18 @@ int timeout) { struct socket *sock = conn->ksnc_sock; - lnet_hdr_t *hdr; + struct lnet_hdr *hdr; int rc; int i; LIBCFS_ALLOC(hdr, sizeof(*hdr)); if (!hdr) { - CERROR("Can't allocate lnet_hdr_t\n"); + CERROR("Can't allocate struct lnet_hdr\n"); return -ENOMEM; } rc = lnet_sock_read(sock, &hdr->src_nid, - sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid), + sizeof(*hdr) - offsetof(struct lnet_hdr, src_nid), timeout); if (rc) { CERROR("Error %d reading rest of HELLO hdr from %pI4h\n", @@ -723,10 +723,10 @@ LASSERT(tx->tx_lnetmsg); tx->tx_iov[0].iov_base = &tx->tx_lnetmsg->msg_hdr; - tx->tx_iov[0].iov_len = sizeof(lnet_hdr_t); + tx->tx_iov[0].iov_len = sizeof(struct lnet_hdr); - tx->tx_nob = tx->tx_lnetmsg->msg_len + sizeof(lnet_hdr_t); - tx->tx_resid = tx->tx_lnetmsg->msg_len + sizeof(lnet_hdr_t); + tx->tx_nob = tx->tx_lnetmsg->msg_len + sizeof(struct lnet_hdr); + tx->tx_resid = tx->tx_lnetmsg->msg_len + sizeof(struct lnet_hdr); } static void diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index fd4153b..79f8534 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -205,64 +205,64 @@ static void lnet_assert_wire_constants(void) CLASSERT((int)offsetof(struct lnet_magicversion, version_minor) == 6); CLASSERT((int)sizeof(((struct lnet_magicversion *)0)->version_minor) == 2); - /* Checks for struct lnet_hdr_t */ - CLASSERT((int)sizeof(lnet_hdr_t) == 72); - CLASSERT((int)offsetof(lnet_hdr_t, dest_nid) == 0); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->dest_nid) == 8); - CLASSERT((int)offsetof(lnet_hdr_t, src_nid) == 8); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->src_nid) == 8); - CLASSERT((int)offsetof(lnet_hdr_t, dest_pid) == 16); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->dest_pid) == 4); - CLASSERT((int)offsetof(lnet_hdr_t, src_pid) == 20); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->src_pid) == 4); - CLASSERT((int)offsetof(lnet_hdr_t, type) == 24); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->type) == 4); - CLASSERT((int)offsetof(lnet_hdr_t, payload_length) == 28); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->payload_length) == 4); - CLASSERT((int)offsetof(lnet_hdr_t, msg) == 32); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg) == 40); + /* Checks for struct struct lnet_hdr */ + CLASSERT((int)sizeof(struct lnet_hdr) == 72); + CLASSERT((int)offsetof(struct lnet_hdr, dest_nid) == 0); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->dest_nid) == 8); + CLASSERT((int)offsetof(struct lnet_hdr, src_nid) == 8); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->src_nid) == 8); + CLASSERT((int)offsetof(struct lnet_hdr, dest_pid) == 16); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->dest_pid) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, src_pid) == 20); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->src_pid) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, type) == 24); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->type) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, payload_length) == 28); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->payload_length) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, msg) == 32); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg) == 40); /* Ack */ - CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.dst_wmd) == 32); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.dst_wmd) == 16); - CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.match_bits) == 48); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.match_bits) == 8); - CLASSERT((int)offsetof(lnet_hdr_t, msg.ack.mlength) == 56); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.ack.mlength) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, msg.ack.dst_wmd) == 32); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.ack.dst_wmd) == 16); + CLASSERT((int)offsetof(struct lnet_hdr, msg.ack.match_bits) == 48); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.ack.match_bits) == 8); + CLASSERT((int)offsetof(struct lnet_hdr, msg.ack.mlength) == 56); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.ack.mlength) == 4); /* Put */ - CLASSERT((int)offsetof(lnet_hdr_t, msg.put.ack_wmd) == 32); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.ack_wmd) == 16); - CLASSERT((int)offsetof(lnet_hdr_t, msg.put.match_bits) == 48); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.match_bits) == 8); - CLASSERT((int)offsetof(lnet_hdr_t, msg.put.hdr_data) == 56); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.hdr_data) == 8); - CLASSERT((int)offsetof(lnet_hdr_t, msg.put.ptl_index) == 64); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.ptl_index) == 4); - CLASSERT((int)offsetof(lnet_hdr_t, msg.put.offset) == 68); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.put.offset) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, msg.put.ack_wmd) == 32); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.ack_wmd) == 16); + CLASSERT((int)offsetof(struct lnet_hdr, msg.put.match_bits) == 48); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.match_bits) == 8); + CLASSERT((int)offsetof(struct lnet_hdr, msg.put.hdr_data) == 56); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.hdr_data) == 8); + CLASSERT((int)offsetof(struct lnet_hdr, msg.put.ptl_index) == 64); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.ptl_index) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, msg.put.offset) == 68); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.offset) == 4); /* Get */ - CLASSERT((int)offsetof(lnet_hdr_t, msg.get.return_wmd) == 32); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.return_wmd) == 16); - CLASSERT((int)offsetof(lnet_hdr_t, msg.get.match_bits) == 48); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.match_bits) == 8); - CLASSERT((int)offsetof(lnet_hdr_t, msg.get.ptl_index) == 56); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.ptl_index) == 4); - CLASSERT((int)offsetof(lnet_hdr_t, msg.get.src_offset) == 60); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.src_offset) == 4); - CLASSERT((int)offsetof(lnet_hdr_t, msg.get.sink_length) == 64); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.get.sink_length) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, msg.get.return_wmd) == 32); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.return_wmd) == 16); + CLASSERT((int)offsetof(struct lnet_hdr, msg.get.match_bits) == 48); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.match_bits) == 8); + CLASSERT((int)offsetof(struct lnet_hdr, msg.get.ptl_index) == 56); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.ptl_index) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, msg.get.src_offset) == 60); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.src_offset) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, msg.get.sink_length) == 64); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.sink_length) == 4); /* Reply */ - CLASSERT((int)offsetof(lnet_hdr_t, msg.reply.dst_wmd) == 32); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.reply.dst_wmd) == 16); + CLASSERT((int)offsetof(struct lnet_hdr, msg.reply.dst_wmd) == 32); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.reply.dst_wmd) == 16); /* Hello */ - CLASSERT((int)offsetof(lnet_hdr_t, msg.hello.incarnation) == 32); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.hello.incarnation) == 8); - CLASSERT((int)offsetof(lnet_hdr_t, msg.hello.type) == 40); - CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.hello.type) == 4); + CLASSERT((int)offsetof(struct lnet_hdr, msg.hello.incarnation) == 32); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.hello.incarnation) == 8); + CLASSERT((int)offsetof(struct lnet_hdr, msg.hello.type) == 40); + CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.hello.type) == 4); } static lnd_t * diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 595fde8..6b0be6c 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -641,7 +641,7 @@ !list_empty(&lp->lp_txq)); msg->msg_peertxcredit = 1; - lp->lp_txqnob += msg->msg_len + sizeof(lnet_hdr_t); + lp->lp_txqnob += msg->msg_len + sizeof(struct lnet_hdr); lp->lp_txcredits--; if (lp->lp_txcredits < lp->lp_mintxcredits) @@ -811,7 +811,7 @@ LASSERT((txpeer->lp_txcredits < 0) == !list_empty(&txpeer->lp_txq)); - txpeer->lp_txqnob -= msg->msg_len + sizeof(lnet_hdr_t); + txpeer->lp_txqnob -= msg->msg_len + sizeof(struct lnet_hdr); LASSERT(txpeer->lp_txqnob >= 0); txpeer->lp_txcredits++; @@ -1245,7 +1245,7 @@ static void lnet_recv_put(lnet_ni_t *ni, lnet_msg_t *msg) { - lnet_hdr_t *hdr = &msg->msg_hdr; + struct lnet_hdr *hdr = &msg->msg_hdr; if (msg->msg_wanted) lnet_setpayloadbuffer(msg); @@ -1266,7 +1266,7 @@ static int lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg) { - lnet_hdr_t *hdr = &msg->msg_hdr; + struct lnet_hdr *hdr = &msg->msg_hdr; struct lnet_match_info info; bool ready_delay; int rc; @@ -1325,7 +1325,7 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get) { struct lnet_match_info info; - lnet_hdr_t *hdr = &msg->msg_hdr; + struct lnet_hdr *hdr = &msg->msg_hdr; struct lnet_handle_wire reply_wmd; int rc; @@ -1389,7 +1389,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg) { void *private = msg->msg_private; - lnet_hdr_t *hdr = &msg->msg_hdr; + struct lnet_hdr *hdr = &msg->msg_hdr; lnet_process_id_t src = {0}; lnet_libmd_t *md; int rlength; @@ -1453,7 +1453,7 @@ static int lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg) { - lnet_hdr_t *hdr = &msg->msg_hdr; + struct lnet_hdr *hdr = &msg->msg_hdr; lnet_process_id_t src = {0}; lnet_libmd_t *md; int cpt; @@ -1576,7 +1576,7 @@ } void -lnet_print_hdr(lnet_hdr_t *hdr) +lnet_print_hdr(struct lnet_hdr *hdr) { lnet_process_id_t src = {0}; lnet_process_id_t dst = {0}; @@ -1634,7 +1634,7 @@ } int -lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, +lnet_parse(lnet_ni_t *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid, void *private, int rdma_req) { int rc = 0; diff --git a/drivers/staging/lustre/lnet/lnet/lib-msg.c b/drivers/staging/lustre/lnet/lnet/lib-msg.c index 1262616..7ee164e 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-msg.c +++ b/drivers/staging/lustre/lnet/lnet/lib-msg.c @@ -56,7 +56,7 @@ void lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type) { - lnet_hdr_t *hdr = &msg->msg_hdr; + struct lnet_hdr *hdr = &msg->msg_hdr; lnet_event_t *ev = &msg->msg_ev; LASSERT(!msg->msg_routing); diff --git a/drivers/staging/lustre/lnet/lnet/lib-ptl.c b/drivers/staging/lustre/lnet/lnet/lib-ptl.c index 3947e8b..fa515af 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-ptl.c +++ b/drivers/staging/lustre/lnet/lnet/lib-ptl.c @@ -680,7 +680,7 @@ struct list_head * again: list_for_each_entry_safe(msg, tmp, head, msg_list) { struct lnet_match_info info; - lnet_hdr_t *hdr; + struct lnet_hdr *hdr; int rc; LASSERT(msg->msg_rx_delayed || head == &ptl->ptl_msg_stealing); diff --git a/drivers/staging/lustre/lnet/lnet/net_fault.c b/drivers/staging/lustre/lnet/lnet/net_fault.c index e4aceb7..bb6e457 100644 --- a/drivers/staging/lustre/lnet/lnet/net_fault.c +++ b/drivers/staging/lustre/lnet/lnet/net_fault.c @@ -349,7 +349,7 @@ struct lnet_drop_rule { * Check if message from \a src to \a dst can match any existed drop rule */ bool -lnet_drop_rule_match(lnet_hdr_t *hdr) +lnet_drop_rule_match(struct lnet_hdr *hdr) { struct lnet_drop_rule *rule; lnet_nid_t src = le64_to_cpu(hdr->src_nid); @@ -530,7 +530,7 @@ struct delay_daemon_data { * will be delayed if there is a match. */ bool -lnet_delay_rule_match_locked(lnet_hdr_t *hdr, struct lnet_msg *msg) +lnet_delay_rule_match_locked(struct lnet_hdr *hdr, struct lnet_msg *msg) { struct lnet_delay_rule *rule; lnet_nid_t src = le64_to_cpu(hdr->src_nid); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 22 00:40:27 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:27 -0500 Subject: [lustre-devel] [PATCH 3/8] staging: lustre: lnet: change lnet_ni_status_t to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485045632-5886-4-git-send-email-jsimmons@infradead.org> Change lnet_ni_status_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lib-types.h | 2 +- drivers/staging/lustre/include/linux/lnet/types.h | 6 +++--- drivers/staging/lustre/lnet/lnet/api-ni.c | 2 +- drivers/staging/lustre/lnet/lnet/router.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index a1957b1..942549b 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -270,7 +270,7 @@ struct lnet_tx_queue { struct lnet_tx_queue **ni_tx_queues; /* percpt TX queues */ int **ni_refs; /* percpt reference count */ time64_t ni_last_alive;/* when I was last alive */ - lnet_ni_status_t *ni_status; /* my health status */ + struct lnet_ni_status *ni_status; /* my health status */ /* per NI LND tunables */ struct lnet_ioctl_config_lnd_tunables *ni_lnd_tunables; /* equivalent interfaces to use */ diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 0c5d84e..405bbc6 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -236,18 +236,18 @@ struct lnet_handle_wire { #define LNET_PROTO_ACCEPTOR_VERSION 1 -typedef struct { +struct lnet_ni_status { lnet_nid_t ns_nid; __u32 ns_status; __u32 ns_unused; -} WIRE_ATTR lnet_ni_status_t; +} WIRE_ATTR; struct lnet_ping_info { __u32 pi_magic; __u32 pi_features; lnet_pid_t pi_pid; __u32 pi_nnis; - lnet_ni_status_t pi_ni[0]; + struct lnet_ni_status pi_ni[0]; } WIRE_ATTR; typedef struct lnet_counters { diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index ae388b2..3b2488f 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -981,7 +981,7 @@ static void lnet_assert_wire_constants(void) static void lnet_ping_info_install_locked(struct lnet_ping_info *ping_info) { - lnet_ni_status_t *ns; + struct lnet_ni_status *ns; lnet_ni_t *ni; int i = 0; diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 269b5e7..cf22525 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -624,7 +624,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) lnet_swap_pinginfo(struct lnet_ping_info *info) { int i; - lnet_ni_status_t *stat; + struct lnet_ni_status *stat; __swab32s(&info->pi_magic); __swab32s(&info->pi_features); @@ -683,7 +683,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) } for (i = 0; i < info->pi_nnis && i < LNET_MAX_RTR_NIS; i++) { - lnet_ni_status_t *stat = &info->pi_ni[i]; + struct lnet_ni_status *stat = &info->pi_ni[i]; lnet_nid_t nid = stat->ns_nid; if (nid == LNET_NID_ANY) { -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 22 00:40:30 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:30 -0500 Subject: [lustre-devel] [PATCH 6/8] staging: lustre: lnet: change lnet_magicversion_t to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485045632-5886-7-git-send-email-jsimmons@infradead.org> Change lnet_magicversion_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/types.h | 4 ++-- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 4 ++-- .../staging/lustre/lnet/klnds/socklnd/socklnd_proto.c | 6 +++--- drivers/staging/lustre/lnet/lnet/api-ni.c | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index c14015a..a6233be 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -204,11 +204,11 @@ struct lnet_handle_wire { * exchange HELLO messages when a connection is first established. Individual * LNDs can put whatever else they fancy in lnet_hdr_t::msg. */ -typedef struct { +struct lnet_magicversion { __u32 magic; /* LNET_PROTO_TCP_MAGIC */ __u16 version_major; /* increment on incompatible change */ __u16 version_minor; /* increment on compatible change */ -} WIRE_ATTR lnet_magicversion_t; +} WIRE_ATTR; /* PROTO MAGIC for LNDs */ #define LNET_PROTO_IB_MAGIC 0x0be91b91 diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 972f609..42b67b0 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -1656,9 +1656,9 @@ void ksocknal_write_callback(struct ksock_conn *conn) } if (hello->kshm_magic == le32_to_cpu(LNET_PROTO_TCP_MAGIC)) { - lnet_magicversion_t *hmv = (lnet_magicversion_t *)hello; + struct lnet_magicversion *hmv = (struct lnet_magicversion *)hello; - CLASSERT(sizeof(lnet_magicversion_t) == + CLASSERT(sizeof(struct lnet_magicversion) == offsetof(ksock_hello_msg_t, kshm_src_nid)); if (hmv->version_major == cpu_to_le16(KSOCK_PROTO_V1_MAJOR) && diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c index 8f0ff6c..420597b 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c @@ -460,11 +460,11 @@ { struct socket *sock = conn->ksnc_sock; lnet_hdr_t *hdr; - lnet_magicversion_t *hmv; + struct lnet_magicversion *hmv; int rc; int i; - CLASSERT(sizeof(lnet_magicversion_t) == offsetof(lnet_hdr_t, src_nid)); + CLASSERT(sizeof(struct lnet_magicversion) == offsetof(lnet_hdr_t, src_nid)); LIBCFS_ALLOC(hdr, sizeof(*hdr)); if (!hdr) { @@ -472,7 +472,7 @@ return -ENOMEM; } - hmv = (lnet_magicversion_t *)&hdr->dest_nid; + hmv = (struct lnet_magicversion *)&hdr->dest_nid; /* * Re-organize V2.x message header to V1.x (lnet_hdr_t) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 3b2488f..fd4153b 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -196,14 +196,14 @@ static void lnet_assert_wire_constants(void) CLASSERT((int)offsetof(struct lnet_handle_wire, wh_object_cookie) == 8); CLASSERT((int)sizeof(((struct lnet_handle_wire *)0)->wh_object_cookie) == 8); - /* Checks for struct lnet_magicversion_t */ - CLASSERT((int)sizeof(lnet_magicversion_t) == 8); - CLASSERT((int)offsetof(lnet_magicversion_t, magic) == 0); - CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->magic) == 4); - CLASSERT((int)offsetof(lnet_magicversion_t, version_major) == 4); - CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->version_major) == 2); - CLASSERT((int)offsetof(lnet_magicversion_t, version_minor) == 6); - CLASSERT((int)sizeof(((lnet_magicversion_t *)0)->version_minor) == 2); + /* Checks for struct struct lnet_magicversion */ + CLASSERT((int)sizeof(struct lnet_magicversion) == 8); + CLASSERT((int)offsetof(struct lnet_magicversion, magic) == 0); + CLASSERT((int)sizeof(((struct lnet_magicversion *)0)->magic) == 4); + CLASSERT((int)offsetof(struct lnet_magicversion, version_major) == 4); + CLASSERT((int)sizeof(((struct lnet_magicversion *)0)->version_major) == 2); + CLASSERT((int)offsetof(struct lnet_magicversion, version_minor) == 6); + CLASSERT((int)sizeof(((struct lnet_magicversion *)0)->version_minor) == 2); /* Checks for struct lnet_hdr_t */ CLASSERT((int)sizeof(lnet_hdr_t) == 72); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 22 00:40:32 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:32 -0500 Subject: [lustre-devel] [PATCH 8/8] staging: lustre: lnet: change msg union in struct lnet_hdr to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485045632-5886-9-git-send-email-jsimmons@infradead.org> Modify all the msg union fields from typedefs to to proper structures. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/types.h | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 1448fa4..1c8de72 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -146,36 +146,36 @@ struct lnet_handle_wire { * wire structs MUST be fixed size and the smaller types are placed at the * end. */ -typedef struct lnet_ack { +struct lnet_ack { struct lnet_handle_wire dst_wmd; __u64 match_bits; __u32 mlength; -} WIRE_ATTR lnet_ack_t; +} WIRE_ATTR; -typedef struct lnet_put { +struct lnet_put { struct lnet_handle_wire ack_wmd; __u64 match_bits; __u64 hdr_data; __u32 ptl_index; __u32 offset; -} WIRE_ATTR lnet_put_t; +} WIRE_ATTR; -typedef struct lnet_get { +struct lnet_get { struct lnet_handle_wire return_wmd; __u64 match_bits; __u32 ptl_index; __u32 src_offset; __u32 sink_length; -} WIRE_ATTR lnet_get_t; +} WIRE_ATTR; -typedef struct lnet_reply { +struct lnet_reply { struct lnet_handle_wire dst_wmd; -} WIRE_ATTR lnet_reply_t; +} WIRE_ATTR; -typedef struct lnet_hello { +struct lnet_hello { __u64 incarnation; __u32 type; -} WIRE_ATTR lnet_hello_t; +} WIRE_ATTR; struct lnet_hdr { lnet_nid_t dest_nid; @@ -186,11 +186,11 @@ struct lnet_hdr { __u32 payload_length; /* payload data to follow */ /*<------__u64 aligned------->*/ union { - lnet_ack_t ack; - lnet_put_t put; - lnet_get_t get; - lnet_reply_t reply; - lnet_hello_t hello; + struct lnet_ack ack; + struct lnet_put put; + struct lnet_get get; + struct lnet_reply reply; + struct lnet_hello hello; } msg; } WIRE_ATTR; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 22 00:40:26 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:26 -0500 Subject: [lustre-devel] [PATCH 2/8] staging: lustre: lnet: change lnet_ping_info_t to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485045632-5886-3-git-send-email-jsimmons@infradead.org> Change lnet_ping_info_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 2 +- .../staging/lustre/include/linux/lnet/lib-types.h | 6 ++-- drivers/staging/lustre/include/linux/lnet/types.h | 4 +-- drivers/staging/lustre/lnet/lnet/api-ni.c | 42 +++++++++++----------- drivers/staging/lustre/lnet/lnet/router.c | 6 ++-- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 363342f..8f164a9 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -664,7 +664,7 @@ int lnet_sock_connect(struct socket **sockp, int *fatal, int lnet_router_checker_start(void); void lnet_router_checker_stop(void); void lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net); -void lnet_swap_pinginfo(lnet_ping_info_t *info); +void lnet_swap_pinginfo(struct lnet_ping_info *info); int lnet_parse_ip2nets(char **networksp, char *ip2nets); int lnet_parse_routes(char *route_str, int *im_a_router); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index b84a5bb..a1957b1 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -295,13 +295,13 @@ struct lnet_tx_queue { /* router checker data, per router */ #define LNET_MAX_RTR_NIS 16 -#define LNET_PINGINFO_SIZE offsetof(lnet_ping_info_t, pi_ni[LNET_MAX_RTR_NIS]) +#define LNET_PINGINFO_SIZE offsetof(struct lnet_ping_info, pi_ni[LNET_MAX_RTR_NIS]) typedef struct { /* chain on the_lnet.ln_zombie_rcd or ln_deathrow_rcd */ struct list_head rcd_list; lnet_handle_md_t rcd_mdh; /* ping buffer MD */ struct lnet_peer *rcd_gateway; /* reference to gateway */ - lnet_ping_info_t *rcd_pinginfo; /* ping buffer */ + struct lnet_ping_info *rcd_pinginfo; /* ping buffer */ } lnet_rc_data_t; typedef struct lnet_peer { @@ -599,7 +599,7 @@ struct lnet_msg_container { lnet_handle_md_t ln_ping_target_md; lnet_handle_eq_t ln_ping_target_eq; - lnet_ping_info_t *ln_ping_info; + struct lnet_ping_info *ln_ping_info; /* router checker startup/shutdown state */ int ln_rc_state; diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 1787089..0c5d84e 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -242,13 +242,13 @@ struct lnet_handle_wire { __u32 ns_unused; } WIRE_ATTR lnet_ni_status_t; -typedef struct { +struct lnet_ping_info { __u32 pi_magic; __u32 pi_features; lnet_pid_t pi_pid; __u32 pi_nnis; lnet_ni_status_t pi_ni[0]; -} WIRE_ATTR lnet_ping_info_t; +} WIRE_ATTR; typedef struct lnet_counters { __u32 msgs_alloc; diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 3a7788c..ae388b2 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -822,13 +822,13 @@ static void lnet_assert_wire_constants(void) return count; } -static lnet_ping_info_t * +static struct lnet_ping_info * lnet_ping_info_create(int num_ni) { - lnet_ping_info_t *ping_info; + struct lnet_ping_info *ping_info; unsigned int infosz; - infosz = offsetof(lnet_ping_info_t, pi_ni[num_ni]); + infosz = offsetof(struct lnet_ping_info, pi_ni[num_ni]); LIBCFS_ALLOC(ping_info, infosz); if (!ping_info) { CERROR("Can't allocate ping info[%d]\n", num_ni); @@ -860,10 +860,10 @@ static void lnet_assert_wire_constants(void) } static inline void -lnet_ping_info_free(lnet_ping_info_t *pinfo) +lnet_ping_info_free(struct lnet_ping_info *pinfo) { LIBCFS_FREE(pinfo, - offsetof(lnet_ping_info_t, + offsetof(struct lnet_ping_info, pi_ni[pinfo->pi_nnis])); } @@ -889,14 +889,14 @@ static void lnet_assert_wire_constants(void) static void lnet_ping_event_handler(lnet_event_t *event) { - lnet_ping_info_t *pinfo = event->md.user_ptr; + struct lnet_ping_info *pinfo = event->md.user_ptr; if (event->unlinked) pinfo->pi_features = LNET_PING_FEAT_INVAL; } static int -lnet_ping_info_setup(lnet_ping_info_t **ppinfo, lnet_handle_md_t *md_handle, +lnet_ping_info_setup(struct lnet_ping_info **ppinfo, lnet_handle_md_t *md_handle, int ni_count, bool set_eq) { lnet_process_id_t id = {LNET_NID_ANY, LNET_PID_ANY}; @@ -930,7 +930,7 @@ static void lnet_assert_wire_constants(void) /* initialize md content */ md.start = *ppinfo; - md.length = offsetof(lnet_ping_info_t, + md.length = offsetof(struct lnet_ping_info, pi_ni[(*ppinfo)->pi_nnis]); md.threshold = LNET_MD_THRESH_INF; md.max_size = 0; @@ -961,7 +961,7 @@ static void lnet_assert_wire_constants(void) } static void -lnet_ping_md_unlink(lnet_ping_info_t *pinfo, lnet_handle_md_t *md_handle) +lnet_ping_md_unlink(struct lnet_ping_info *pinfo, lnet_handle_md_t *md_handle) { sigset_t blocked = cfs_block_allsigs(); @@ -979,7 +979,7 @@ static void lnet_assert_wire_constants(void) } static void -lnet_ping_info_install_locked(lnet_ping_info_t *ping_info) +lnet_ping_info_install_locked(struct lnet_ping_info *ping_info) { lnet_ni_status_t *ns; lnet_ni_t *ni; @@ -1003,9 +1003,9 @@ static void lnet_assert_wire_constants(void) } static void -lnet_ping_target_update(lnet_ping_info_t *pinfo, lnet_handle_md_t md_handle) +lnet_ping_target_update(struct lnet_ping_info *pinfo, lnet_handle_md_t md_handle) { - lnet_ping_info_t *old_pinfo = NULL; + struct lnet_ping_info *old_pinfo = NULL; lnet_handle_md_t old_md; /* switch the NIs to point to the new ping info created */ @@ -1496,7 +1496,7 @@ void lnet_lib_exit(void) int im_a_router = 0; int rc; int ni_count; - lnet_ping_info_t *pinfo; + struct lnet_ping_info *pinfo; lnet_handle_md_t md_handle; struct list_head net_head; @@ -1754,7 +1754,7 @@ void lnet_lib_exit(void) lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *conf) { char *nets = conf->cfg_config_u.cfg_net.net_intf; - lnet_ping_info_t *pinfo; + struct lnet_ping_info *pinfo; lnet_handle_md_t md_handle; struct lnet_ni *ni; struct list_head net_head; @@ -1834,7 +1834,7 @@ void lnet_lib_exit(void) lnet_dyn_del_ni(__u32 net) { lnet_ni_t *ni; - lnet_ping_info_t *pinfo; + struct lnet_ping_info *pinfo; lnet_handle_md_t md_handle; int rc; @@ -2147,7 +2147,7 @@ static int lnet_ping(lnet_process_id_t id, int timeout_ms, int replied = 0; const int a_long_time = 60000; /* mS */ int infosz; - lnet_ping_info_t *info; + struct lnet_ping_info *info; lnet_process_id_t tmpid; int i; int nob; @@ -2155,7 +2155,7 @@ static int lnet_ping(lnet_process_id_t id, int timeout_ms, int rc2; sigset_t blocked; - infosz = offsetof(lnet_ping_info_t, pi_ni[n_ids]); + infosz = offsetof(struct lnet_ping_info, pi_ni[n_ids]); if (n_ids <= 0 || id.nid == LNET_NID_ANY || @@ -2283,18 +2283,18 @@ static int lnet_ping(lnet_process_id_t id, int timeout_ms, goto out_1; } - if (nob < offsetof(lnet_ping_info_t, pi_ni[0])) { + if (nob < offsetof(struct lnet_ping_info, pi_ni[0])) { CERROR("%s: Short reply %d(%d min)\n", libcfs_id2str(id), - nob, (int)offsetof(lnet_ping_info_t, pi_ni[0])); + nob, (int)offsetof(struct lnet_ping_info, pi_ni[0])); goto out_1; } if (info->pi_nnis < n_ids) n_ids = info->pi_nnis; - if (nob < offsetof(lnet_ping_info_t, pi_ni[n_ids])) { + if (nob < offsetof(struct lnet_ping_info, pi_ni[n_ids])) { CERROR("%s: Short reply %d(%d expected)\n", libcfs_id2str(id), - nob, (int)offsetof(lnet_ping_info_t, pi_ni[n_ids])); + nob, (int)offsetof(struct lnet_ping_info, pi_ni[n_ids])); goto out_1; } diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 8afa0ab..269b5e7 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -621,7 +621,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) } void -lnet_swap_pinginfo(lnet_ping_info_t *info) +lnet_swap_pinginfo(struct lnet_ping_info *info) { int i; lnet_ni_status_t *stat; @@ -644,7 +644,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) static void lnet_parse_rc_info(lnet_rc_data_t *rcd) { - lnet_ping_info_t *info = rcd->rcd_pinginfo; + struct lnet_ping_info *info = rcd->rcd_pinginfo; struct lnet_peer *gw = rcd->rcd_gateway; lnet_route_t *rte; @@ -902,7 +902,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) lnet_create_rc_data_locked(lnet_peer_t *gateway) { lnet_rc_data_t *rcd = NULL; - lnet_ping_info_t *pi; + struct lnet_ping_info *pi; lnet_md_t md; int rc; int i; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 22 00:40:29 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 21 Jan 2017 19:40:29 -0500 Subject: [lustre-devel] [PATCH 5/8] staging: lustre: lnet: change lnet_acceptor_connreq_t to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485045632-5886-6-git-send-email-jsimmons@infradead.org> Change lnet_acceptor_connreq_t from typedef to proper structure. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/24566 Reviewed-by: Doug Oucharek Reviewed-by: Olaf Weber Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/types.h | 4 ++-- drivers/staging/lustre/lnet/lnet/acceptor.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 3c3b6676..c14015a 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -228,11 +228,11 @@ struct lnet_handle_wire { #define LNET_PROTO_TCP_VERSION_MINOR 0 /* Acceptor connection request */ -typedef struct { +struct lnet_acceptor_connreq { __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */ __u32 acr_version; /* protocol version */ __u64 acr_nid; /* target NID */ -} WIRE_ATTR lnet_acceptor_connreq_t; +} WIRE_ATTR; #define LNET_PROTO_ACCEPTOR_VERSION 1 diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 8c50c99..a55c6cd 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -143,7 +143,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, __u32 local_ip, __u32 peer_ip, int peer_port) { - lnet_acceptor_connreq_t cr; + struct lnet_acceptor_connreq cr; struct socket *sock; int rc; int port; @@ -206,7 +206,7 @@ static int lnet_accept(struct socket *sock, __u32 magic) { - lnet_acceptor_connreq_t cr; + struct lnet_acceptor_connreq cr; __u32 peer_ip; int peer_port; int rc; @@ -284,7 +284,7 @@ rc = lnet_sock_read(sock, &cr.acr_nid, sizeof(cr) - - offsetof(lnet_acceptor_connreq_t, acr_nid), + offsetof(struct lnet_acceptor_connreq, acr_nid), accept_timeout); if (rc) { CERROR("Error %d reading connection request from %pI4h\n", -- 1.8.3.1 From kaiserj at uni-mainz.de Mon Jan 23 09:28:27 2017 From: kaiserj at uni-mainz.de (=?utf-8?Q?J=C3=BCrgen_Kaiser?=) Date: Mon, 23 Jan 2017 10:28:27 +0100 Subject: [lustre-devel] Quality of Service Planning in Lustre In-Reply-To: <1B2C98C4BC048747A2EA06A5FF0D0C76B585D13F@LAX-EX-MB3.datadirect.datadirectnet.com> References: <6A9C4AF6-5F51-4DFB-9CC0-0FFC4CEFC49B@intel.com> <1B2C98C4BC048747A2EA06A5FF0D0C76B585D13F@LAX-EX-MB3.datadirect.datadirectnet.com> Message-ID: <234EF2EA-8559-40CA-8085-CD274EC45422@uni-mainz.de> Hi, > Am 19.01.2017 um 04:44 schrieb Li Xi : > > Hi, > > Glad to hear from you, Andreas. > >> I think there is an open question about what sort of granularity of I/O bandwidth an application needs in order to do its job. I think the main goal of the user is to avoid having their job contend with another large job that is consuming all of the bandwidth for a long period of time, but they don't necessarily need real-time I/O guarantees. At the same time, from process scheduling on CPUs we know the most globally efficient scheduling algorithm is "shortest job first", so that small jobs can complete their I/O quickly and return to computation, while the large job is going to take a long time in either case. > > I agree that real-time bandwidth guarantees might not be necessary in some (maybe most) circumstances. But these circumstances have some preconditions or assumptions. And I think the possible assumptions are: 1) Jobs have the same priority and can be scheduled as needed ; 2) The jobs are queued and waiting the scheduling of QoSP & Slurm; 3) The ultimate goal is to get highest throughput of jobs, i.e. to maximize the sum of the weights of the finished jobs. > > However, these assumptions might not always be ture, for example. > > 1) Jobs have the same priority can be scheduled as needed -> A job has extermely high priority because the user need to finish it before a deadline otherwise he/she will be fired. > > 2) The jobs are queued and waiting the scheduling of QoSP & Slurm -> A user happens to lose his/her sleep in the midnight and starts a huge job. > > 3) The ultimate goal is to get highest throughput of jobs -> A user complains a lot because he submits a huge job but need to wait after a massive of small jobs. > > Under these circumstance, a real-time performance guarantees is more friendly to the users, since the behaviors and results are more predictable. And another advantage is that the administrator could charge the users according to the QoS guarantees. That means, if a user is not satisfied with the current guarantees, he/she can pay more for better guarantees. > Agreed. However, we see bandwidth guarantees as a long-term (research) goal. As an intermediate step, the QoSP should help to prevent situations as Andreas described it: no two high bandwidth applications at the same time. >> It may be that instead of working on hard bandwidth guarantees (i.e job A needs 100MB/s, while job B needs 500MB/s), which is hard for users to determine (they want to get the maximum bandwidth all of the time?) it might be better to have jobs provide information about how large their I/O is going to be, and how often. That is something that users can determine quite easily from one run to the next, and would allow a global scheduler to know that job A wants to read 10 GB of files every 10 minutes, while job B wants to write 10TB of data every 60 minutes, and when job A starts its read it should preempt job B (if currently doing I/O) so it can complete all of its reads quickly and go back to work, and job B will still be writing that 10TB long after job A has finished. > > Ideally, users know clearly about how are the I/O patterns of the jobs, and also how much performance the jobs will need. Unfortunately, it seems difficult to understand/abstract/describe/predict the I/O patterns of the jobs, especially the jobs are parrallel applications. I think that the I/O pattern information provided by users might be helpful for rough estimation, but might not be accurate enough to make real-time QoS decisions. So, QoSP might need to monitor the I/O patterns in real time and make QoS decisions dynamically. > > Also, this gives us another reason why real-time bandwidth guarantees is helpful. Because if users are charged accorrding to the performance guarantees, users will have much more motivation to understand and optimize the I/O patterns. And hopefully, the bad I/O patterns (for example, unccessary 2GB/s write which last for one hour) will be eliminated eventually, which is good for everyone. > Besides charging for reserved resources, another incentive is the waiting time until the job scheduler allows the job to start. If a user wants 100% he/she must wait until every other job is finished. We already see this effect in case of CPUs. Since we allow multi-days jobs users typically must wait several days (sometimes even weeks) if they want that much resources. I agree that an I/O pattern would be better for us. However, I think that it is easier for users to work with bandwidth values instead of access patterns. Most of our users come from non computer science fields such as biology, physics, meteorology, etc. and typically lack knowledge about the access patterns. In the best case, they know the size of the input files and (from experience) the expected size of the output files. They also might know that the input is read only once and, therefore, (roughly) know the total volume of read/written data. With this information, they can estimate the reservation length of the required resources. However, in case of checkpointing the users should be able to tell Slurm/QoSP enough details. >> If the application provides the output directory for the new files, the number of files, and the size, the QoSP can have a very good idea of which OSTs will be used. In most cases, the number of files exceeds the OST count, or a single file will be striped across all OSTs so the I/O will be evenly balanced across OSTs and it doesn't matter what the exact file placement will be. If something like an OST pool is set on the directory, this can also be determined by "lfs getstripe" or llapi_layout_get_by_path() or similar. > > Yeah, it seems QoSP needs to a lot of things, including controlling the stripe of the files. > >> I think fine-grained scheduling of the I/O performance of every file in the filesystem is not necessary to achieve improvements in aggregate I/O performance across jobs. High-level prioritization of jobs is probably enough to gain the majority of performance improvements possible. For example, if the QoSP knows two jobs have similar I/O times during their busy period, and are contending for writes on OSTs then the first job to submit RPCs can have a short-term but significant boost in I/O priority so it can complete all of its I/O before the second job does. Even if the jobs do I/O at the same frequency (e.g. every 60 minutes) this would naturally offset the two jobs in time to avoid contention in the future. > > Agreed. Job might be a better granularity/graininess of I/O performance scheduling than file, since users care more about the time costs of jobs than writing/reading a file. Agreed. We see the fine-grained view as part of a long term research topic. > >> If the QoSP doesn't get any information about a job, it could potentially generate this dynamically from the job's previous I/O submissions (e.g. steady-state reader/writer of N MB/s, bursty every X seconds for Y GB, etc) to use it for later submissions and/or dump this in the job epilog so the user knows what information to submit for later test runs. > > Agreed. This needs a monitor & analyzer to extract the I/O pattern. Various types of monitoring systems have been developed for Lustre by different vendors, however we might need to put further work to them for I/O pattern abstract. A powerful quantitative method to discribe the I/O pattern needs to be designed. This method should be both understandable by human and computer. For example, something like following discription could be generated automatically after running a job: > > rank: 0, start second: 0, end second: 60, I/O type: exclusive read, total size 10GB, rank size: 10GB, file number: 1, exclusive, grain size: 1MB, comment: "Reading the input"; > rank: 1~100, start second: 0, end second: 60, I/O type: None, comment: "Waiting rank0"; > rank: 0~100, start second: 61, end second: 600, I/O type: None, comment: "Computing"; > rank: 0~100, start second: 601, end second: 660, I/O type: exclusive write, total size 1000GB, rank size: 10GB, file number: 100, grain size: 1MB, comment: "Writing the output"; > >> I suspect that even if the user is specifying the job I/O pattern explicitly, this should only be taken as "initial values" and the QoSP should determine what actual I/O pattern the job has (and report large discrepancies in the epilog). The I/O pattern may change significantly based on input parameters, changes to the system, etc. that make the user-provided data inaccurate. > > Yep, totoally agreed. Agreed > > Cheers, Andreas > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 1536 bytes Desc: Message signed with OpenPGP using GPGMail URL: From joe at perches.com Mon Jan 23 21:01:16 2017 From: joe at perches.com (Joe Perches) Date: Mon, 23 Jan 2017 13:01:16 -0800 Subject: [lustre-devel] [PATCH 0/8] staging: lustre: lnet: change wire protocol typedefs to proper structure In-Reply-To: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485205276.12563.30.camel@perches.com> On Sat, 2017-01-21 at 19:40 -0500, James Simmons wrote: > The upstream kernel requires proper structures so > convert nearly all the LNet wire protocols typedefs in > the LNet core. Thanks. Perhaps s/\bWIRE_ATTR\b/__packed/g one day too From oleg.drokin at intel.com Tue Jan 24 05:29:21 2017 From: oleg.drokin at intel.com (Oleg Drokin) Date: Tue, 24 Jan 2017 00:29:21 -0500 Subject: [lustre-devel] new tag 2.9.52 Message-ID: <2EE5D2FA-F770-4302-92EC-2C75FBBC85B2@intel.com> Hello! I have just tagged 2.9.52 in the lustre master development branch. Changelog: Abrarahmed Momin (1): LU-8732 tests: lnet-selftest Error inserting modules Aditya Pandit (1): LU-7471 tests: Modified make_custom_file_for_progress fn Amitoj Kaur Chawla (1): LU-4423 libcfs: Use swap() in cfs_hash_bd_order() Andreas Dilger (1): LU-3764 tests: clean up sanity test_116a code style Arnd Bergmann (11): LU-4423 libcfs: use 64-bit inode timestamps internally LU-4423 libcfs: tracefile document seconds overflow LU-4423 ldlm: use time64_t for l_last_activity LU-4423 ptlrpc: use 64-bit time for adaptive timeout LU-4423 libcfs: use 64-bit times for cfs_srand seed LU-4423 lnet: use 64-bit time for selftest LU-4423 ptlrpc: use 64-bit times for ptlrpc sec expiry LU-4423 obd: use ktime_t for calculating elapsed time LU-4423 ldlm: use 64-bit time for pl_recalc LU-4423 ptlrpc: use 64-bit times in ptlrpc_enc_page_pool LU-4423 ptlrpc: use 64-bit times for ptlrpc_sec Ben Evans (1): LU-6401 headers: move lu_fid, ost_id funcs out of lustre_idl.h Bob Glossman (3): LU-8965 kernel: kernel update [SLES11 SP4 3.0.101-91] LU-8871 kernel: kernel upgrade [SLES12 SP2 4.4.21-84] LU-8996 kernel: kernel update RHEL6.8 [2.6.32-642.13.1.el6] Di Wang (4): LU-8922 lod: check master stripes properly LU-8753 llog: remove lgh_write_offset LU-8753 osp: add rpc generation LU-8994 lmv: honour the specified stripe index Dmitry Eremin (3): LU-8889 llite: replace memory allocation with ll_env usage LU-8703 libcfs: remove usless CPU partition code LU-8710 ptlrpc: use current CPU instead of harcoded 0 Doug Oucharek (1): LU-8752 lnet: Stop MLX5 triggering a dump_cqe Elena Gryaznova (1): LU-8966 tests: rename sanity 39, 43, 44, 241 tests Emoly Liu (2): LU-8635 tests: Use wait_update to expire jobstats LU-8973 tests: in sanity 103a use $tdir instead of $MOUNT Fan Yong (6): LU-8569 linkea: linkEA size limitation LU-8569 lfsck: handle linkEA overflow LU-8288 lfsck: handle dangling LOV EA reference LU-8840 osp: handle EA cache properly LU-7429 tests: generate dangling name entry properly LU-8929 lfsck: dumper gets current position properly Gregoire Pichon (1): LU-8932 lnet: define new network driver ptl4lnd Hongchao Zhang (1): LU-7481 utils: label lustre device correctly James Nunez (1): Revert "LU-8922 lod: check master stripes properly" James Simmons (10): LU-6245 libcfs: add ktime_get_real_seconds support LU-6401 header: remove libcfs.h in interval_tree.h LU-8378 obd: move s3 in lmd_parse to inner loop LU-6142 lnet: change wire protocol typedefs to proper structure LU-8835 osc: handle 64 bit time properly in osc_cache_too_much LU-8945 ptlrpc : remove userland usage from ptlrpc LU-6142 lnet: code style cleanups, improve error handling LU-9019 lnet: simplify lnet_eq_wait_locked LU-6245 libcfs: remove wrappers for timer functions LU-9019 osd : remove struct timeval use in osd-ldiskfs Jinshan Xiong (2): LU-6854 llite: Do not set writeback for sync write pages LU-7812 tests: address race condition for sanity:120{e,f} John L. Hammond (2): LU-8821 mdt: avoid double find in mdt_path_current() LU-8855 llite: return small device numbers for compat stat() Lai Siyao (1): LU-8314 lfs: improve getdirstripe interface Ned Bass (1): LU-8562 osp: osp_precreate_thread gets stuck after disconnect Niu Yawei (1): LU-8765 ptlrpc: update replay cursor when close during replay Oleg Drokin (6): LU-8066 obd: Generic helpers for sysfs LU-8066 obd: Move /proc/fs/lustre root level files to sysfs LU-8066 obd: Add debugfs root LU-8066 obdclass: move lustre sysctl to sysfs LU-8587 utils: Fix incorrect indenting in llapi_hsm_log_ct_progress New tag 2.9.52 Patrick Farrell (1): LU-8926 llite: reduce jobstats race window Steve Guminski (10): LU-6210 snmp: Change positional struct initializers to C99 LU-6210 tests: Change positional struct initializers to C99 LU-6210 obd: Change positional struct initializers to C99 LU-6210 mdt: Change positional struct initializers to C99 LU-6210 ldlm: Change positional struct initializers to C99 LU-6210 osd: Change positional struct initializers to C99 LU-6210 fid: Change positional struct initializers to C99 LU-6210 mgs: Change positional struct initializers to C99 LU-6210 lod: Change positional struct initializers to C99 LU-4315 docs: Fix Makefile.am to have one man page per line Tina Ruchandani (1): LU-4423 lnet: Better cookie gen Yang Sheng (3): LU-8957 obdclass: fix exp_nid_hash race LU-8969 llite: sanity test_56x read failed: Invalid argument LU-7115 fld: don't retry for no LWP device From andreas.dilger at intel.com Tue Jan 24 22:22:08 2017 From: andreas.dilger at intel.com (Dilger, Andreas) Date: Tue, 24 Jan 2017 22:22:08 +0000 Subject: [lustre-devel] [PATCH 1/2] staging: lustre: libcfs: use octal permissions In-Reply-To: <20170124174050.6534-1-ernestas.kulik@gmail.com> References: <20170124174050.6534-1-ernestas.kulik@gmail.com> Message-ID: <715A0C57-2EE3-486E-A5DE-E372366B6BE8@intel.com> On Jan 24, 2017, at 09:40, Ernestas Kulik wrote: > > Using octal permissions instead of symbolic ones is preferred. Typically the reverse is true - using symbolic constants is preferred over numeric ones. Where does this recommendation come from? Cheers, Andreas > Signed-off-by: Ernestas Kulik > --- > drivers/staging/lustre/lnet/libcfs/module.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/lustre/lnet/libcfs/module.c b/drivers/staging/lustre/lnet/libcfs/module.c > index 161e04226521..c388550c2d10 100644 > --- a/drivers/staging/lustre/lnet/libcfs/module.c > +++ b/drivers/staging/lustre/lnet/libcfs/module.c > @@ -488,10 +488,10 @@ static const struct file_operations lnet_debugfs_file_operations_wo = { > > static const struct file_operations *lnet_debugfs_fops_select(umode_t mode) > { > - if (!(mode & S_IWUGO)) > + if (!(mode & 0222)) > return &lnet_debugfs_file_operations_ro; > > - if (!(mode & S_IRUGO)) > + if (!(mode & 0444)) > return &lnet_debugfs_file_operations_wo; > > return &lnet_debugfs_file_operations_rw; > -- > 2.11.0 > From joe at perches.com Wed Jan 25 02:23:37 2017 From: joe at perches.com (Joe Perches) Date: Tue, 24 Jan 2017 18:23:37 -0800 Subject: [lustre-devel] [PATCH 1/2] staging: lustre: libcfs: use octal permissions In-Reply-To: <715A0C57-2EE3-486E-A5DE-E372366B6BE8@intel.com> References: <20170124174050.6534-1-ernestas.kulik@gmail.com> <715A0C57-2EE3-486E-A5DE-E372366B6BE8@intel.com> Message-ID: <1485311017.12563.48.camel@perches.com> On Tue, 2017-01-24 at 22:22 +0000, Dilger, Andreas wrote: > On Jan 24, 2017, at 09:40, Ernestas Kulik wrote: > > > > Using octal permissions instead of symbolic ones is preferred. > > Typically the reverse is true - using symbolic constants is preferred over numeric ones. > Where does this recommendation come from? http://lkml.kernel.org/r/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ at mail.gmail.com which is: https://marc.info/?l=linux-arm-kernel&m=147017161402213&w=2 Subject: Please don't replace numeric parameter like 0444 with macro From: Linus Torvalds Date: 2016-08-02 20:58:29 [ So I answered similarly to another patch, but I'll just re-iterate and change the subject line so that it stands out a bit from the millions of actual patches ] On Tue, Aug 2, 2016 at 1:42 PM, Pavel Machek wrote: > > Everyone knows what 0644 is, but noone can read S_IRUSR | S_IWUSR | > S_IRCRP | S_IROTH (*). Please don't do this. Absolutely. It's *much* easier to parse and understand the octal numbers, while the symbolic macro names are just random line noise and hard as hell to understand. You really have to think about it. So we should rather go the other way: convert existing bad symbolic permission bit macro use to just use the octal numbers. The symbolic names are good for the *other* bits (ie sticky bit, and the inode mode _type_ numbers etc), but for the permission bits, the symbolic names are just insane crap. Nobody sane should ever use them. Not in the kernel, not in user space. From arnd at arndb.de Wed Jan 25 22:36:34 2017 From: arnd at arndb.de (Arnd Bergmann) Date: Wed, 25 Jan 2017 23:36:34 +0100 Subject: [lustre-devel] [PATCH] staging: lustre: ptlrpc: avoid warning on missing return Message-ID: <20170125223804.1479716-1-arnd@arndb.de> The newly added function triggers a harmless warning: drivers/staging/lustre/lustre/ptlrpc/pack_generic.c: In function 'lustre_shrink_msg': drivers/staging/lustre/lustre/ptlrpc/pack_generic.c:472:1: error: control reaches end of non-void function [-Werror=return-type] This probably happens because LASSERTF() contains an 'unlikely()' that sometimes prevents gcc from analysing the control flow correctly. Adding a return statement here seems harmless and lets us keep that unlikely(). Fixes: 96049bd1ecd0 ("staging: lustre: ptlrpc: embed highest XID in each request") Signed-off-by: Arnd Bergmann --- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 13f00b7cbbe5..b1170277fd84 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -469,6 +469,7 @@ int lustre_shrink_msg(struct lustre_msg *msg, int segment, default: LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic); } + return 0; } EXPORT_SYMBOL(lustre_shrink_msg); -- 2.9.0 From jsimmons at infradead.org Sun Jan 29 00:04:30 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:30 -0500 Subject: [lustre-devel] [PATCH 02/60] staging: lustre: statahead: drop support for remote entry In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-3-git-send-email-jsimmons@infradead.org> From: Lai Siyao This patch dropped support for remote entry statahead, because it needs 2 async RPCs to fetch both LOOKUP lock from parent MDT and UPDATE lock from client MDT, which is complicated. Plus not supporting remote entry statahead won't cause any issue. * pack child fid in statahead request. * lmv_intent_getattr_async() will compare parent and child MDT, if child is remote, return -ENOTSUPP. Signed-off-by: Lai Siyao Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6578 Reviewed-on: http://review.whamcloud.com/15767 Reviewed-by: Fan Yong Reviewed-by: wangdi Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 4 +- drivers/staging/lustre/lustre/include/obd_class.h | 5 +- drivers/staging/lustre/lustre/llite/statahead.c | 94 +++++++++-------------- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 30 ++++++-- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 3 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 16 +--- 6 files changed, 68 insertions(+), 84 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 6f0f5dd..7f0fc44 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -761,6 +761,7 @@ struct md_enqueue_info { struct lookup_intent mi_it; struct lustre_handle mi_lockh; struct inode *mi_dir; + struct ldlm_enqueue_info mi_einfo; int (*mi_cb)(struct ptlrpc_request *req, struct md_enqueue_info *minfo, int rc); void *mi_cbdata; @@ -978,8 +979,7 @@ struct md_ops { struct lu_fid *fid); int (*intent_getattr_async)(struct obd_export *, - struct md_enqueue_info *, - struct ldlm_enqueue_info *); + struct md_enqueue_info *); int (*revalidate_lock)(struct obd_export *, struct lookup_intent *, struct lu_fid *, __u64 *bits); diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 7ec2520..083a6ff 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -1444,14 +1444,13 @@ static inline int md_init_ea_size(struct obd_export *exp, u32 easize, } static inline int md_intent_getattr_async(struct obd_export *exp, - struct md_enqueue_info *minfo, - struct ldlm_enqueue_info *einfo) + struct md_enqueue_info *minfo) { int rc; EXP_CHECK_MD_OP(exp, intent_getattr_async); EXP_MD_COUNTER_INCREMENT(exp, intent_getattr_async); - rc = MDP(exp->exp_obd, intent_getattr_async)(exp, minfo, einfo); + rc = MDP(exp->exp_obd, intent_getattr_async)(exp, minfo); return rc; } diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index f1ee17f..fb7c315 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -79,6 +79,8 @@ struct sa_entry { struct inode *se_inode; /* entry name */ struct qstr se_qstr; + /* entry fid */ + struct lu_fid se_fid; }; static unsigned int sai_generation; @@ -169,7 +171,7 @@ static inline int is_omitted_entry(struct ll_statahead_info *sai, __u64 index) /* allocate sa_entry and hash it to allow scanner process to find it */ static struct sa_entry * sa_alloc(struct dentry *parent, struct ll_statahead_info *sai, __u64 index, - const char *name, int len) + const char *name, int len, const struct lu_fid *fid) { struct ll_inode_info *lli; struct sa_entry *entry; @@ -194,6 +196,7 @@ static inline int is_omitted_entry(struct ll_statahead_info *sai, __u64 index) entry->se_qstr.hash = full_name_hash(parent, name, len); entry->se_qstr.len = len; entry->se_qstr.name = dname; + entry->se_fid = *fid; lli = ll_i2info(sai->sai_dentry->d_inode); spin_lock(&lli->lli_sa_lock); @@ -566,24 +569,8 @@ static void sa_instantiate(struct ll_statahead_info *sai, } child = entry->se_inode; - if (!child) { - /* - * lookup. - */ - LASSERT(fid_is_zero(&minfo->mi_data.op_fid2)); - - /* XXX: No fid in reply, this is probably cross-ref case. - * SA can't handle it yet. - */ - if (body->mbo_valid & OBD_MD_MDS) { - rc = -EAGAIN; - goto out; - } - } else { - /* - * revalidate. - */ - /* unlinked and re-created with the same name */ + if (child) { + /* revalidate; unlinked and re-created with the same name */ if (unlikely(!lu_fid_eq(&minfo->mi_data.op_fid2, &body->mbo_fid1))) { entry->se_inode = NULL; iput(child); @@ -720,50 +707,42 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, } /* finish async stat RPC arguments */ -static void sa_fini_data(struct md_enqueue_info *minfo, - struct ldlm_enqueue_info *einfo) +static void sa_fini_data(struct md_enqueue_info *minfo) { - LASSERT(minfo && einfo); iput(minfo->mi_dir); kfree(minfo); - kfree(einfo); } /** * prepare arguments for async stat RPC. */ -static int sa_prep_data(struct inode *dir, struct inode *child, - struct sa_entry *entry, struct md_enqueue_info **pmi, - struct ldlm_enqueue_info **pei) +static struct md_enqueue_info * +sa_prep_data(struct inode *dir, struct inode *child, struct sa_entry *entry) { - const struct qstr *qstr = &entry->se_qstr; struct md_enqueue_info *minfo; struct ldlm_enqueue_info *einfo; struct md_op_data *op_data; - einfo = kzalloc(sizeof(*einfo), GFP_NOFS); - if (!einfo) - return -ENOMEM; - minfo = kzalloc(sizeof(*minfo), GFP_NOFS); - if (!minfo) { - kfree(einfo); - return -ENOMEM; - } + if (!minfo) + return ERR_PTR(-ENOMEM); - op_data = ll_prep_md_op_data(&minfo->mi_data, dir, child, qstr->name, - qstr->len, 0, LUSTRE_OPC_ANY, NULL); + op_data = ll_prep_md_op_data(&minfo->mi_data, dir, child, NULL, 0, 0, + LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) { - kfree(einfo); kfree(minfo); - return PTR_ERR(op_data); + return (struct md_enqueue_info *)op_data; } + if (!child) + op_data->op_fid2 = entry->se_fid; + minfo->mi_it.it_op = IT_GETATTR; minfo->mi_dir = igrab(dir); minfo->mi_cb = ll_statahead_interpret; minfo->mi_cbdata = entry; + einfo = &minfo->mi_einfo; einfo->ei_type = LDLM_IBITS; einfo->ei_mode = it_to_lock_mode(&minfo->mi_it); einfo->ei_cb_bl = ll_md_blocking_ast; @@ -771,26 +750,22 @@ static int sa_prep_data(struct inode *dir, struct inode *child, einfo->ei_cb_gl = NULL; einfo->ei_cbdata = NULL; - *pmi = minfo; - *pei = einfo; - - return 0; + return minfo; } /* async stat for file not found in dcache */ static int sa_lookup(struct inode *dir, struct sa_entry *entry) { struct md_enqueue_info *minfo; - struct ldlm_enqueue_info *einfo; int rc; - rc = sa_prep_data(dir, NULL, entry, &minfo, &einfo); - if (rc) - return rc; + minfo = sa_prep_data(dir, NULL, entry); + if (IS_ERR(minfo)) + return PTR_ERR(minfo); - rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo); + rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo); if (rc) - sa_fini_data(minfo, einfo); + sa_fini_data(minfo); return rc; } @@ -809,7 +784,6 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry, struct lookup_intent it = { .it_op = IT_GETATTR, .it_lock_handle = 0 }; struct md_enqueue_info *minfo; - struct ldlm_enqueue_info *einfo; int rc; if (unlikely(!inode)) @@ -827,25 +801,26 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry, return 1; } - rc = sa_prep_data(dir, inode, entry, &minfo, &einfo); - if (rc) { + minfo = sa_prep_data(dir, inode, entry); + if (IS_ERR(minfo)) { entry->se_inode = NULL; iput(inode); - return rc; + return PTR_ERR(minfo); } - rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo); + rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo); if (rc) { entry->se_inode = NULL; iput(inode); - sa_fini_data(minfo, einfo); + sa_fini_data(minfo); } return rc; } /* async stat for file with @name */ -static void sa_statahead(struct dentry *parent, const char *name, int len) +static void sa_statahead(struct dentry *parent, const char *name, int len, + const struct lu_fid *fid) { struct inode *dir = d_inode(parent); struct ll_inode_info *lli = ll_i2info(dir); @@ -854,7 +829,7 @@ static void sa_statahead(struct dentry *parent, const char *name, int len) struct sa_entry *entry; int rc; - entry = sa_alloc(parent, sai, sai->sai_index, name, len); + entry = sa_alloc(parent, sai, sai->sai_index, name, len, fid); if (IS_ERR(entry)) return; @@ -1043,6 +1018,7 @@ static int ll_statahead_thread(void *arg) for (ent = lu_dirent_start(dp); ent && thread_is_running(sa_thread) && !sa_low_hit(sai); ent = lu_dirent_next(ent)) { + struct lu_fid fid; __u64 hash; int namelen; char *name; @@ -1088,6 +1064,8 @@ static int ll_statahead_thread(void *arg) if (unlikely(++first == 1)) continue; + fid_le_to_cpu(&fid, &ent->lde_fid); + /* wait for spare statahead window */ do { l_wait_event(sa_thread->t_ctl_waitq, @@ -1117,7 +1095,7 @@ static int ll_statahead_thread(void *arg) } while (sa_sent_full(sai) && thread_is_running(sa_thread)); - sa_statahead(parent, name, namelen); + sa_statahead(parent, name, namelen, &fid); } pos = le64_to_cpu(dp->ldp_hash_end); diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 76a0306..6a3b83f 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -3012,24 +3012,40 @@ static int lmv_clear_open_replay_data(struct obd_export *exp, } static int lmv_intent_getattr_async(struct obd_export *exp, - struct md_enqueue_info *minfo, - struct ldlm_enqueue_info *einfo) + struct md_enqueue_info *minfo) { struct md_op_data *op_data = &minfo->mi_data; struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt = NULL; + struct lmv_tgt_desc *ptgt = NULL; + struct lmv_tgt_desc *ctgt = NULL; int rc; + if (!fid_is_sane(&op_data->op_fid2)) + return -EINVAL; + rc = lmv_check_connect(obd); if (rc) return rc; - tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1); - if (IS_ERR(tgt)) - return PTR_ERR(tgt); + ptgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1); + if (IS_ERR(ptgt)) + return PTR_ERR(ptgt); + + ctgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid2); + if (IS_ERR(ctgt)) + return PTR_ERR(ctgt); + + /* + * if child is on remote MDT, we need 2 async RPCs to fetch both LOOKUP + * lock on parent, and UPDATE lock on child MDT, which makes all + * complicated. Considering remote dir is rare case, and not supporting + * it in statahead won't cause any issue, drop its support for now. + */ + if (ptgt != ctgt) + return -ENOTSUPP; - return md_intent_getattr_async(tgt->ltd_exp, minfo, einfo); + return md_intent_getattr_async(ptgt->ltd_exp, minfo); } static int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h index 881c6a0..fecedc88 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h +++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h @@ -116,8 +116,7 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, struct lu_fid *fid, __u64 *bits); int mdc_intent_getattr_async(struct obd_export *exp, - struct md_enqueue_info *minfo, - struct ldlm_enqueue_info *einfo); + struct md_enqueue_info *minfo); enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags, const struct lu_fid *fid, enum ldlm_type type, diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 54ebb99..156add7 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -49,7 +49,6 @@ struct mdc_getattr_args { struct obd_export *ga_exp; struct md_enqueue_info *ga_minfo; - struct ldlm_enqueue_info *ga_einfo; }; int it_open_error(int phase, struct lookup_intent *it) @@ -1111,7 +1110,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, struct mdc_getattr_args *ga = args; struct obd_export *exp = ga->ga_exp; struct md_enqueue_info *minfo = ga->ga_minfo; - struct ldlm_enqueue_info *einfo = ga->ga_einfo; + struct ldlm_enqueue_info *einfo = &minfo->mi_einfo; struct lookup_intent *it; struct lustre_handle *lockh; struct obd_device *obddev; @@ -1147,14 +1146,12 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, rc = mdc_finish_intent_lock(exp, req, &minfo->mi_data, it, lockh); out: - kfree(einfo); minfo->mi_cb(req, minfo, rc); return 0; } int mdc_intent_getattr_async(struct obd_export *exp, - struct md_enqueue_info *minfo, - struct ldlm_enqueue_info *einfo) + struct md_enqueue_info *minfo) { struct md_op_data *op_data = &minfo->mi_data; struct lookup_intent *it = &minfo->mi_it; @@ -1162,10 +1159,6 @@ int mdc_intent_getattr_async(struct obd_export *exp, struct mdc_getattr_args *ga; struct obd_device *obddev = class_exp2obd(exp); struct ldlm_res_id res_id; - /*XXX: Both MDS_INODELOCK_LOOKUP and MDS_INODELOCK_UPDATE are needed - * for statahead currently. Consider CMD in future, such two bits - * maybe managed by different MDS, should be adjusted then. - */ union ldlm_policy_data policy = { .l_inodebits = { MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE } }; @@ -1188,8 +1181,8 @@ int mdc_intent_getattr_async(struct obd_export *exp, return rc; } - rc = ldlm_cli_enqueue(exp, &req, einfo, &res_id, &policy, &flags, NULL, - 0, LVB_T_NONE, &minfo->mi_lockh, 1); + rc = ldlm_cli_enqueue(exp, &req, &minfo->mi_einfo, &res_id, &policy, + &flags, NULL, 0, LVB_T_NONE, &minfo->mi_lockh, 1); if (rc < 0) { obd_put_request_slot(&obddev->u.cli); ptlrpc_req_finished(req); @@ -1200,7 +1193,6 @@ int mdc_intent_getattr_async(struct obd_export *exp, ga = ptlrpc_req_async_args(req); ga->ga_exp = exp; ga->ga_minfo = minfo; - ga->ga_einfo = einfo; req->rq_interpret_reply = mdc_intent_getattr_async_interpret; ptlrpcd_add_req(req); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:29 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:29 -0500 Subject: [lustre-devel] [PATCH 01/60] staging: lustre: llite: Remove access of stripe in ll_setattr_raw In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-2-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong In ll_setattr_raw(), it needs to know if a file is released when the file is being truncated. It used to get this information by accessing lov_stripe_md. This turns out not necessary. This patch removes the access of lov_stripe_md and solves the problem in lov_io_init_released(). Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5823 Reviewed-on: http://review.whamcloud.com/13514 Reviewed-by: James Simmons Reviewed-by: Henri Doreau Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/cl_object.h | 6 -- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 9 +- .../staging/lustre/lustre/llite/llite_internal.h | 1 + drivers/staging/lustre/lustre/llite/llite_lib.c | 109 ++++++++++----------- drivers/staging/lustre/lustre/llite/vvp_io.c | 10 +- drivers/staging/lustre/lustre/lov/lov_io.c | 7 +- drivers/staging/lustre/lustre/lov/lov_object.c | 3 - 8 files changed, 68 insertions(+), 79 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index dc68561..a1b8301 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -284,12 +284,6 @@ struct cl_layout { size_t cl_size; /** Layout generation. */ u32 cl_layout_gen; - /** - * True if this is a released file. - * Temporarily added for released file truncate in ll_setattr_raw(). - * It will be removed later. -Jinshan - */ - bool cl_is_released; }; /** diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index a171188..0ee02f1 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1821,7 +1821,7 @@ static int ll_swap_layouts(struct file *file1, struct file *file2, return rc; } -static int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss) +int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss) { struct md_op_data *op_data; int rc; diff --git a/drivers/staging/lustre/lustre/llite/lcommon_cl.c b/drivers/staging/lustre/lustre/llite/lcommon_cl.c index dd1cfd8..f1036f4 100644 --- a/drivers/staging/lustre/lustre/llite/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/llite/lcommon_cl.c @@ -94,6 +94,7 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, io = vvp_env_thread_io(env); io->ci_obj = obj; + io->ci_verify_layout = 1; io->u.ci_setattr.sa_attr.lvb_atime = LTIME_S(attr->ia_atime); io->u.ci_setattr.sa_attr.lvb_mtime = LTIME_S(attr->ia_mtime); @@ -120,13 +121,7 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, cl_io_fini(env, io); if (unlikely(io->ci_need_restart)) goto again; - /* HSM import case: file is released, cannot be restored - * no need to fail except if restore registration failed - * with -ENODATA - */ - if (result == -ENODATA && io->ci_restore_needed && - io->ci_result != -ENODATA) - result = 0; + cl_env_put(env, &refcheck); return result; } diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 065a9a7..2c72177 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -766,6 +766,7 @@ int ll_dir_getstripe(struct inode *inode, void **lmmp, int *lmm_size, int ll_fid2path(struct inode *inode, void __user *arg); int ll_data_version(struct inode *inode, __u64 *data_version, int flags); int ll_hsm_release(struct inode *inode); +int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss); /* llite/dcache.c */ diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 9cb4909..769b307 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1402,7 +1402,11 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data) * cache is not cleared yet. */ op_data->op_attr.ia_valid &= ~(TIMES_SET_FLAGS | ATTR_SIZE); + if (S_ISREG(inode->i_mode)) + inode_lock(inode); rc = simple_setattr(dentry, &op_data->op_attr); + if (S_ISREG(inode->i_mode)) + inode_unlock(inode); op_data->op_attr.ia_valid = ia_valid; rc = ll_update_inode(inode, &md); @@ -1431,7 +1435,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) struct inode *inode = d_inode(dentry); struct ll_inode_info *lli = ll_i2info(inode); struct md_op_data *op_data = NULL; - bool file_is_released = false; int rc = 0; CDEBUG(D_VFSTRACE, "%s: setattr inode "DFID"(%p) from %llu to %llu, valid %x, hsm_import %d\n", @@ -1486,76 +1489,35 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime), (s64)ktime_get_real_seconds()); - /* We always do an MDS RPC, even if we're only changing the size; - * only the MDS knows whether truncate() should fail with -ETXTBUSY - */ - - op_data = kzalloc(sizeof(*op_data), GFP_NOFS); - if (!op_data) - return -ENOMEM; - - if (!S_ISDIR(inode->i_mode)) + if (S_ISREG(inode->i_mode)) inode_unlock(inode); - /* truncate on a released file must failed with -ENODATA, - * so size must not be set on MDS for released file - * but other attributes must be set + /* + * We always do an MDS RPC, even if we're only changing the size; + * only the MDS knows whether truncate() should fail with -ETXTBUSY */ - if (S_ISREG(inode->i_mode)) { - struct cl_layout cl = { - .cl_is_released = false, - }; - struct lu_env *env; - int refcheck; - __u32 gen; + op_data = kzalloc(sizeof(*op_data), GFP_NOFS); + if (!op_data) { + rc = -ENOMEM; + goto out; + } - rc = ll_layout_refresh(inode, &gen); - if (rc < 0) - goto out; + op_data->op_attr = *attr; + if (!hsm_import && attr->ia_valid & ATTR_SIZE) { /* - * XXX: the only place we need to know the layout type, - * this will be removed by a later patch. -Jinshan + * If we are changing file size, file content is + * modified, flag it. */ - env = cl_env_get(&refcheck); - if (IS_ERR(env)) { - rc = PTR_ERR(env); - goto out; - } - - rc = cl_object_layout_get(env, lli->lli_clob, &cl); - cl_env_put(env, &refcheck); - if (rc < 0) - goto out; - - file_is_released = cl.cl_is_released; - - if (!hsm_import && attr->ia_valid & ATTR_SIZE) { - if (file_is_released) { - rc = ll_layout_restore(inode, 0, attr->ia_size); - if (rc < 0) - goto out; - - file_is_released = false; - ll_layout_refresh(inode, &gen); - } - - /* - * If we are changing file size, file content is - * modified, flag it. - */ - attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE; - op_data->op_bias |= MDS_DATA_MODIFIED; - } + attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE; + op_data->op_bias |= MDS_DATA_MODIFIED; } - memcpy(&op_data->op_attr, attr, sizeof(*attr)); - rc = ll_md_setattr(dentry, op_data); if (rc) goto out; - if (!S_ISREG(inode->i_mode) || file_is_released) { + if (!S_ISREG(inode->i_mode) || hsm_import) { rc = 0; goto out; } @@ -1572,11 +1534,40 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) */ rc = cl_setattr_ost(ll_i2info(inode)->lli_clob, attr, 0); } + + /* + * If the file was restored, it needs to set dirty flag. + * + * We've already sent MDS_DATA_MODIFIED flag in + * ll_md_setattr() for truncate. However, the MDT refuses to + * set the HS_DIRTY flag on released files, so we have to set + * it again if the file has been restored. Please check how + * LLIF_DATA_MODIFIED is set in vvp_io_setattr_fini(). + * + * Please notice that if the file is not released, the previous + * MDS_DATA_MODIFIED has taken effect and usually + * LLIF_DATA_MODIFIED is not set(see vvp_io_setattr_fini()). + * This way we can save an RPC for common open + trunc + * operation. + */ + if (test_and_clear_bit(LLIF_DATA_MODIFIED, &lli->lli_flags)) { + struct hsm_state_set hss = { + .hss_valid = HSS_SETMASK, + .hss_setmask = HS_DIRTY, + }; + int rc2; + + rc2 = ll_hsm_state_set(inode, &hss); + if (rc2 < 0) + CERROR(DFID "HSM set dirty failed: rc2 = %d\n", + PFID(ll_inode2fid(inode)), rc2); + } + out: if (op_data) ll_finish_md_op_data(op_data); - if (!S_ISDIR(inode->i_mode)) { + if (S_ISREG(inode->i_mode)) { inode_lock(inode); if ((attr->ia_valid & ATTR_SIZE) && !hsm_import) inode_dio_wait(inode); diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 697cbfb..19f85fc 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -288,7 +288,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) io->ci_ignore_layout, io->ci_verify_layout, vio->vui_layout_gen, io->ci_restore_needed); - if (io->ci_restore_needed == 1) { + if (io->ci_restore_needed) { int rc; /* file was detected release, we need to restore it @@ -657,7 +657,15 @@ static void vvp_io_setattr_end(const struct lu_env *env, static void vvp_io_setattr_fini(const struct lu_env *env, const struct cl_io_slice *ios) { + bool restore_needed = ios->cis_io->ci_restore_needed; + struct inode *inode = vvp_object_inode(ios->cis_obj); + vvp_io_fini(env, ios); + + if (restore_needed && !ios->cis_io->ci_restore_needed) { + /* restore finished, set data modified flag for HSM */ + set_bit(LLIF_DATA_MODIFIED, &(ll_i2info(inode))->lli_flags); + } } static int vvp_io_read_start(const struct lu_env *env, diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 002326c..e0f0756 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -1056,9 +1056,12 @@ int lov_io_init_released(const struct lu_env *env, struct cl_object *obj, * - in setattr, for truncate */ /* the truncate is for size > 0 so triggers a restore */ - if (cl_io_is_trunc(io)) + if (cl_io_is_trunc(io)) { io->ci_restore_needed = 1; - result = -ENODATA; + result = -ENODATA; + } else { + result = 1; + } break; case CIT_READ: case CIT_WRITE: diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 76d4256..46ec46e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -1453,14 +1453,11 @@ static int lov_object_layout_get(const struct lu_env *env, if (!lsm) { cl->cl_size = 0; cl->cl_layout_gen = CL_LAYOUT_GEN_EMPTY; - cl->cl_is_released = false; - return 0; } cl->cl_size = lov_mds_md_size(lsm->lsm_stripe_count, lsm->lsm_magic); cl->cl_layout_gen = lsm->lsm_layout_gen; - cl->cl_is_released = lsm_is_released(lsm); rc = lov_lsm_pack(lsm, buf->lb_buf, buf->lb_len); lov_lsm_put(lsm); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:33 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:33 -0500 Subject: [lustre-devel] [PATCH 05/60] staging: lustre: llite: check request != NULL in ll_migrate In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-6-git-send-email-jsimmons@infradead.org> From: wang di Check if the request is NULL, before retrieve reply body from the request. Signed-off-by: wang di Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7396 Reviewed-on: http://review.whamcloud.com/17079 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 41 +++++++++++++++++------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index a1e51a5..b681e15 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2656,28 +2656,33 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, if (!rc) ll_update_times(request, parent); - body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); - if (!body) { - rc = -EPROTO; - goto out_free; - } + if (request) { + body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); + if (!body) { + rc = -EPROTO; + goto out_free; + } - /* - * If the server does release layout lock, then we cleanup - * the client och here, otherwise release it in out_free: - */ - if (och && body->mbo_valid & OBD_MD_CLOSE_INTENT_EXECED) { - obd_mod_put(och->och_mod); - md_clear_open_replay_data(ll_i2sbi(parent)->ll_md_exp, och); - och->och_fh.cookie = DEAD_HANDLE_MAGIC; - kfree(och); - och = NULL; - } + /* + * If the server does release layout lock, then we cleanup + * the client och here, otherwise release it in out_free: + */ + if (och && body->mbo_valid & OBD_MD_CLOSE_INTENT_EXECED) { + obd_mod_put(och->och_mod); + md_clear_open_replay_data(ll_i2sbi(parent)->ll_md_exp, + och); + och->och_fh.cookie = DEAD_HANDLE_MAGIC; + kfree(och); + och = NULL; + } - ptlrpc_req_finished(request); + ptlrpc_req_finished(request); + } /* Try again if the file layout has changed. */ - if (rc == -EAGAIN && S_ISREG(child_inode->i_mode)) + if (rc == -EAGAIN && S_ISREG(child_inode->i_mode)) { + request = NULL; goto again; + } out_free: if (child_inode) { if (och) /* close the file */ -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:35 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:35 -0500 Subject: [lustre-devel] [PATCH 07/60] staging: lustre: ptlrpc: set proper mbits for EINPROGRESS resend In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-8-git-send-email-jsimmons@infradead.org> From: Niu Yawei Set mbits for EINPROGRESS resend in ptl_send_rpc(). Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8193 Reviewed-on: http://review.whamcloud.com/20377 Reviewed-by: Liang Zhen Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/client.c | 7 +++++-- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 8047413..3c18ab6 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -3123,8 +3123,11 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req) req->rq_mbits = ptlrpc_next_xid(); } else { /* old version transfers rq_xid to peer as matchbits */ - req->rq_mbits = ptlrpc_next_xid(); - req->rq_xid = req->rq_mbits; + spin_lock(&req->rq_import->imp_lock); + list_del_init(&req->rq_unreplied_list); + ptlrpc_assign_next_xid_nolock(req); + req->rq_mbits = req->rq_xid; + spin_unlock(&req->rq_import->imp_lock); } CDEBUG(D_HA, "resend bulk old x%llu new x%llu\n", diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index da1209e..b870184 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -522,13 +522,14 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) */ spin_lock(&imp->imp_lock); ptlrpc_assign_next_xid_nolock(request); - request->rq_mbits = request->rq_xid; min_xid = ptlrpc_known_replied_xid(imp); spin_unlock(&imp->imp_lock); lustre_msg_set_last_xid(request->rq_reqmsg, min_xid); DEBUG_REQ(D_RPCTRACE, request, "Allocating new xid for resend on EINPROGRESS"); - } else if (request->rq_bulk) { + } + + if (request->rq_bulk) { ptlrpc_set_bulk_mbits(request); lustre_msg_set_mbits(request->rq_reqmsg, request->rq_mbits); } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:28 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:28 -0500 Subject: [lustre-devel] [PATCH 00/60] staging: lustre: batches of fixes for lustre client Message-ID: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Batch of missing fixes for lustre for the upstream client. Alex Zhuravlev (1): staging: lustre: obdclass: do not call lu_site_purge() for single object exceed Alexander Boyko (1): staging: lustre: ptlrpc: skip lock if export failed Andreas Dilger (3): staging: lustre: mdc: quiet console message for known -EINTR staging: lustre: obdclass: add more info to sysfs version string staging: lustre: llite: handle inactive OSTs better in statfs Andriy Skulysh (1): staging: lustre: ldlm: ASSERTION(flock->blocking_export!=0) failed Ann Koehler (1): staging: lustre: obd: RCU stalls in lu_cache_shrink_count() Ben Evans (1): staging: lustre: lustre: Remove old commented out code Bobi Jam (3): staging: lustre: clio: add cl_page LRU shrinker staging: lustre: lov: ld_target could be NULL staging: lustre: llite: specify READA debug mask for ras_update Bruno Faccini (1): staging: lustre: obdclass: health_check to report unhealthy upon LBUG Dmitry Eremin (6): staging: lustre: llite: Setting xattr are properly checked with and without ACLs staging: lustre: libcfs: avoid stomping on module param cpu_pattern staging: lustre: libcfs: default CPT matches NUMA topology staging: lustre: libcfs: fix error messages staging: lustre: ptlrpc: remove unused pc->pc_env staging: lustre: ptlrpc: update MODULE_PARAM_DESC in ptlrpcd.c Fan Yong (4): staging: lustre: fid: fix race in fid allocation staging: lustre: mgc: handle config_llog_data::cld_refcount properly staging: lustre: ptlrpc: comment for FLD_QUERY RPC reply swab staging: lustre: linkea: linkEA size limitation Giuseppe Di Natale (1): staging: lustre: lmv: Correctly generate target_obd James Simmons (7): staging: lustre: header: remove assert from interval_set() staging: libcfs: remove integer types abstraction from libcfs staging: lustre: socklnd: remove socklnd_init_msg staging: lustre: obd: move s3 in lmd_parse to inner loop staging: lustre: osc: avoid 64 divide in osc_cache_too_much staging: lustre: ptlrpc : remove userland usage from ptlrpc staging: lustre: libcfs: fix minimum size check for libcfs ioctl Jeremy Filizetti (1): staging: lustre: ldlm: Restore connect flags on failure Jinshan Xiong (4): staging: lustre: llite: Remove access of stripe in ll_setattr_raw staging: lustre: clio: revise readahead to support 16MB IO staging: lustre: llite: don't ignore layout for group lock request staging: lustre: osc: limits the number of chunks in write RPC John L. Hammond (5): staging: lustre: llite: remove obsolete comment for ll_unlink() staging: lustre: ptlrpc: correct use of list_add_tail() staging: lustre: lmv: remove unused placement parameter staging: lustre: obd: remove OBD_NOTIFY_CREATE staging: lustre: mdc: avoid returning freed request Lai Siyao (2): staging: lustre: statahead: drop support for remote entry staging: lustre: llite: normal user can't set FS default stripe Liang Zhen (1): staging: lustre: ksocklnd: ignore timedout TX on closing connection Nathaniel Clark (1): staging: lustre: lov: Ensure correct operation for large object sizes Niu Yawei (4): staging: lustre: ptlrpc: set proper mbits for EINPROGRESS resend staging: lustre: clio: sync write should update mtime staging: ptlrpc: leaked rs on difficult reply staging: lustre: ptlrpc: update replay cursor when close during replay Oleg Drokin (1): staging: lustre: llite: Trust creates in revalidate too. Patrick Farrell (1): staging: lustre: mdc: Make IT_OPEN take lookup bits lock Rahul Deshmukh (1): staging: lustre: llite: Adding timed wait in ll_umount_begin Steve Guminski (3): staging: lustre: osc: osc_match_base prototype differs from declaration staging: lustre: libcfs: Change positional struct initializers to C99 staging: lustre: fid: Change positional struct initializers to C99 Ulka Vaze (1): staging: lustre: lmv: Error not handled for lmv_find_target Vladimir Saveliev (1): staging: lustre: ptlrpc: allow blocking asts to be delayed Yang Sheng (1): staging: lustre: llite: don't invoke direct_IO for the EOF case frank zago (1): staging: lustre: hsm: stack overrun in hai_dump_data_field wang di (2): staging: lustre: llite: check request != NULL in ll_migrate staging: lustre: lmv: remove nlink check in lmv_revalidate_slaves .../lustre/include/linux/libcfs/libcfs_crypto.h | 60 +++++-- .../lustre/include/linux/libcfs/linux/libcfs.h | 4 - .../staging/lustre/include/linux/lnet/socklnd.h | 9 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 29 +-- drivers/staging/lustre/lnet/libcfs/debug.c | 2 +- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 17 +- .../lustre/lnet/libcfs/linux/linux-module.c | 2 +- drivers/staging/lustre/lnet/libcfs/workitem.c | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 4 +- drivers/staging/lustre/lnet/selftest/module.c | 3 +- drivers/staging/lustre/lustre/fid/fid_lib.c | 7 +- drivers/staging/lustre/lustre/fid/fid_request.c | 55 +++--- drivers/staging/lustre/lustre/fid/lproc_fid.c | 12 +- drivers/staging/lustre/lustre/include/cl_object.h | 10 +- .../staging/lustre/lustre/include/interval_tree.h | 12 +- drivers/staging/lustre/lustre/include/lu_object.h | 14 +- .../lustre/lustre/include/lustre/lustre_idl.h | 5 +- .../lustre/lustre/include/lustre/lustre_user.h | 18 +- .../staging/lustre/lustre/include/lustre_linkea.h | 15 +- drivers/staging/lustre/lustre/include/lustre_net.h | 4 - .../lustre/lustre/include/lustre_req_layout.h | 10 +- drivers/staging/lustre/lustre/include/obd.h | 18 +- drivers/staging/lustre/lustre/include/obd_class.h | 5 +- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 6 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 1 - .../staging/lustre/lustre/ldlm/ldlm_inodebits.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 13 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 7 + drivers/staging/lustre/lustre/llite/dcache.c | 13 +- drivers/staging/lustre/lustre/llite/dir.c | 14 +- drivers/staging/lustre/lustre/llite/file.c | 83 +++++---- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 9 +- drivers/staging/lustre/lustre/llite/lcommon_misc.c | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 16 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 124 ++++++------- drivers/staging/lustre/lustre/llite/namei.c | 5 - drivers/staging/lustre/lustre/llite/range_lock.c | 10 +- drivers/staging/lustre/lustre/llite/range_lock.h | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 199 ++++++++++----------- drivers/staging/lustre/lustre/llite/rw26.c | 4 + drivers/staging/lustre/lustre/llite/statahead.c | 94 ++++------ drivers/staging/lustre/lustre/llite/vvp_io.c | 17 +- drivers/staging/lustre/lustre/llite/xattr.c | 9 + drivers/staging/lustre/lustre/lmv/lmv_intent.c | 16 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 65 ++++--- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 85 ++------- drivers/staging/lustre/lustre/lov/lov_ea.c | 22 +-- drivers/staging/lustre/lustre/lov/lov_io.c | 7 +- drivers/staging/lustre/lustre/lov/lov_lock.c | 5 + drivers/staging/lustre/lustre/lov/lov_obd.c | 2 - drivers/staging/lustre/lustre/lov/lov_object.c | 33 +++- drivers/staging/lustre/lustre/lov/lov_request.c | 6 +- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 3 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 18 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 9 +- drivers/staging/lustre/lustre/mgc/mgc_request.c | 183 ++++++++++--------- drivers/staging/lustre/lustre/obdclass/linkea.c | 70 ++++++-- .../lustre/lustre/obdclass/linux/linux-module.c | 8 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 106 +++++------ drivers/staging/lustre/lustre/obdclass/obd_mount.c | 3 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 125 +++++++++---- drivers/staging/lustre/lustre/osc/osc_internal.h | 15 +- drivers/staging/lustre/lustre/osc/osc_io.c | 15 +- drivers/staging/lustre/lustre/osc/osc_page.c | 98 +++++++++- drivers/staging/lustre/lustre/osc/osc_request.c | 21 +++ drivers/staging/lustre/lustre/ptlrpc/client.c | 24 ++- drivers/staging/lustre/lustre/ptlrpc/events.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 26 ++- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 18 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 24 +-- drivers/staging/lustre/lustre/ptlrpc/sec_gc.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 21 +-- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 16 +- 76 files changed, 1136 insertions(+), 868 deletions(-) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:42 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:42 -0500 Subject: [lustre-devel] [PATCH 14/60] staging: lustre: lov: Ensure correct operation for large object sizes In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-15-git-send-email-jsimmons@infradead.org> From: Nathaniel Clark If a backing filesystem (ZFS) returns that it supports very large (LLONG_MAX) object sizes, that should be correctly supported. This fixes the check for unitialized stripe_maxbytes in lsm_unpackmd_common(), so that ZFS can return LLONG_MAX and it will be okay. This issue is excersized by writing to or past the 2TB boundary of a singly stripped file. Signed-off-by: Nathaniel Clark Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7890 Reviewed-on: http://review.whamcloud.com/19066 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_ea.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index ac0bf64..07dee87 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -150,7 +150,7 @@ static int lsm_unpackmd_common(struct lov_obd *lov, struct lov_mds_md *lmm, struct lov_ost_data_v1 *objects) { - loff_t stripe_maxbytes = LLONG_MAX; + loff_t min_stripe_maxbytes = 0, lov_bytes; unsigned int stripe_count; struct lov_oinfo *loi; unsigned int i; @@ -168,8 +168,6 @@ static int lsm_unpackmd_common(struct lov_obd *lov, stripe_count = lsm_is_released(lsm) ? 0 : lsm->lsm_stripe_count; for (i = 0; i < stripe_count; i++) { - loff_t tgt_bytes; - loi = lsm->lsm_oinfo[i]; ostid_le_to_cpu(&objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx = le32_to_cpu(objects[i].l_ost_idx); @@ -194,17 +192,21 @@ static int lsm_unpackmd_common(struct lov_obd *lov, continue; } - tgt_bytes = lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx]); - stripe_maxbytes = min_t(loff_t, stripe_maxbytes, tgt_bytes); + lov_bytes = lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx]); + if (min_stripe_maxbytes == 0 || lov_bytes < min_stripe_maxbytes) + min_stripe_maxbytes = lov_bytes; } - if (stripe_maxbytes == LLONG_MAX) - stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; + if (min_stripe_maxbytes == 0) + min_stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; + + stripe_count = lsm->lsm_stripe_count ?: lov->desc.ld_tgt_count; + lov_bytes = min_stripe_maxbytes * stripe_count; - if (!lsm->lsm_stripe_count) - lsm->lsm_maxbytes = stripe_maxbytes * lov->desc.ld_tgt_count; + if (lov_bytes < min_stripe_maxbytes) /* handle overflow */ + lsm->lsm_maxbytes = MAX_LFS_FILESIZE; else - lsm->lsm_maxbytes = stripe_maxbytes * lsm->lsm_stripe_count; + lsm->lsm_maxbytes = lov_bytes; return 0; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:43 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:43 -0500 Subject: [lustre-devel] [PATCH 15/60] staging: lustre: hsm: stack overrun in hai_dump_data_field In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-16-git-send-email-jsimmons@infradead.org> From: frank zago The function hai_dump_data_field will do a stack buffer overrun when cat'ing /sys/fs/lustre/.../hsm/actions if an action has some data in it. hai_dump_data_field uses snprintf. But there is no check for truncation, and the value returned by snprintf is used as-is. The coordinator code calls hai_dump_data_field with 12 bytes in the buffer. The 6th byte of data is printed incompletely to make room for the terminating NUL. However snprintf still returns 2, so when hai_dump_data_field writes the final NUL, it does it outside the reserved buffer, in the 13th byte of the buffer. This stack buffer overrun hangs my VM. Fix by checking that there is enough room for the next 2 characters plus the NUL terminator. Don't print half bytes. Change the format to 02X instead of .2X, which makes more sense. Signed-off-by: frank zago Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8171 Reviewed-on: http://review.whamcloud.com/20338 Reviewed-by: John L. Hammond Reviewed-by: Jean-Baptiste Riaux Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../staging/lustre/lustre/include/lustre/lustre_user.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index 3301ad6..21aec0c 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -1209,23 +1209,21 @@ struct hsm_action_item { * \retval buffer */ static inline char *hai_dump_data_field(struct hsm_action_item *hai, - char *buffer, int len) + char *buffer, size_t len) { - int i, sz, data_len; + int i, data_len; char *ptr; ptr = buffer; - sz = len; data_len = hai->hai_len - sizeof(*hai); - for (i = 0 ; (i < data_len) && (sz > 0) ; i++) { - int cnt; - - cnt = snprintf(ptr, sz, "%.2X", - (unsigned char)hai->hai_data[i]); - ptr += cnt; - sz -= cnt; + for (i = 0; (i < data_len) && (len > 2); i++) { + snprintf(ptr, 3, "%02X", (unsigned char)hai->hai_data[i]); + ptr += 2; + len -= 2; } + *ptr = '\0'; + return buffer; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:36 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:36 -0500 Subject: [lustre-devel] [PATCH 08/60] staging: lustre: ldlm: Restore connect flags on failure In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-9-git-send-email-jsimmons@infradead.org> From: Jeremy Filizetti Restore connect flags on failure of ptlrpc_connect_import() to prevent an LBUG due to flags mismatch. Signed-off-by: Jeremy Filizetti Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7185 Reviewed-on: http://review.whamcloud.com/16950 Reviewed-by: Andreas Dilger Reviewed-by: Sebastien Buisson Reviewed-by: John L. Hammond Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 95b8c76..3663c5c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -523,6 +523,8 @@ int client_connect_import(const struct lu_env *env, rc = ptlrpc_connect_import(imp); if (rc != 0) { + if (data && is_mdc) + data->ocd_connect_flags &= ~OBD_CONNECT_MULTIMODRPCS; LASSERT(imp->imp_state == LUSTRE_IMP_DISCON); goto out_ldlm; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:44 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:44 -0500 Subject: [lustre-devel] [PATCH 16/60] staging: lustre: llite: don't ignore layout for group lock request In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-17-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong ignore_layout can be set for operations that layout won't be changed, typically page operations. Ignoring layout change in group lock request will confuse layout change code at LOV layer and hit assertion. Signed-off-by: Henri Doreau Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2766 Reviewed-on: http://review.whamcloud.com/6828 Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/lcommon_misc.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 7 ------- drivers/staging/lustre/lustre/lov/lov_lock.c | 5 +++++ drivers/staging/lustre/lustre/lov/lov_object.c | 23 +++++++++++++++++++++- drivers/staging/lustre/lustre/osc/osc_cache.c | 1 + 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lcommon_misc.c b/drivers/staging/lustre/lustre/llite/lcommon_misc.c index f48660e..f0c132e 100644 --- a/drivers/staging/lustre/lustre/llite/lcommon_misc.c +++ b/drivers/staging/lustre/lustre/llite/lcommon_misc.c @@ -33,6 +33,7 @@ * future). * */ +#define DEBUG_SUBSYSTEM S_LLITE #include "../include/obd_class.h" #include "../include/obd_support.h" #include "../include/obd.h" @@ -132,7 +133,6 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock, io = vvp_env_thread_io(env); io->ci_obj = obj; - io->ci_ignore_layout = 1; rc = cl_io_init(env, io, CIT_MISC, io->ci_obj); if (rc != 0) { diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 19f85fc..3e9cf71 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -1348,13 +1348,6 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj, io->ci_lockreq = CILR_MANDATORY; } - /* ignore layout change for generic CIT_MISC but not for glimpse. - * io context for glimpse must set ci_verify_layout to true, - * see cl_glimpse_size0() for details. - */ - if (io->ci_type == CIT_MISC && !io->ci_verify_layout) - io->ci_ignore_layout = 1; - /* Enqueue layout lock and get layout version. We need to do this * even for operations requiring to open file, such as read and write, * because it might not grant layout lock in IT_OPEN. diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index f3a0583..8502128 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -134,6 +134,11 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, struct lov_layout_raid0 *r0 = lov_r0(loo); struct lov_lock *lovlck; + CDEBUG(D_INODE, "%p: lock/io FID " DFID "/" DFID ", lock/io clobj %p/%p\n", + loo, PFID(lu_object_fid(lov2lu(loo))), + PFID(lu_object_fid(&obj->co_lu)), + lov2cl(loo), obj); + file_start = cl_offset(lov2cl(loo), lock->cll_descr.cld_start); file_end = cl_offset(lov2cl(loo), lock->cll_descr.cld_end + 1) - 1; diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 46ec46e..9c4b5ab 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -650,12 +650,16 @@ static enum lov_layout_type lov_type(struct lov_stripe_md *lsm) static inline void lov_conf_freeze(struct lov_object *lov) { + CDEBUG(D_INODE, "To take share lov(%p) owner %p/%p\n", + lov, lov->lo_owner, current); if (lov->lo_owner != current) down_read(&lov->lo_type_guard); } static inline void lov_conf_thaw(struct lov_object *lov) { + CDEBUG(D_INODE, "To release share lov(%p) owner %p/%p\n", + lov, lov->lo_owner, current); if (lov->lo_owner != current) up_read(&lov->lo_type_guard); } @@ -698,10 +702,14 @@ static void lov_conf_lock(struct lov_object *lov) down_write(&lov->lo_type_guard); LASSERT(!lov->lo_owner); lov->lo_owner = current; + CDEBUG(D_INODE, "Took exclusive lov(%p) owner %p\n", + lov, lov->lo_owner); } static void lov_conf_unlock(struct lov_object *lov) { + CDEBUG(D_INODE, "To release exclusive lov(%p) owner %p\n", + lov, lov->lo_owner); lov->lo_owner = NULL; up_write(&lov->lo_type_guard); } @@ -725,6 +733,7 @@ static int lov_layout_change(const struct lu_env *unused, struct lov_object *lov, struct lov_stripe_md *lsm, const struct cl_object_conf *conf) { + struct lov_device *lov_dev = lov_object_dev(lov); enum lov_layout_type llt = lov_type(lsm); union lov_layout_state *state = &lov->u; const struct lov_layout_operations *old_ops; @@ -760,14 +769,21 @@ static int lov_layout_change(const struct lu_env *unused, LASSERT(!atomic_read(&lov->lo_active_ios)); + CDEBUG(D_INODE, DFID "Apply new layout lov %p, type %d\n", + PFID(lu_object_fid(lov2lu(lov))), lov, llt); + lov->lo_type = LLT_EMPTY; /* page bufsize fixup */ cl_object_header(&lov->lo_cl)->coh_page_bufsize -= lov_page_slice_fixup(lov, NULL); - rc = new_ops->llo_init(env, lov_object_dev(lov), lov, lsm, conf, state); + rc = new_ops->llo_init(env, lov_dev, lov, lsm, conf, state); if (rc) { + struct obd_device *obd = lov2obd(lov_dev->ld_lov); + + CERROR("%s: cannot apply new layout on " DFID " : rc = %d\n", + obd->obd_name, PFID(lu_object_fid(lov2lu(lov))), rc); new_ops->llo_delete(env, lov, state); new_ops->llo_fini(env, lov, state); /* this file becomes an EMPTY file. */ @@ -923,6 +939,11 @@ int lov_io_init(const struct lu_env *env, struct cl_object *obj, struct cl_io *io) { CL_IO_SLICE_CLEAN(lov_env_io(env), lis_cl); + + CDEBUG(D_INODE, DFID "io %p type %d ignore/verify layout %d/%d\n", + PFID(lu_object_fid(&obj->co_lu)), io, io->ci_type, + io->ci_ignore_layout, io->ci_verify_layout); + return LOV_2DISPATCH_MAYLOCK(cl2lov(obj), llo_io_init, !io->ci_ignore_layout, env, obj, io); } diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 5ac0e14..72dd554 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1001,6 +1001,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, env = cl_env_get(&refcheck); io = &osc_env_info(env)->oti_io; io->ci_obj = cl_object_top(osc2cl(obj)); + io->ci_ignore_layout = 1; rc = cl_io_init(env, io, CIT_MISC, io->ci_obj); if (rc < 0) goto out; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:46 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:46 -0500 Subject: [lustre-devel] [PATCH 18/60] staging: lustre: ptlrpc: skip lock if export failed In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-19-git-send-email-jsimmons@infradead.org> From: Alexander Boyko This patch resolves IO vs eviction race. After eviction failed export stayed at stale list, a client had IO processing and reconnected during it. A client sent brw rpc with last lock cookie and new connection. The lock with failed export was found and assert was happened. (ost_handler.c:1812:ost_prolong_lock_one()) ASSERTION( lock->l_export == opd->opd_exp ) failed: 1. Skip the lock at ldlm_handle2lock if lock export failed. 2. Validation of lock for IO was added at hpreq_check(). The lock searching is based on granted interval tree. If server doesn`t have a valid lock, it reply to client with ESTALE. Signed-off-by: Alexander Boyko Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7702 Seagate-bug-id: MRP-2787 Reviewed-on: http://review.whamcloud.com/18120 Reviewed-by: Fan Yong Reviewed-by: Vitaly Fertman Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 7 +++++++ drivers/staging/lustre/lustre/ptlrpc/service.c | 21 ++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index afef5a2..5a94265 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -533,6 +533,13 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle, if (!lock) return NULL; + if (lock->l_export && lock->l_export->exp_failed) { + CDEBUG(D_INFO, "lock export failed: lock %p, exp %p\n", + lock, lock->l_export); + LDLM_LOCK_PUT(lock); + return NULL; + } + /* It's unlikely but possible that someone marked the lock as * destroyed after we did handle2object on it */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 70c7055..b8091c1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1264,20 +1264,15 @@ static int ptlrpc_server_hpreq_init(struct ptlrpc_service_part *svcpt, */ if (req->rq_ops->hpreq_check) { rc = req->rq_ops->hpreq_check(req); - /** - * XXX: Out of all current - * ptlrpc_hpreq_ops::hpreq_check(), only - * ldlm_cancel_hpreq_check() can return an error code; - * other functions assert in similar places, which seems - * odd. What also does not seem right is that handlers - * for those RPCs do not assert on the same checks, but - * rather handle the error cases. e.g. see - * ost_rw_hpreq_check(), and ost_brw_read(), - * ost_brw_write(). + if (rc == -ESTALE) { + req->rq_status = rc; + ptlrpc_error(req); + } + /** can only return error, + * 0 for normal request, + * or 1 for high priority request */ - if (rc < 0) - return rc; - LASSERT(rc == 0 || rc == 1); + LASSERT(rc <= 1); } spin_lock_bh(&req->rq_export->exp_rpc_lock); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:48 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:48 -0500 Subject: [lustre-devel] [PATCH 20/60] staging: lustre: llite: remove obsolete comment for ll_unlink() In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-21-git-send-email-jsimmons@infradead.org> From: "John L. Hammond" Remove obsolete comments about the behavior of ll_unlink() Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8003 Reviewed-on: http://review.whamcloud.com/19881 Reviewed-by: Andrew Perepechko Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/namei.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index f925656..fc17654 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -994,11 +994,6 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, return rc; } -/* ll_unlink() doesn't update the inode with the new link count. - * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there - * is any lock existing. They will recycle dentries and inodes based upon locks - * too. b=20433 - */ static int ll_unlink(struct inode *dir, struct dentry *dchild) { struct ptlrpc_request *request = NULL; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:52 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:52 -0500 Subject: [lustre-devel] [PATCH 24/60] staging: lustre: lustre: Remove old commented out code In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-25-git-send-email-jsimmons@infradead.org> From: Ben Evans These #if 0 blocks have been in place for years. Assume they are not used and remove them Signed-off-by: Ben Evans Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8058 Reviewed-on: http://review.whamcloud.com/20416 Reviewed-by: John L. Hammond Reviewed-by: Frank Zago Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 2 -- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 9 +-------- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 +------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 5c217c0..ab47078 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -483,8 +483,6 @@ enum obd_notify_event { OBD_NOTIFY_ACTIVE, /* Device deactivated */ OBD_NOTIFY_INACTIVE, - /* Device disconnected */ - OBD_NOTIFY_DISCON, /* Connect data for import were changed */ OBD_NOTIFY_OCD, /* Sync request */ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 5926461..271e189 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -173,14 +173,7 @@ static int lmv_notify(struct obd_device *obd, struct obd_device *watched, */ obd->obd_self_export->exp_connect_data = *conn_data; } -#if 0 - else if (ev == OBD_NOTIFY_DISCON) { - /* - * For disconnect event, flush fld cache for failout MDS case. - */ - fld_client_flush(&lmv->lmv_fld); - } -#endif + /* * Pass the notification up the chain. */ diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 2cfd913..02f57d8 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2465,13 +2465,6 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp, LASSERT(imp->imp_obd == obd); switch (event) { - case IMP_EVENT_DISCON: { -#if 0 - /* XXX Pass event up to OBDs stack. used only for FLD now */ - rc = obd_notify_observer(obd, obd, OBD_NOTIFY_DISCON, NULL); -#endif - break; - } case IMP_EVENT_INACTIVE: { struct client_obd *cli = &obd->u.cli; /* @@ -2503,6 +2496,7 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp, case IMP_EVENT_OCD: rc = obd_notify_observer(obd, obd, OBD_NOTIFY_OCD, NULL); break; + case IMP_EVENT_DISCON: case IMP_EVENT_DEACTIVATE: case IMP_EVENT_ACTIVATE: break; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:53 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:53 -0500 Subject: [lustre-devel] [PATCH 25/60] staging: lustre: llite: normal user can't set FS default stripe In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-26-git-send-email-jsimmons@infradead.org> From: Lai Siyao Current client doesn't check permission before updating filesystem default stripe on MGS, which isn't secure and obvious. Since we setattr on MDS first, and then set default stripe on MGS, we can just return error upon setattr failure. Now filesystem default stripe is stored in ROOT in MDT, so saving it in system config is for compatibility with old servers, this will be removed in the future. Signed-off-by: Lai Siyao Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8454 Reviewed-on: http://review.whamcloud.com/21612 Reviewed-on: http://review.whamcloud.com/22580 Reviewed-by: Jian Yu Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 526fea2..13b3592 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -521,12 +521,15 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, rc = md_setattr(sbi->ll_md_exp, op_data, lump, lum_size, &req); ll_finish_md_op_data(op_data); ptlrpc_req_finished(req); - if (rc) { - if (rc != -EPERM && rc != -EACCES) - CERROR("mdc_setattr fails: rc = %d\n", rc); - } + if (rc) + return rc; - /* In the following we use the fact that LOV_USER_MAGIC_V1 and +#if OBD_OCD_VERSION(2, 13, 53, 0) > LUSTRE_VERSION_CODE + /* + * 2.9 server has stored filesystem default stripe in ROOT xattr, + * and it's stored into system config for backward compatibility. + * + * In the following we use the fact that LOV_USER_MAGIC_V1 and * LOV_USER_MAGIC_V3 have the same initial fields so we do not * need to make the distinction between the 2 versions */ @@ -567,6 +570,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, end: kfree(param); } +#endif return rc; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:54 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:54 -0500 Subject: [lustre-devel] [PATCH 26/60] staging: lustre: llite: Trust creates in revalidate too. In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-27-git-send-email-jsimmons@infradead.org> From: Oleg Drokin By forcing creates to always go via lookup we lose some important caching benefits too. Instead let's trust creates with positive cached entries. Then we have 3 possible outcomes: 1. Negative dentry - we go via atomic_open and do the create by name there. 2. Positive dentry, no contention - we just go straight to ll_intent_file_open and open by fid. 3. positive dentry, contention - by the time we reach the server, the inode is gone. We get ENOENT which is unacceptable to return from create. But since we know it's a create, we substitute it with ESTALE and VFS retries again with LOOKUP_REVAL set, we catch that in revalidate and force a lookup (same path as before this patch). Signed-off-by: Oleg Drokin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8371 Reviewed-on: http://review.whamcloud.com/21168 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dcache.c | 13 +++++-------- drivers/staging/lustre/lustre/llite/file.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 65bf0c4..966f580 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -247,17 +247,14 @@ static int ll_revalidate_dentry(struct dentry *dentry, return 1; /* - * if open&create is set, talk to MDS to make sure file is created if - * necessary, because we can't do this in ->open() later since that's - * called on an inode. return 0 here to let lookup to handle this. + * VFS warns us that this is the second go around and previous + * operation failed (most likely open|creat), so this time + * we better talk to the server via the lookup path by name, + * not by fid. */ - if ((lookup_flags & (LOOKUP_OPEN | LOOKUP_CREATE)) == - (LOOKUP_OPEN | LOOKUP_CREATE)) + if (lookup_flags & LOOKUP_REVAL) return 0; - if (lookup_flags & (LOOKUP_PARENT | LOOKUP_OPEN | LOOKUP_CREATE)) - return 1; - if (!dentry_may_statahead(dir, dentry)) return 1; diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index b681e15..0c83bd7 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -417,6 +417,17 @@ static int ll_intent_file_open(struct dentry *de, void *lmm, int lmmsize, ptlrpc_req_finished(req); ll_intent_drop_lock(itp); + /* + * We did open by fid, but by the time we got to the server, + * the object disappeared. If this is a create, we cannot really + * tell the userspace that the file it was trying to create + * does not exist. Instead let's return -ESTALE, and the VFS will + * retry the create with LOOKUP_REVAL that we are going to catch + * in ll_revalidate_dentry() and use lookup then. + */ + if (rc == -ENOENT && itp->it_op & IT_CREAT) + rc = -ESTALE; + return rc; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:34 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:34 -0500 Subject: [lustre-devel] [PATCH 06/60] staging: lustre: clio: revise readahead to support 16MB IO In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-7-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Read ahead currently doesn't handle 16MB RPC packets correctly by assuming the packets are a default size instead of querying the size. This work adjust the read ahead policy to issue read ahead RPC by the underlying RPC size. Signed-off-by: Jinshan Xiong Signed-off-by: Gu Zheng Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7990 Reviewed-on: http://review.whamcloud.com/19368 Reviewed-by: Andreas Dilger Reviewed-by: Li Xi Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/cl_object.h | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 10 +- .../staging/lustre/lustre/llite/llite_internal.h | 14 +- drivers/staging/lustre/lustre/llite/rw.c | 195 ++++++++++----------- drivers/staging/lustre/lustre/osc/osc_io.c | 3 +- 5 files changed, 114 insertions(+), 112 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index a1b8301..813e71d 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -1452,8 +1452,10 @@ struct cl_read_ahead { * cra_end is included. */ pgoff_t cra_end; + /* optimal RPC size for this read, by pages */ + unsigned long cra_rpc_size; /* - * Release routine. If readahead holds resources underneath, this + * Release callback. If readahead holds resources underneath, this * function should be called to release it. */ void (*cra_release)(const struct lu_env *env, void *cbdata); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 675e25b..95b8c76 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -351,13 +351,11 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) cli->cl_supp_cksum_types = OBD_CKSUM_CRC32; atomic_set(&cli->cl_resends, OSC_DEFAULT_RESENDS); - /* This value may be reduced at connect time in - * ptlrpc_connect_interpret() . We initialize it to only - * 1MB until we know what the performance looks like. - * In the future this should likely be increased. LU-1431 + /* + * Set it to possible maximum size. It may be reduced by ocd_brw_size + * from OFD after connecting. */ - cli->cl_max_pages_per_rpc = min_t(int, PTLRPC_MAX_BRW_PAGES, - LNET_MTU >> PAGE_SHIFT); + cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES; /* * set cl_chunkbits default value to PAGE_CACHE_SHIFT, diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 2c72177..501957c 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -281,10 +281,8 @@ static inline struct ll_inode_info *ll_i2info(struct inode *inode) return container_of(inode, struct ll_inode_info, lli_vfs_inode); } -/* default to about 40meg of readahead on a given system. That much tied - * up in 512k readahead requests serviced at 40ms each is about 1GB/s. - */ -#define SBI_DEFAULT_READAHEAD_MAX (40UL << (20 - PAGE_SHIFT)) +/* default to about 64M of readahead on a given system. */ +#define SBI_DEFAULT_READAHEAD_MAX (64UL << (20 - PAGE_SHIFT)) /* default to read-ahead full files smaller than 2MB on the second read */ #define SBI_DEFAULT_READAHEAD_WHOLE_MAX (2UL << (20 - PAGE_SHIFT)) @@ -321,6 +319,9 @@ struct ll_ra_info { struct ra_io_arg { unsigned long ria_start; /* start offset of read-ahead*/ unsigned long ria_end; /* end offset of read-ahead*/ + unsigned long ria_reserved; /* reserved pages for read-ahead */ + unsigned long ria_end_min; /* minimum end to cover current read */ + bool ria_eof; /* reach end of file */ /* If stride read pattern is detected, ria_stoff means where * stride read is started. Note: for normal read-ahead, the * value here is meaningless, and also it will not be accessed @@ -551,6 +552,11 @@ struct ll_readahead_state { */ unsigned long ras_window_start, ras_window_len; /* + * Optimal RPC size. It decides how many pages will be sent + * for each read-ahead. + */ + unsigned long ras_rpc_size; + /* * Where next read-ahead should start at. This lies within read-ahead * window. Read-ahead window is read in pieces rather than at once * because: 1. lustre limits total number of pages under read-ahead by diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index f10e092..18d3ccb 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -92,25 +92,6 @@ static unsigned long ll_ra_count_get(struct ll_sb_info *sbi, goto out; } - /* If the non-strided (ria_pages == 0) readahead window - * (ria_start + ret) has grown across an RPC boundary, then trim - * readahead size by the amount beyond the RPC so it ends on an - * RPC boundary. If the readahead window is already ending on - * an RPC boundary (beyond_rpc == 0), or smaller than a full - * RPC (beyond_rpc < ret) the readahead size is unchanged. - * The (beyond_rpc != 0) check is skipped since the conditional - * branch is more expensive than subtracting zero from the result. - * - * Strided read is left unaligned to avoid small fragments beyond - * the RPC boundary from needing an extra read RPC. - */ - if (ria->ria_pages == 0) { - long beyond_rpc = (ria->ria_start + ret) % PTLRPC_MAX_BRW_PAGES; - - if (/* beyond_rpc != 0 && */ beyond_rpc < ret) - ret -= beyond_rpc; - } - if (atomic_add_return(ret, &ra->ra_cur_pages) > ra->ra_max_pages) { atomic_sub(ret, &ra->ra_cur_pages); ret = 0; @@ -147,11 +128,12 @@ void ll_ra_stats_inc(struct inode *inode, enum ra_stat which) #define RAS_CDEBUG(ras) \ CDEBUG(D_READA, \ - "lrp %lu cr %lu cp %lu ws %lu wl %lu nra %lu r %lu ri %lu" \ - "csr %lu sf %lu sp %lu sl %lu\n", \ + "lrp %lu cr %lu cp %lu ws %lu wl %lu nra %lu rpc %lu " \ + "r %lu ri %lu csr %lu sf %lu sp %lu sl %lu\n", \ ras->ras_last_readpage, ras->ras_consecutive_requests, \ ras->ras_consecutive_pages, ras->ras_window_start, \ ras->ras_window_len, ras->ras_next_readahead, \ + ras->ras_rpc_size, \ ras->ras_requests, ras->ras_request_index, \ ras->ras_consecutive_stride_requests, ras->ras_stride_offset, \ ras->ras_stride_pages, ras->ras_stride_length) @@ -261,20 +243,6 @@ static int ll_read_ahead_page(const struct lu_env *env, struct cl_io *io, ria->ria_start, ria->ria_end, ria->ria_stoff, ria->ria_length,\ ria->ria_pages) -/* Limit this to the blocksize instead of PTLRPC_BRW_MAX_SIZE, since we don't - * know what the actual RPC size is. If this needs to change, it makes more - * sense to tune the i_blkbits value for the file based on the OSTs it is - * striped over, rather than having a constant value for all files here. - */ - -/* RAS_INCREASE_STEP should be (1UL << (inode->i_blkbits - PAGE_SHIFT)). - * Temporarily set RAS_INCREASE_STEP to 1MB. After 4MB RPC is enabled - * by default, this should be adjusted corresponding with max_read_ahead_mb - * and max_read_ahead_per_file_mb otherwise the readahead budget can be used - * up quickly which will affect read performance significantly. See LU-2816 - */ -#define RAS_INCREASE_STEP(inode) (ONE_MB_BRW_SIZE >> PAGE_SHIFT) - static inline int stride_io_mode(struct ll_readahead_state *ras) { return ras->ras_consecutive_stride_requests > 1; @@ -345,6 +313,17 @@ static int ria_page_count(struct ra_io_arg *ria) length); } +static unsigned long ras_align(struct ll_readahead_state *ras, + unsigned long index, + unsigned long *remainder) +{ + unsigned long rem = index % ras->ras_rpc_size; + + if (remainder) + *remainder = rem; + return index - rem; +} + /*Check whether the index is in the defined ra-window */ static int ras_inside_ra_window(unsigned long idx, struct ra_io_arg *ria) { @@ -358,42 +337,63 @@ static int ras_inside_ra_window(unsigned long idx, struct ra_io_arg *ria) ria->ria_length < ria->ria_pages); } -static int ll_read_ahead_pages(const struct lu_env *env, - struct cl_io *io, struct cl_page_list *queue, - struct ra_io_arg *ria, - unsigned long *reserved_pages, - pgoff_t *ra_end) +static unsigned long +ll_read_ahead_pages(const struct lu_env *env, struct cl_io *io, + struct cl_page_list *queue, struct ll_readahead_state *ras, + struct ra_io_arg *ria) { struct cl_read_ahead ra = { 0 }; - int rc, count = 0; + unsigned long ra_end = 0; bool stride_ria; pgoff_t page_idx; + int rc; LASSERT(ria); RIA_DEBUG(ria); stride_ria = ria->ria_length > ria->ria_pages && ria->ria_pages > 0; for (page_idx = ria->ria_start; - page_idx <= ria->ria_end && *reserved_pages > 0; page_idx++) { + page_idx <= ria->ria_end && ria->ria_reserved > 0; page_idx++) { if (ras_inside_ra_window(page_idx, ria)) { if (!ra.cra_end || ra.cra_end < page_idx) { + unsigned long end; + cl_read_ahead_release(env, &ra); rc = cl_io_read_ahead(env, io, page_idx, &ra); if (rc < 0) break; + CDEBUG(D_READA, "idx: %lu, ra: %lu, rpc: %lu\n", + page_idx, ra.cra_end, ra.cra_rpc_size); LASSERTF(ra.cra_end >= page_idx, "object: %p, indcies %lu / %lu\n", io->ci_obj, ra.cra_end, page_idx); + /* + * update read ahead RPC size. + * NB: it's racy but doesn't matter + */ + if (ras->ras_rpc_size > ra.cra_rpc_size && + ra.cra_rpc_size > 0) + ras->ras_rpc_size = ra.cra_rpc_size; + /* trim it to align with optimal RPC size */ + end = ras_align(ras, ria->ria_end + 1, NULL); + if (end > 0 && !ria->ria_eof) + ria->ria_end = end - 1; + if (ria->ria_end < ria->ria_end_min) + ria->ria_end = ria->ria_end_min; + if (ria->ria_end > ra.cra_end) + ria->ria_end = ra.cra_end; } - /* If the page is inside the read-ahead window*/ + /* If the page is inside the read-ahead window */ rc = ll_read_ahead_page(env, io, queue, page_idx); - if (!rc) { - (*reserved_pages)--; - count++; - } + if (rc < 0) + break; + + ra_end = page_idx; + if (!rc) + ria->ria_reserved--; } else if (stride_ria) { /* If it is not in the read-ahead window, and it is * read-ahead mode, then check whether it should skip @@ -420,8 +420,7 @@ static int ll_read_ahead_pages(const struct lu_env *env, } cl_read_ahead_release(env, &ra); - *ra_end = page_idx; - return count; + return ra_end; } static int ll_readahead(const struct lu_env *env, struct cl_io *io, @@ -431,7 +430,7 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, struct vvp_io *vio = vvp_env_io(env); struct ll_thread_info *lti = ll_env_info(env); struct cl_attr *attr = vvp_env_thread_attr(env); - unsigned long len, mlen = 0, reserved; + unsigned long len, mlen = 0; pgoff_t ra_end, start = 0, end = 0; struct inode *inode; struct ra_io_arg *ria = <i->lti_ria; @@ -478,29 +477,15 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, end < vio->vui_ra_start + vio->vui_ra_count - 1) end = vio->vui_ra_start + vio->vui_ra_count - 1; - if (end != 0) { - unsigned long rpc_boundary; - /* - * Align RA window to an optimal boundary. - * - * XXX This would be better to align to cl_max_pages_per_rpc - * instead of PTLRPC_MAX_BRW_PAGES, because the RPC size may - * be aligned to the RAID stripe size in the future and that - * is more important than the RPC size. - */ - /* Note: we only trim the RPC, instead of extending the RPC - * to the boundary, so to avoid reading too much pages during - * random reading. - */ - rpc_boundary = (end + 1) & (~(PTLRPC_MAX_BRW_PAGES - 1)); - if (rpc_boundary > 0) - rpc_boundary--; - - if (rpc_boundary > start) - end = rpc_boundary; + if (end) { + unsigned long end_index; /* Truncate RA window to end of file */ - end = min(end, (unsigned long)((kms - 1) >> PAGE_SHIFT)); + end_index = (unsigned long)((kms - 1) >> PAGE_SHIFT); + if (end_index <= end) { + end = end_index; + ria->ria_eof = true; + } ras->ras_next_readahead = max(end, end + 1); RAS_CDEBUG(ras); @@ -535,28 +520,31 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, /* at least to extend the readahead window to cover current read */ if (!hit && vio->vui_ra_valid && vio->vui_ra_start + vio->vui_ra_count > ria->ria_start) { + unsigned long remainder; + /* to the end of current read window. */ mlen = vio->vui_ra_start + vio->vui_ra_count - ria->ria_start; /* trim to RPC boundary */ - start = ria->ria_start & (PTLRPC_MAX_BRW_PAGES - 1); - mlen = min(mlen, PTLRPC_MAX_BRW_PAGES - start); + ras_align(ras, ria->ria_start, &remainder); + mlen = min(mlen, ras->ras_rpc_size - remainder); + ria->ria_end_min = ria->ria_start + mlen; } - reserved = ll_ra_count_get(ll_i2sbi(inode), ria, len, mlen); - if (reserved < len) + ria->ria_reserved = ll_ra_count_get(ll_i2sbi(inode), ria, len, mlen); + if (ria->ria_reserved < len) ll_ra_stats_inc(inode, RA_STAT_MAX_IN_FLIGHT); CDEBUG(D_READA, "reserved pages %lu/%lu/%lu, ra_cur %d, ra_max %lu\n", - reserved, len, mlen, + ria->ria_reserved, len, mlen, atomic_read(&ll_i2sbi(inode)->ll_ra_info.ra_cur_pages), ll_i2sbi(inode)->ll_ra_info.ra_max_pages); - ret = ll_read_ahead_pages(env, io, queue, ria, &reserved, &ra_end); + ra_end = ll_read_ahead_pages(env, io, queue, ras, ria); - if (reserved != 0) - ll_ra_count_put(ll_i2sbi(inode), reserved); + if (ria->ria_reserved) + ll_ra_count_put(ll_i2sbi(inode), ria->ria_reserved); - if (ra_end == end + 1 && ra_end == (kms >> PAGE_SHIFT)) + if (ra_end == end && ra_end == (kms >> PAGE_SHIFT)) ll_ra_stats_inc(inode, RA_STAT_EOF); /* if we didn't get to the end of the region we reserved from @@ -568,13 +556,13 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, CDEBUG(D_READA, "ra_end = %lu end = %lu stride end = %lu pages = %d\n", ra_end, end, ria->ria_end, ret); - if (ra_end != end + 1) { + if (ra_end > 0 && ra_end != end) { ll_ra_stats_inc(inode, RA_STAT_FAILED_REACH_END); spin_lock(&ras->ras_lock); - if (ra_end < ras->ras_next_readahead && + if (ra_end <= ras->ras_next_readahead && index_in_window(ra_end, ras->ras_window_start, 0, ras->ras_window_len)) { - ras->ras_next_readahead = ra_end; + ras->ras_next_readahead = ra_end + 1; RAS_CDEBUG(ras); } spin_unlock(&ras->ras_lock); @@ -586,7 +574,7 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, static void ras_set_start(struct inode *inode, struct ll_readahead_state *ras, unsigned long index) { - ras->ras_window_start = index & (~(RAS_INCREASE_STEP(inode) - 1)); + ras->ras_window_start = ras_align(ras, index, NULL); } /* called with the ras_lock held or from places where it doesn't matter */ @@ -615,6 +603,7 @@ static void ras_stride_reset(struct ll_readahead_state *ras) void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras) { spin_lock_init(&ras->ras_lock); + ras->ras_rpc_size = PTLRPC_MAX_BRW_PAGES; ras_reset(inode, ras, 0); ras->ras_requests = 0; } @@ -719,12 +708,15 @@ static void ras_increase_window(struct inode *inode, * but current clio architecture does not support retrieve such * information from lower layer. FIXME later */ - if (stride_io_mode(ras)) - ras_stride_increase_window(ras, ra, RAS_INCREASE_STEP(inode)); - else - ras->ras_window_len = min(ras->ras_window_len + - RAS_INCREASE_STEP(inode), - ra->ra_max_pages_per_file); + if (stride_io_mode(ras)) { + ras_stride_increase_window(ras, ra, ras->ras_rpc_size); + } else { + unsigned long wlen; + + wlen = min(ras->ras_window_len + ras->ras_rpc_size, + ra->ra_max_pages_per_file); + ras->ras_window_len = ras_align(ras, wlen, NULL); + } } static void ras_update(struct ll_sb_info *sbi, struct inode *inode, @@ -852,6 +844,8 @@ static void ras_update(struct ll_sb_info *sbi, struct inode *inode, * instead of ras_window_start, which is RPC aligned */ ras->ras_next_readahead = max(index, ras->ras_next_readahead); + ras->ras_window_start = max(ras->ras_stride_offset, + ras->ras_window_start); } else { if (ras->ras_next_readahead < ras->ras_window_start) ras->ras_next_readahead = ras->ras_window_start; @@ -881,7 +875,7 @@ static void ras_update(struct ll_sb_info *sbi, struct inode *inode, */ ras->ras_next_readahead = max(index, ras->ras_next_readahead); ras->ras_stride_offset = index; - ras->ras_window_len = RAS_INCREASE_STEP(inode); + ras->ras_window_start = max(index, ras->ras_window_start); } /* The initial ras_window_len is set to the request size. To avoid @@ -1098,38 +1092,39 @@ static int ll_io_read_page(const struct lu_env *env, struct cl_io *io, struct cl_2queue *queue = &io->ci_queue; struct ll_sb_info *sbi = ll_i2sbi(inode); struct vvp_page *vpg; + bool uptodate; int rc = 0; vpg = cl2vvp_page(cl_object_page_slice(page->cp_obj, page)); + uptodate = vpg->vpg_defer_uptodate; + if (sbi->ll_ra_info.ra_max_pages_per_file > 0 && sbi->ll_ra_info.ra_max_pages > 0) { struct vvp_io *vio = vvp_env_io(env); enum ras_update_flags flags = 0; - if (vpg->vpg_defer_uptodate) + if (uptodate) flags |= LL_RAS_HIT; if (!vio->vui_ra_valid) flags |= LL_RAS_MMAP; ras_update(sbi, inode, ras, vvp_index(vpg), flags); } - if (vpg->vpg_defer_uptodate) { + cl_2queue_init(queue); + if (uptodate) { vpg->vpg_ra_used = 1; cl_page_export(env, page, 1); + cl_page_disown(env, io, page); + } else { + cl_page_list_add(&queue->c2_qin, page); } - cl_2queue_init(queue); - /* - * Add page into the queue even when it is marked uptodate above. - * this will unlock it automatically as part of cl_page_list_disown(). - */ - cl_page_list_add(&queue->c2_qin, page); if (sbi->ll_ra_info.ra_max_pages_per_file > 0 && sbi->ll_ra_info.ra_max_pages > 0) { int rc2; rc2 = ll_readahead(env, io, &queue->c2_qin, ras, - vpg->vpg_defer_uptodate); + uptodate); CDEBUG(D_READA, DFID "%d pages read ahead at %lu\n", PFID(ll_inode2fid(inode)), rc2, vvp_index(vpg)); } diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 9402dfc..7e5cd3a 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -99,6 +99,7 @@ static int osc_io_read_ahead(const struct lu_env *env, ldlm_lock_decref(&lockh, dlmlock->l_req_mode); } + ra->cra_rpc_size = osc_cli(osc)->cl_max_pages_per_rpc; ra->cra_end = cl_index(osc2cl(osc), dlmlock->l_policy_data.l_extent.end); ra->cra_release = osc_read_ahead_release; @@ -138,7 +139,7 @@ static int osc_io_submit(const struct lu_env *env, LASSERT(qin->pl_nr > 0); - CDEBUG(D_CACHE, "%d %d\n", qin->pl_nr, crt); + CDEBUG(D_CACHE | D_READA, "%d %d\n", qin->pl_nr, crt); osc = cl2osc(ios->cis_obj); cli = osc_cli(osc); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:37 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:37 -0500 Subject: [lustre-devel] [PATCH 09/60] staging: lustre: lmv: Correctly generate target_obd In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-10-git-send-email-jsimmons@infradead.org> From: Giuseppe Di Natale The target_obd debugfs file was not being generated correctly in cases where nonconsecutive MDT indices were used when generating a filesystem. Signed-off-by: Giuseppe Di Natale Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8100 Reviewed-on: http://review.whamcloud.com/20336 Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c index 20bbdfc..14fbc9c 100644 --- a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c +++ b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c @@ -147,7 +147,13 @@ static void *lmv_tgt_seq_start(struct seq_file *p, loff_t *pos) struct obd_device *dev = p->private; struct lmv_obd *lmv = &dev->u.lmv; - return (*pos >= lmv->desc.ld_tgt_count) ? NULL : lmv->tgts[*pos]; + while (*pos < lmv->tgts_size) { + if (lmv->tgts[*pos]) + return lmv->tgts[*pos]; + ++*pos; + } + + return NULL; } static void lmv_tgt_seq_stop(struct seq_file *p, void *v) @@ -159,8 +165,15 @@ static void *lmv_tgt_seq_next(struct seq_file *p, void *v, loff_t *pos) { struct obd_device *dev = p->private; struct lmv_obd *lmv = &dev->u.lmv; + ++*pos; - return (*pos >= lmv->desc.ld_tgt_count) ? NULL : lmv->tgts[*pos]; + while (*pos < lmv->tgts_size) { + if (lmv->tgts[*pos]) + return lmv->tgts[*pos]; + ++*pos; + } + + return NULL; } static int lmv_tgt_seq_show(struct seq_file *p, void *v) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:38 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:38 -0500 Subject: [lustre-devel] [PATCH 10/60] staging: lustre: obdclass: add more info to sysfs version string In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-11-git-send-email-jsimmons@infradead.org> From: Andreas Dilger Update the sysfs "version" file to print "lustre: " with the version number. Signed-off-by: Andreas Dilger Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5969 Reviewed-on: http://review.whamcloud.com/16721 Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c index 9f5e829..22e6d1f 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c @@ -208,7 +208,7 @@ struct miscdevice obd_psdev = { static ssize_t version_show(struct kobject *kobj, struct attribute *attr, char *buf) { - return sprintf(buf, "%s\n", LUSTRE_VERSION_STRING); + return sprintf(buf, "lustre: %s\n", LUSTRE_VERSION_STRING); } static ssize_t pinger_show(struct kobject *kobj, struct attribute *attr, -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:40 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:40 -0500 Subject: [lustre-devel] [PATCH 12/60] staging: lustre: lmv: Error not handled for lmv_find_target In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-13-git-send-email-jsimmons@infradead.org> From: Ulka Vaze This issue is found by smatch; has been reported as- Unchecked usage of potential ERR_PTR result in lmv_hsm_req_count and lmv_hsm_req_build. Added ERR_PTR in both functions and also return value check added. Signed-off-by: Ulka Vaze Signed-off-by: Aditya Pandit Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6523 Reviewed-on: http://review.whamcloud.com/14918 Reviewed-by: Dmitry Eremin Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 6a3b83f..915415c 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -736,16 +736,18 @@ static int lmv_hsm_req_count(struct lmv_obd *lmv, /* count how many requests must be sent to the given target */ for (i = 0; i < hur->hur_request.hr_itemcount; i++) { curr_tgt = lmv_find_target(lmv, &hur->hur_user_item[i].hui_fid); + if (IS_ERR(curr_tgt)) + return PTR_ERR(curr_tgt); if (obd_uuid_equals(&curr_tgt->ltd_uuid, &tgt_mds->ltd_uuid)) nr++; } return nr; } -static void lmv_hsm_req_build(struct lmv_obd *lmv, - struct hsm_user_request *hur_in, - const struct lmv_tgt_desc *tgt_mds, - struct hsm_user_request *hur_out) +static int lmv_hsm_req_build(struct lmv_obd *lmv, + struct hsm_user_request *hur_in, + const struct lmv_tgt_desc *tgt_mds, + struct hsm_user_request *hur_out) { int i, nr_out; struct lmv_tgt_desc *curr_tgt; @@ -756,6 +758,8 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv, for (i = 0; i < hur_in->hur_request.hr_itemcount; i++) { curr_tgt = lmv_find_target(lmv, &hur_in->hur_user_item[i].hui_fid); + if (IS_ERR(curr_tgt)) + return PTR_ERR(curr_tgt); if (obd_uuid_equals(&curr_tgt->ltd_uuid, &tgt_mds->ltd_uuid)) { hur_out->hur_user_item[nr_out] = hur_in->hur_user_item[i]; @@ -765,6 +769,8 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv, hur_out->hur_request.hr_itemcount = nr_out; memcpy(hur_data(hur_out), hur_data(hur_in), hur_in->hur_request.hr_data_len); + + return 0; } static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len, @@ -1041,15 +1047,17 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, } else { /* split fid list to their respective MDS */ for (i = 0; i < count; i++) { - unsigned int nr, reqlen; - int rc1; struct hsm_user_request *req; + size_t reqlen; + int nr, rc1; tgt = lmv->tgts[i]; if (!tgt || !tgt->ltd_exp) continue; nr = lmv_hsm_req_count(lmv, hur, tgt); + if (nr < 0) + return nr; if (nr == 0) /* nothing for this MDS */ continue; @@ -1061,10 +1069,13 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, if (!req) return -ENOMEM; - lmv_hsm_req_build(lmv, hur, tgt, req); + rc1 = lmv_hsm_req_build(lmv, hur, tgt, req); + if (rc1 < 0) + goto hsm_req_err; rc1 = obd_iocontrol(cmd, tgt->ltd_exp, reqlen, req, uarg); +hsm_req_err: if (rc1 != 0 && rc == 0) rc = rc1; kvfree(req); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:50 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:50 -0500 Subject: [lustre-devel] [PATCH 22/60] staging: lustre: fid: fix race in fid allocation In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-23-git-send-email-jsimmons@infradead.org> From: Fan Yong There is race condition when allocating fid/seq in parallel as following: The thread1 will release the lcs_mutex via seq_fid_alloc_prep(), then another fid allocation thread2 can obtain the lcs_mutex and allocate FID in the new sequence that has just been allocated by the thread1 via seq_client_alloc_seq(); and then after thread2 released the lcs_mutex, the thread1 will re-allocate the current FID in the new sequence without checking whether some others have already taken such FID in the new sequence during it re-obtaining the lcs_mutex. Such race will cause two objects to use the same FID, and trigger OI conflict and LMA verification failures. This patch makes the fid allocation and lu_client_seq modification to be protected by the lcs_mutex. Signed-off-by: Fan Yong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8319 Reviewed-on: http://review.whamcloud.com/20939 Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/fid/fid_request.c | 55 ++++++++++++++++--------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 999f250..62a9f7e 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -211,12 +211,35 @@ static int seq_fid_alloc_prep(struct lu_client_seq *seq, return 0; } -static void seq_fid_alloc_fini(struct lu_client_seq *seq) +static void seq_fid_alloc_fini(struct lu_client_seq *seq, u64 seqnr, + bool whole) { LASSERT(seq->lcs_update == 1); + mutex_lock(&seq->lcs_mutex); + if (seqnr != 0) { + CDEBUG(D_INFO, "%s: New sequence [0x%16.16llx]\n", + seq->lcs_name, seqnr); + + seq->lcs_fid.f_seq = seqnr; + if (whole) { + /* + * Since the caller require the whole seq, + * so marked this seq to be used + */ + if (seq->lcs_type == LUSTRE_SEQ_METADATA) + seq->lcs_fid.f_oid = + LUSTRE_METADATA_SEQ_MAX_WIDTH; + else + seq->lcs_fid.f_oid = LUSTRE_DATA_SEQ_MAX_WIDTH; + } else { + seq->lcs_fid.f_oid = LUSTRE_FID_INIT_OID; + } + seq->lcs_fid.f_ver = 0; + } + --seq->lcs_update; - wake_up(&seq->lcs_waitq); + wake_up_all(&seq->lcs_waitq); } /* Allocate new fid on passed client @seq and save it to @fid. */ @@ -238,41 +261,33 @@ int seq_client_alloc_fid(const struct lu_env *env, while (1) { u64 seqnr; - if (!fid_is_zero(&seq->lcs_fid) && - fid_oid(&seq->lcs_fid) < seq->lcs_width) { + if (unlikely(!fid_is_zero(&seq->lcs_fid) && + fid_oid(&seq->lcs_fid) < seq->lcs_width)) { /* Just bump last allocated fid and return to caller. */ - seq->lcs_fid.f_oid += 1; + seq->lcs_fid.f_oid++; rc = 0; break; } + /* + * Release seq::lcs_mutex via seq_fid_alloc_prep() to avoid + * deadlock during seq_client_alloc_seq(). + */ rc = seq_fid_alloc_prep(seq, &link); if (rc) continue; rc = seq_client_alloc_seq(env, seq, &seqnr); + /* Re-take seq::lcs_mutex via seq_fid_alloc_fini(). */ + seq_fid_alloc_fini(seq, rc ? 0 : seqnr, false); if (rc) { - CERROR("%s: Can't allocate new sequence, rc %d\n", + CERROR("%s: Can't allocate new sequence, rc = %d\n", seq->lcs_name, rc); - seq_fid_alloc_fini(seq); mutex_unlock(&seq->lcs_mutex); return rc; } - CDEBUG(D_INFO, "%s: Switch to sequence [0x%16.16Lx]\n", - seq->lcs_name, seqnr); - - seq->lcs_fid.f_oid = LUSTRE_FID_INIT_OID; - seq->lcs_fid.f_seq = seqnr; - seq->lcs_fid.f_ver = 0; - - /* - * Inform caller that sequence switch is performed to allow it - * to setup FLD for it. - */ rc = 1; - - seq_fid_alloc_fini(seq); break; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:12 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:12 -0500 Subject: [lustre-devel] [PATCH 44/60] staging: lustre: libcfs: fix error messages In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-45-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Don't treat unability to set CPU partition affinity as error. Improve those warning messages. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8703 Reviewed-on: https://review.whamcloud.com/23307 Reviewed-by: Patrick Farrell Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 4 ++-- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 5 +++-- drivers/staging/lustre/lnet/libcfs/workitem.c | 2 +- drivers/staging/lustre/lnet/selftest/module.c | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 14dbc53..e2f3f72 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -3546,7 +3546,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, rc = cfs_cpt_bind(lnet_cpt_table(), sched->ibs_cpt); if (rc) { - CWARN("Failed to bind on CPT %d, please verify whether all CPUs are healthy and reload modules if necessary, otherwise your system might under risk of low performance\n", + CWARN("Unable to bind on CPU partition %d, please verify whether all CPUs are healthy and reload modules if necessary, otherwise your system might under risk of low performance\n", sched->ibs_cpt); } diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 3531e7d..df4f55e 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -1414,8 +1414,8 @@ int ksocknal_scheduler(void *arg) rc = cfs_cpt_bind(lnet_cpt_table(), info->ksi_cpt); if (rc) { - CERROR("Can't set CPT affinity to %d: %d\n", - info->ksi_cpt, rc); + CWARN("Can't set CPU partition affinity to %d: %d\n", + info->ksi_cpt, rc); } spin_lock_bh(&sched->kss_lock); diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index 62ab76e..4d35a37 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -1082,8 +1082,9 @@ static int cfs_cpu_dead(unsigned int cpu) } spin_unlock(&cpt_data.cpt_lock); - LCONSOLE(0, "HW CPU cores: %d, npartitions: %d\n", - num_online_cpus(), cfs_cpt_number(cfs_cpt_table)); + LCONSOLE(0, "HW nodes: %d, HW CPU cores: %d, npartitions: %d\n", + num_online_nodes(), num_online_cpus(), + cfs_cpt_number(cfs_cpt_table)); return 0; failed: diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c b/drivers/staging/lustre/lnet/libcfs/workitem.c index d0512da..dbc2a9b 100644 --- a/drivers/staging/lustre/lnet/libcfs/workitem.c +++ b/drivers/staging/lustre/lnet/libcfs/workitem.c @@ -209,7 +209,7 @@ static int cfs_wi_scheduler(void *arg) /* CPT affinity scheduler? */ if (sched->ws_cptab) if (cfs_cpt_bind(sched->ws_cptab, sched->ws_cpt)) - CWARN("Failed to bind %s on CPT %d\n", + CWARN("Unable to bind %s on CPU partition %d\n", sched->ws_name, sched->ws_cpt); spin_lock(&cfs_wi_data.wi_glock); diff --git a/drivers/staging/lustre/lnet/selftest/module.c b/drivers/staging/lustre/lnet/selftest/module.c index 71485f9..b5d556f 100644 --- a/drivers/staging/lustre/lnet/selftest/module.c +++ b/drivers/staging/lustre/lnet/selftest/module.c @@ -112,7 +112,8 @@ enum { rc = cfs_wi_sched_create("lst_t", lnet_cpt_table(), i, nthrs, &lst_sched_test[i]); if (rc) { - CERROR("Failed to create CPT affinity WI scheduler %d for LST\n", i); + CWARN("Failed to create CPU partition affinity WI scheduler %d for LST\n", + i); goto error; } } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:11 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:11 -0500 Subject: [lustre-devel] [PATCH 43/60] staging: lustre: obd: remove OBD_NOTIFY_CREATE In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-44-git-send-email-jsimmons@infradead.org> From: "John L. Hammond" None of the obd_notify() handlers listen for the OBD_NOTIFY_CREATE event, so remove it and its sole use in lov_add_target(). Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8403 Reviewed-on: https://review.whamcloud.com/21420 Reviewed-by: Ben Evans Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 2 -- drivers/staging/lustre/lustre/lov/lov_obd.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index ab47078..4ce8506 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -475,8 +475,6 @@ struct niobuf_local { * Events signalled through obd_notify() upcall-chain. */ enum obd_notify_event { - /* target added */ - OBD_NOTIFY_CREATE, /* Device connect start */ OBD_NOTIFY_CONNECT, /* Device activated */ diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 63b0645..b3161fb 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -592,8 +592,6 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, CDEBUG(D_CONFIG, "idx=%d ltd_gen=%d ld_tgt_count=%d\n", index, tgt->ltd_gen, lov->desc.ld_tgt_count); - rc = obd_notify(obd, tgt_obd, OBD_NOTIFY_CREATE, &index); - if (lov->lov_connects == 0) { /* lov_connect hasn't been called yet. We'll do the * lov_connect_obd on this target when that fn first runs, -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:15 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:15 -0500 Subject: [lustre-devel] [PATCH 47/60] staging: lustre: mdc: avoid returning freed request In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-48-git-send-email-jsimmons@infradead.org> From: "John L. Hammond" In mdc_close() if ptlrpc_request_pack() fails then set req to NULL so that an already freed request is not returned in *request. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8811 Reviewed-on: https://review.whamcloud.com/23843 Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 02f57d8..a12035d 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -762,6 +762,7 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_CLOSE); if (rc) { ptlrpc_request_free(req); + req = NULL; goto out; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:41 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:41 -0500 Subject: [lustre-devel] [PATCH 13/60] staging: lustre: obdclass: health_check to report unhealthy upon LBUG In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-14-git-send-email-jsimmons@infradead.org> From: Bruno Faccini When a LBUG has occurred, without panic_on_lbug being set, health_check sysfs file must return an unhealthy state. Signed-off-by: Bruno Faccini Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7486 Reviewed-on: http://review.whamcloud.com/17981 Reviewed-by: Bobi Jam Reviewed-by: Niu Yawei Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c index 22e6d1f..ef25db6 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c @@ -224,8 +224,10 @@ static ssize_t pinger_show(struct kobject *kobj, struct attribute *attr, int i; size_t len = 0; - if (libcfs_catastrophe) - return sprintf(buf, "LBUG\n"); + if (libcfs_catastrophe) { + len = sprintf(buf, "LBUG\n"); + healthy = false; + } read_lock(&obd_dev_lock); for (i = 0; i < class_devno_max(); i++) { -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:45 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:45 -0500 Subject: [lustre-devel] [PATCH 17/60] staging: lustre: obdclass: do not call lu_site_purge() for single object exceed In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-18-git-send-email-jsimmons@infradead.org> From: Alex Zhuravlev First of all, this is expensive procedure including a global mutex and per-bucket spinlocks. also, all the threads observed exceed will be calling lu_site_purge() and essentially serialized on that. instead we can let other threads to skip the whole procedure. Signed-off-by: Alex Zhuravlev Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7896 Reviewed-on: http://review.whamcloud.com/19082 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lu_object.h | 8 ++++++- drivers/staging/lustre/lustre/obdclass/lu_object.c | 26 +++++++++++++++------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index f442a96..c7dee1d 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -712,8 +712,14 @@ static inline int lu_object_is_dying(const struct lu_object_header *h) void lu_object_put(const struct lu_env *env, struct lu_object *o); void lu_object_unhash(const struct lu_env *env, struct lu_object *o); +int lu_site_purge_objects(const struct lu_env *env, struct lu_site *s, int nr, + bool canblock); -int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr); +static inline int lu_site_purge(const struct lu_env *env, struct lu_site *s, + int nr) +{ + return lu_site_purge_objects(env, s, nr, true); +} void lu_site_print(const struct lu_env *env, struct lu_site *s, void *cookie, lu_printer_t printer); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 1805861..abcf951 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -60,7 +60,7 @@ enum { LU_CACHE_PERCENT_DEFAULT = 20 }; -#define LU_CACHE_NR_MAX_ADJUST 128 +#define LU_CACHE_NR_MAX_ADJUST 512 #define LU_CACHE_NR_UNLIMITED -1 #define LU_CACHE_NR_DEFAULT LU_CACHE_NR_UNLIMITED #define LU_CACHE_NR_LDISKFS_LIMIT LU_CACHE_NR_UNLIMITED @@ -329,8 +329,11 @@ static void lu_object_free(const struct lu_env *env, struct lu_object *o) /** * Free \a nr objects from the cold end of the site LRU list. + * if canblock is false, then don't block awaiting for another + * instance of lu_site_purge() to complete */ -int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) +int lu_site_purge_objects(const struct lu_env *env, struct lu_site *s, + int nr, bool canblock) { struct lu_object_header *h; struct lu_object_header *temp; @@ -360,7 +363,11 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) * It doesn't make any sense to make purge threads parallel, that can * only bring troubles to us. See LU-5331. */ - mutex_lock(&s->ls_purge_mutex); + if (canblock) + mutex_lock(&s->ls_purge_mutex); + else if (!mutex_trylock(&s->ls_purge_mutex)) + goto out; + did_sth = 0; cfs_hash_for_each_bucket(s->ls_obj_hash, &bd, i) { if (i < start) @@ -414,10 +421,10 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) } /* race on s->ls_purge_start, but nobody cares */ s->ls_purge_start = i % CFS_HASH_NBKT(s->ls_obj_hash); - +out: return nr; } -EXPORT_SYMBOL(lu_site_purge); +EXPORT_SYMBOL(lu_site_purge_objects); /* * Object printing. @@ -625,9 +632,12 @@ static void lu_object_limit(const struct lu_env *env, struct lu_device *dev) size = cfs_hash_size_get(dev->ld_site->ls_obj_hash); nr = (__u64)lu_cache_nr; - if (size > nr) - lu_site_purge(env, dev->ld_site, - min_t(__u64, size - nr, LU_CACHE_NR_MAX_ADJUST)); + if (size <= nr) + return; + + lu_site_purge_objects(env, dev->ld_site, + min_t(__u64, size - nr, LU_CACHE_NR_MAX_ADJUST), + false); } static struct lu_object *lu_object_new(const struct lu_env *env, -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:49 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:49 -0500 Subject: [lustre-devel] [PATCH 21/60] staging: lustre: ptlrpc: correct use of list_add_tail() In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-22-git-send-email-jsimmons@infradead.org> From: "John L. Hammond" In sptlrpc_gc_add_sec() swap the arguments to list_add_tail() so that it does what we meant it to do. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8270 Reviewed-on: http://review.whamcloud.com/20784 Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/sec_gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c index 8ffd000..026bec7 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_gc.c @@ -66,7 +66,7 @@ void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec) sec->ps_gc_next = ktime_get_real_seconds() + sec->ps_gc_interval; spin_lock(&sec_gc_list_lock); - list_add_tail(&sec_gc_list, &sec->ps_gc_list); + list_add_tail(&sec->ps_gc_list, &sec_gc_list); spin_unlock(&sec_gc_list_lock); CDEBUG(D_SEC, "added sec %p(%s)\n", sec, sec->ps_policy->sp_name); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:55 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:55 -0500 Subject: [lustre-devel] [PATCH 27/60] staging: lustre: mgc: handle config_llog_data::cld_refcount properly In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-28-git-send-email-jsimmons@infradead.org> From: Fan Yong Originally, the logic of handling config_llog_data::cld_refcount is some confusing, it may cause the cld_refcount to be leaked or trigger "LASSERT(atomic_read(&cld->cld_refcount) > 0);" when put the reference. This patch clean related logic as following: 1) When the 'cld' is created, its reference is set as 1. 2) No need additional reference when add the 'cld' into the list 'config_llog_list'. 3) Inrease 'cld_refcount' when set lock data after mgc_enqueue() done successfully by mgc_process_log(). 4) When mgc_requeue_thread() traversals the 'config_llog_list', it needs to take additional reference on each 'cld' to avoid being freed during subsequent processing. The reference also prevents the 'cld' to be dropped from the 'config_llog_list', then the mgc_requeue_thread() can safely locate next 'cld', and then decrease the 'cld_refcount' for previous one. 5) mgc_blocking_ast() will drop the reference of 'cld_refcount' that is taken in mgc_process_log(). 6) The others need to call config_log_find() to find the 'cld' if want to access related config log data. That will increase the 'cld_refcount' to avoid being freed during accessing. The sponsor needs to call config_log_put() after using the 'cld'. 7) Other confused or redundant logic are dropped. On the other hand, the patch also enhances the protection for 'config_llog_data' flags, such as 'cld_stopping'/'cld_lostlock' as following. a) Use 'config_list_lock' (spinlock) to handle the possible parallel accessing of these flags among mgc_requeue_thread() and others config llog data visitors, such as mount/umount, blocking_ast, and so on. b) Use 'config_llog_data::cld_lock' (mutex) to pretect other parallel accessing of these flags among kinds of blockable operations, such as mount, umount, and blocking ast. The 'config_llog_data::cld_lock' is also used for protecting the sub-cld members, such as 'cld_sptlrpc'/'cld_params', and so on. Signed-off-by: Fan Yong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8408 Reviewed-on: http://review.whamcloud.com/21616 Reviewed-by: Alex Zhuravlev Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 183 ++++++++++++------------ 1 file changed, 94 insertions(+), 89 deletions(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index b9c522a..6a76605 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -142,10 +142,10 @@ static void config_log_put(struct config_llog_data *cld) if (cld->cld_recover) config_log_put(cld->cld_recover); - if (cld->cld_sptlrpc) - config_log_put(cld->cld_sptlrpc); if (cld->cld_params) config_log_put(cld->cld_params); + if (cld->cld_sptlrpc) + config_log_put(cld->cld_sptlrpc); if (cld_is_sptlrpc(cld)) sptlrpc_conf_log_stop(cld->cld_logname); @@ -175,13 +175,10 @@ struct config_llog_data *config_log_find(char *logname, /* instance may be NULL, should check name */ if (strcmp(logname, cld->cld_logname) == 0) { found = cld; + config_log_get(found); break; } } - if (found) { - atomic_inc(&found->cld_refcount); - LASSERT(found->cld_stopping == 0 || cld_is_sptlrpc(found) == 0); - } spin_unlock(&config_list_lock); return found; } @@ -203,6 +200,12 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, if (!cld) return ERR_PTR(-ENOMEM); + rc = mgc_logname2resid(logname, &cld->cld_resid, type); + if (rc) { + kfree(cld); + return ERR_PTR(rc); + } + strcpy(cld->cld_logname, logname); if (cfg) cld->cld_cfg = *cfg; @@ -223,17 +226,10 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, cld->cld_cfg.cfg_obdname = obd->obd_name; } - rc = mgc_logname2resid(logname, &cld->cld_resid, type); - spin_lock(&config_list_lock); list_add(&cld->cld_list_chain, &config_llog_list); spin_unlock(&config_list_lock); - if (rc) { - config_log_put(cld); - return ERR_PTR(rc); - } - if (cld_is_sptlrpc(cld)) { rc = mgc_process_log(obd, cld); if (rc && rc != -ENOENT) @@ -284,14 +280,15 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, * We have one active log per "mount" - client instance or servername. * Each instance may be at a different point in the log. */ -static int config_log_add(struct obd_device *obd, char *logname, - struct config_llog_instance *cfg, - struct super_block *sb) +static struct config_llog_data * +config_log_add(struct obd_device *obd, char *logname, + struct config_llog_instance *cfg, struct super_block *sb) { struct lustre_sb_info *lsi = s2lsi(sb); struct config_llog_data *cld; struct config_llog_data *sptlrpc_cld; struct config_llog_data *params_cld; + bool locked = false; char seclogname[32]; char *ptr; int rc; @@ -305,7 +302,7 @@ static int config_log_add(struct obd_device *obd, char *logname, ptr = strrchr(logname, '-'); if (!ptr || ptr - logname > 8) { CERROR("logname %s is too long\n", logname); - return -EINVAL; + return ERR_PTR(-EINVAL); } memcpy(seclogname, logname, ptr - logname); @@ -326,14 +323,14 @@ static int config_log_add(struct obd_device *obd, char *logname, rc = PTR_ERR(params_cld); CERROR("%s: can't create params log: rc = %d\n", obd->obd_name, rc); - goto out_err1; + goto out_sptlrpc; } cld = do_config_log_add(obd, logname, CONFIG_T_CONFIG, cfg, sb); if (IS_ERR(cld)) { CERROR("can't create log: %s\n", logname); rc = PTR_ERR(cld); - goto out_err2; + goto out_params; } cld->cld_sptlrpc = sptlrpc_cld; @@ -350,33 +347,52 @@ static int config_log_add(struct obd_device *obd, char *logname, CERROR("%s: sptlrpc log name not correct, %s: rc = %d\n", obd->obd_name, seclogname, -EINVAL); config_log_put(cld); - return -EINVAL; + rc = -EINVAL; + goto out_cld; } recover_cld = config_recover_log_add(obd, seclogname, cfg, sb); if (IS_ERR(recover_cld)) { rc = PTR_ERR(recover_cld); - goto out_err3; + goto out_cld; } + + mutex_lock(&cld->cld_lock); + locked = true; cld->cld_recover = recover_cld; } - return 0; + if (!locked) + mutex_lock(&cld->cld_lock); + cld->cld_params = params_cld; + cld->cld_sptlrpc = sptlrpc_cld; + mutex_unlock(&cld->cld_lock); + + return cld; -out_err3: +out_cld: config_log_put(cld); -out_err2: +out_params: config_log_put(params_cld); -out_err1: +out_sptlrpc: config_log_put(sptlrpc_cld); out_err: - return rc; + return ERR_PTR(rc); } static DEFINE_MUTEX(llog_process_lock); +static inline void config_mark_cld_stop(struct config_llog_data *cld) +{ + mutex_lock(&cld->cld_lock); + spin_lock(&config_list_lock); + cld->cld_stopping = 1; + spin_unlock(&config_list_lock); + mutex_unlock(&cld->cld_lock); +} + /** Stop watching for updates on this log. */ static int config_log_end(char *logname, struct config_llog_instance *cfg) @@ -406,36 +422,32 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) return rc; } + spin_lock(&config_list_lock); cld->cld_stopping = 1; + spin_unlock(&config_list_lock); cld_recover = cld->cld_recover; cld->cld_recover = NULL; + + cld_params = cld->cld_params; + cld->cld_params = NULL; + cld_sptlrpc = cld->cld_sptlrpc; + cld->cld_sptlrpc = NULL; mutex_unlock(&cld->cld_lock); if (cld_recover) { - mutex_lock(&cld_recover->cld_lock); - cld_recover->cld_stopping = 1; - mutex_unlock(&cld_recover->cld_lock); + config_mark_cld_stop(cld_recover); config_log_put(cld_recover); } - spin_lock(&config_list_lock); - cld_sptlrpc = cld->cld_sptlrpc; - cld->cld_sptlrpc = NULL; - cld_params = cld->cld_params; - cld->cld_params = NULL; - spin_unlock(&config_list_lock); - - if (cld_sptlrpc) - config_log_put(cld_sptlrpc); - if (cld_params) { - mutex_lock(&cld_params->cld_lock); - cld_params->cld_stopping = 1; - mutex_unlock(&cld_params->cld_lock); + config_mark_cld_stop(cld_params); config_log_put(cld_params); } + if (cld_sptlrpc) + config_log_put(cld_sptlrpc); + /* drop the ref from the find */ config_log_put(cld); /* drop the start ref */ @@ -531,11 +543,10 @@ static int mgc_requeue_thread(void *data) /* Keep trying failed locks periodically */ spin_lock(&config_list_lock); rq_state |= RQ_RUNNING; - while (1) { + while (!(rq_state & RQ_STOP)) { struct l_wait_info lwi; struct config_llog_data *cld, *cld_prev; int rand = cfs_rand() & MGC_TIMEOUT_RAND_CENTISEC; - int stopped = !!(rq_state & RQ_STOP); int to; /* Any new or requeued lostlocks will change the state */ @@ -571,44 +582,40 @@ static int mgc_requeue_thread(void *data) spin_lock(&config_list_lock); rq_state &= ~RQ_PRECLEANUP; list_for_each_entry(cld, &config_llog_list, cld_list_chain) { - if (!cld->cld_lostlock) + if (!cld->cld_lostlock || cld->cld_stopping) continue; + /* + * hold reference to avoid being freed during + * subsequent processing. + */ + config_log_get(cld); + cld->cld_lostlock = 0; spin_unlock(&config_list_lock); - LASSERT(atomic_read(&cld->cld_refcount) > 0); - - /* Whether we enqueued again or not in mgc_process_log, - * we're done with the ref from the old enqueue - */ if (cld_prev) config_log_put(cld_prev); cld_prev = cld; - cld->cld_lostlock = 0; - if (likely(!stopped)) + if (likely(!(rq_state & RQ_STOP))) { do_requeue(cld); - - spin_lock(&config_list_lock); + spin_lock(&config_list_lock); + } else { + spin_lock(&config_list_lock); + break; + } } spin_unlock(&config_list_lock); if (cld_prev) config_log_put(cld_prev); - /* break after scanning the list so that we can drop - * refcount to losing lock clds - */ - if (unlikely(stopped)) { - spin_lock(&config_list_lock); - break; - } - /* Wait a bit to see if anyone else needs a requeue */ lwi = (struct l_wait_info) { 0 }; l_wait_event(rq_waitq, rq_state & (RQ_NOW | RQ_STOP), &lwi); spin_lock(&config_list_lock); } + /* spinlock and while guarantee RQ_NOW and RQ_LATER are not set */ rq_state &= ~RQ_RUNNING; spin_unlock(&config_list_lock); @@ -624,32 +631,24 @@ static int mgc_requeue_thread(void *data) */ static void mgc_requeue_add(struct config_llog_data *cld) { + bool wakeup = false; + CDEBUG(D_INFO, "log %s: requeue (r=%d sp=%d st=%x)\n", cld->cld_logname, atomic_read(&cld->cld_refcount), cld->cld_stopping, rq_state); LASSERT(atomic_read(&cld->cld_refcount) > 0); mutex_lock(&cld->cld_lock); - if (cld->cld_stopping || cld->cld_lostlock) { - mutex_unlock(&cld->cld_lock); - return; - } - /* this refcount will be released in mgc_requeue_thread. */ - config_log_get(cld); - cld->cld_lostlock = 1; - mutex_unlock(&cld->cld_lock); - - /* Hold lock for rq_state */ spin_lock(&config_list_lock); - if (rq_state & RQ_STOP) { - spin_unlock(&config_list_lock); - cld->cld_lostlock = 0; - config_log_put(cld); - } else { + if (!(rq_state & RQ_STOP) && !cld->cld_stopping && !cld->cld_lostlock) { + cld->cld_lostlock = 1; rq_state |= RQ_NOW; - spin_unlock(&config_list_lock); - wake_up(&rq_waitq); + wakeup = true; } + spin_unlock(&config_list_lock); + mutex_unlock(&cld->cld_lock); + if (wakeup) + wake_up(&rq_waitq); } static int mgc_llog_init(const struct lu_env *env, struct obd_device *obd) @@ -812,6 +811,8 @@ static int mgc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, /* held at mgc_process_log(). */ LASSERT(atomic_read(&cld->cld_refcount) > 0); + + lock->l_ast_data = NULL; /* Are we done with this log? */ if (cld->cld_stopping) { CDEBUG(D_MGC, "log %s: stopping, won't requeue\n", @@ -1661,16 +1662,18 @@ int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld) goto restart; } else { mutex_lock(&cld->cld_lock); + spin_lock(&config_list_lock); cld->cld_lostlock = 1; + spin_unlock(&config_list_lock); } } else { /* mark cld_lostlock so that it will requeue * after MGC becomes available. */ + spin_lock(&config_list_lock); cld->cld_lostlock = 1; + spin_unlock(&config_list_lock); } - /* Get extra reference, it will be put in requeue thread */ - config_log_get(cld); } if (cld_is_recover(cld)) { @@ -1681,7 +1684,9 @@ int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld) CERROR("%s: recover log %s failed: rc = %d not fatal.\n", mgc->obd_name, cld->cld_logname, rc); rc = 0; + spin_lock(&config_list_lock); cld->cld_lostlock = 1; + spin_unlock(&config_list_lock); } } } else { @@ -1749,12 +1754,9 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf) cfg->cfg_last_idx); /* We're only called through here on the initial mount */ - rc = config_log_add(obd, logname, cfg, sb); - if (rc) - break; - cld = config_log_find(logname, cfg); - if (!cld) { - rc = -ENOENT; + cld = config_log_add(obd, logname, cfg, sb); + if (IS_ERR(cld)) { + rc = PTR_ERR(cld); break; } @@ -1770,11 +1772,15 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf) imp_connect_data, IMP_RECOV)) { rc = mgc_process_log(obd, cld->cld_recover); } else { - struct config_llog_data *cir = cld->cld_recover; + struct config_llog_data *cir; + mutex_lock(&cld->cld_lock); + cir = cld->cld_recover; cld->cld_recover = NULL; + mutex_unlock(&cld->cld_lock); config_log_put(cir); } + if (rc) CERROR("Cannot process recover llog %d\n", rc); } @@ -1792,7 +1798,6 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf) "%s: can't process params llog: rc = %d\n", obd->obd_name, rc); } - config_log_put(cld); break; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:04 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:04 -0500 Subject: [lustre-devel] [PATCH 36/60] staging: lustre: header: remove assert from interval_set() In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-37-git-send-email-jsimmons@infradead.org> In the case of interval_tree.h only interval_set() uses LASSERT which is removed in this patch and interval_set() instead reports a real error. The header libcfs.h for interval_tree.h is not needed anymore so we can just use the standard linux kernel headers instead.h Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6401 Reviewed-on: https://review.whamcloud.com/22522 Reviewed-on: https://review.whamcloud.com/24323 Reviewed-by: Frank Zago Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/interval_tree.h | 12 ++++++++---- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 +++-- drivers/staging/lustre/lustre/llite/range_lock.c | 10 ++++++++-- drivers/staging/lustre/lustre/llite/range_lock.h | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/interval_tree.h b/drivers/staging/lustre/lustre/include/interval_tree.h index 5d387d3..0d4f92e 100644 --- a/drivers/staging/lustre/lustre/include/interval_tree.h +++ b/drivers/staging/lustre/lustre/include/interval_tree.h @@ -36,7 +36,9 @@ #ifndef _INTERVAL_H__ #define _INTERVAL_H__ -#include "../../include/linux/libcfs/libcfs.h" /* LASSERT. */ +#include +#include +#include struct interval_node { struct interval_node *in_left; @@ -73,13 +75,15 @@ static inline __u64 interval_high(struct interval_node *node) return node->in_extent.end; } -static inline void interval_set(struct interval_node *node, - __u64 start, __u64 end) +static inline int interval_set(struct interval_node *node, + __u64 start, __u64 end) { - LASSERT(start <= end); + if (start > end) + return -ERANGE; node->in_extent.start = start; node->in_extent.end = end; node->in_max_high = end; + return 0; } /* diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index 5616ea4..08f97e2 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -162,7 +162,7 @@ void ldlm_extent_add_lock(struct ldlm_resource *res, struct interval_node *found, **root; struct ldlm_interval *node; struct ldlm_extent *extent; - int idx; + int idx, rc; LASSERT(lock->l_granted_mode == lock->l_req_mode); @@ -176,7 +176,8 @@ void ldlm_extent_add_lock(struct ldlm_resource *res, /* node extent initialize */ extent = &lock->l_policy_data.l_extent; - interval_set(&node->li_node, extent->start, extent->end); + rc = interval_set(&node->li_node, extent->start, extent->end); + LASSERT(!rc); root = &res->lr_itree[idx].lit_root; found = interval_insert(&node->li_node, root); diff --git a/drivers/staging/lustre/lustre/llite/range_lock.c b/drivers/staging/lustre/lustre/llite/range_lock.c index 94c818f..14148a0 100644 --- a/drivers/staging/lustre/lustre/llite/range_lock.c +++ b/drivers/staging/lustre/lustre/llite/range_lock.c @@ -61,17 +61,23 @@ void range_lock_tree_init(struct range_lock_tree *tree) * Pre: Caller should have allocated the range lock node. * Post: The range lock node is meant to cover [start, end] region */ -void range_lock_init(struct range_lock *lock, __u64 start, __u64 end) +int range_lock_init(struct range_lock *lock, __u64 start, __u64 end) { + int rc; + memset(&lock->rl_node, 0, sizeof(lock->rl_node)); if (end != LUSTRE_EOF) end >>= PAGE_SHIFT; - interval_set(&lock->rl_node, start >> PAGE_SHIFT, end); + rc = interval_set(&lock->rl_node, start >> PAGE_SHIFT, end); + if (rc) + return rc; + INIT_LIST_HEAD(&lock->rl_next_lock); lock->rl_task = NULL; lock->rl_lock_count = 0; lock->rl_blocking_ranges = 0; lock->rl_sequence = 0; + return rc; } static inline struct range_lock *next_lock(struct range_lock *lock) diff --git a/drivers/staging/lustre/lustre/llite/range_lock.h b/drivers/staging/lustre/lustre/llite/range_lock.h index c6d04a6..779091c 100644 --- a/drivers/staging/lustre/lustre/llite/range_lock.h +++ b/drivers/staging/lustre/lustre/llite/range_lock.h @@ -76,7 +76,7 @@ struct range_lock_tree { }; void range_lock_tree_init(struct range_lock_tree *tree); -void range_lock_init(struct range_lock *lock, __u64 start, __u64 end); +int range_lock_init(struct range_lock *lock, __u64 start, __u64 end); int range_lock(struct range_lock_tree *tree, struct range_lock *lock); void range_unlock(struct range_lock_tree *tree, struct range_lock *lock); #endif -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:03 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:03 -0500 Subject: [lustre-devel] [PATCH 35/60] staging: lustre: lov: ld_target could be NULL In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-36-git-send-email-jsimmons@infradead.org> From: Bobi Jam lov_device::ld_target[ost_idx] could be NULL if the OST target is not filled in lov_device::ld_lov::lov_tgt_desc[ost_idx] yet. Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8018 Reviewed-on: http://review.whamcloud.com/21411 Reviewed-by: Jinshan Xiong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_object.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 9c4b5ab..977579c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -266,6 +266,13 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, if (result != 0) goto out; + if (!dev->ld_target[ost_idx]) { + CERROR("%s: OST %04x is not initialized\n", + lov2obd(dev->ld_lov)->obd_name, ost_idx); + result = -EIO; + goto out; + } + subdev = lovsub2cl_dev(dev->ld_target[ost_idx]); subconf->u.coc_oinfo = oinfo; LASSERTF(subdev, "not init ost %d\n", ost_idx); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:07 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:07 -0500 Subject: [lustre-devel] [PATCH 39/60] staging: libcfs: remove integer types abstraction from libcfs In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-40-git-send-email-jsimmons@infradead.org> Replace the ulong_ptr_t and long_ptr_t with standard kernel types. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: http://review.whamcloud.com/20204 Reviewed-by: Frank Zago Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h | 4 ---- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- drivers/staging/lustre/lnet/libcfs/debug.c | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h index e8695e4..fa0808d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h @@ -125,10 +125,6 @@ #include -/* long integer with size equal to pointer */ -typedef unsigned long ulong_ptr_t; -typedef long long_ptr_t; - #ifndef WITH_WATCHDOG #define WITH_WATCHDOG #endif diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 2181c67..8aab001 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -2507,7 +2507,7 @@ static int ksocknal_push(lnet_ni_t *ni, lnet_process_id_t id) snprintf(name, sizeof(name), "socknal_cd%02d", i); rc = ksocknal_thread_start(ksocknal_connd, - (void *)((ulong_ptr_t)i), name); + (void *)((uintptr_t)i), name); if (rc) { spin_lock_bh(&ksocknal_data.ksnd_connd_lock); ksocknal_data.ksnd_connd_starting--; diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c b/drivers/staging/lustre/lnet/libcfs/debug.c index a38db23..3408041 100644 --- a/drivers/staging/lustre/lnet/libcfs/debug.c +++ b/drivers/staging/lustre/lnet/libcfs/debug.c @@ -343,7 +343,7 @@ void libcfs_debug_dumplog_internal(void *arg) last_dump_time = current_time; snprintf(debug_file_name, sizeof(debug_file_name) - 1, "%s.%lld.%ld", libcfs_debug_file_path_arr, - (s64)current_time, (long_ptr_t)arg); + (s64)current_time, (long)arg); pr_alert("LustreError: dumping log to %s\n", debug_file_name); cfs_tracefile_dump_all_pages(debug_file_name); libcfs_run_debug_log_upcall(debug_file_name); diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index a55c6cd..b43a994 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -330,7 +330,7 @@ __u32 magic; __u32 peer_ip; int peer_port; - int secure = (int)((long_ptr_t)arg); + int secure = (int)((long)arg); LASSERT(!lnet_acceptor_state.pta_sock); @@ -459,7 +459,7 @@ if (!lnet_count_acceptor_nis()) /* not required */ return 0; - task = kthread_run(lnet_acceptor, (void *)(ulong_ptr_t)secure, + task = kthread_run(lnet_acceptor, (void *)(uintptr_t)secure, "acceptor_%03ld", secure); if (IS_ERR(task)) { rc2 = PTR_ERR(task); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:16 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:16 -0500 Subject: [lustre-devel] [PATCH 48/60] staging: lustre: ksocklnd: ignore timedout TX on closing connection In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-49-git-send-email-jsimmons@infradead.org> From: Liang Zhen ksocklnd reaper thread always tries to close the connection for the first timedout zero-copy TX. This is wrong if this connection is already being closed, because the reaper will see the same TX again and again and cannot find out other timedout zero-copy TXs and close connections for them. Signed-off-by: Liang Zhen Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8867 Reviewed-on: https://review.whamcloud.com/23973 Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index df4f55e..b7043e2 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -2456,6 +2456,7 @@ void ksocknal_write_callback(struct ksock_conn *conn) list_for_each_entry(peer, peers, ksnp_list) { unsigned long deadline = 0; + struct ksock_tx *tx_stale; int resid = 0; int n = 0; @@ -2503,6 +2504,7 @@ void ksocknal_write_callback(struct ksock_conn *conn) if (list_empty(&peer->ksnp_zc_req_list)) continue; + tx_stale = NULL; spin_lock(&peer->ksnp_lock); list_for_each_entry(tx, &peer->ksnp_zc_req_list, tx_zc_list) { if (!cfs_time_aftereq(cfs_time_current(), @@ -2511,26 +2513,26 @@ void ksocknal_write_callback(struct ksock_conn *conn) /* ignore the TX if connection is being closed */ if (tx->tx_conn->ksnc_closing) continue; + if (!tx_stale) + tx_stale = tx; n++; } - if (!n) { + if (!tx_stale) { spin_unlock(&peer->ksnp_lock); continue; } - tx = list_entry(peer->ksnp_zc_req_list.next, - struct ksock_tx, tx_zc_list); - deadline = tx->tx_deadline; - resid = tx->tx_resid; - conn = tx->tx_conn; + deadline = tx_stale->tx_deadline; + resid = tx_stale->tx_resid; + conn = tx_stale->tx_conn; ksocknal_conn_addref(conn); spin_unlock(&peer->ksnp_lock); read_unlock(&ksocknal_data.ksnd_global_lock); CERROR("Total %d stale ZC_REQs for peer %s detected; the oldest(%p) timed out %ld secs ago, resid: %d, wmem: %d\n", - n, libcfs_nid2str(peer->ksnp_id.nid), tx, + n, libcfs_nid2str(peer->ksnp_id.nid), tx_stale, cfs_duration_sec(cfs_time_current() - deadline), resid, conn->ksnc_sock->sk->sk_wmem_queued); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:01 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:01 -0500 Subject: [lustre-devel] [PATCH 33/60] staging: lustre: libcfs: avoid stomping on module param cpu_pattern In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-34-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin The function cfs_cpt_table_create_pattern() alters the string passed to it. Currently we are passing in the module parameter string cpu_pattern which is incorrect. Instead lets duplicate the module parameter string and pass that to the function cfs_cpt_table_create_pattern(). Signed-off-by: Liang Zhen Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5050 Reviewed-on: http://review.whamcloud.com/22377 Reviewed-by: James Simmons Reviewed-by: Olaf Weber Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index 427e219..71a5b19 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -1050,7 +1050,15 @@ static int cfs_cpu_dead(unsigned int cpu) ret = -EINVAL; if (*cpu_pattern) { - cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern); + char *cpu_pattern_dup = kstrdup(cpu_pattern, GFP_KERNEL); + + if (!cpu_pattern_dup) { + CERROR("Failed to duplicate cpu_pattern\n"); + goto failed; + } + + cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern_dup); + kfree(cpu_pattern_dup); if (!cfs_cpt_table) { CERROR("Failed to create cptab from pattern %s\n", cpu_pattern); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:23 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:23 -0500 Subject: [lustre-devel] [PATCH 55/60] staging: lustre: obd: move s3 in lmd_parse to inner loop In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-56-git-send-email-jsimmons@infradead.org> Building the lustre client with W=1 reports the following error: obdclass/obd_mount.c: In function lmd_parse: obdclass/obd_mount.c:880: warning: variable set but not used The solution is to move s3 to the inner loop where it is only used. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8378 Reviewed-on: https://review.whamcloud.com/23820 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 2283e92..8e0d4b1 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -877,7 +877,7 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr) */ static int lmd_parse(char *options, struct lustre_mount_data *lmd) { - char *s1, *s2, *s3, *devname = NULL; + char *s1, *s2, *devname = NULL; struct lustre_mount_data *raw = (struct lustre_mount_data *)options; int rc = 0; @@ -906,6 +906,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) while (*s1) { int clear = 0; int time_min = OBD_RECOVERY_TIME_MIN; + char *s3; /* Skip whitespace and extra commas */ while (*s1 == ' ' || *s1 == ',') -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:05 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:05 -0500 Subject: [lustre-devel] [PATCH 37/60] staging: lustre: llite: specify READA debug mask for ras_update In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-38-git-send-email-jsimmons@infradead.org> From: Bobi Jam So that debug log only contains relevant messages for debugging purpose. Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8413 Reviewed-on: http://review.whamcloud.com/22753 Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/rw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 18d3ccb..50d027e 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -729,6 +729,10 @@ static void ras_update(struct ll_sb_info *sbi, struct inode *inode, spin_lock(&ras->ras_lock); + if (!hit) + CDEBUG(D_READA, DFID " pages at %lu miss.\n", + PFID(ll_inode2fid(inode)), index); + ll_ra_stats_inc_sbi(sbi, hit ? RA_STAT_HIT : RA_STAT_MISS); /* reset the read-ahead window in two cases. First when the app seeks -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:19 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:19 -0500 Subject: [lustre-devel] [PATCH 51/60] staging: lustre: ptlrpc: update MODULE_PARAM_DESC in ptlrpcd.c In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-52-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Update max_ptlrpcds module parameter descriptions to let users know its obsolete. Change cpt to CPT for the module parameter description ptlrpcd_per_cpt_max so it matches documentation. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8890 Reviewed-on: https://review.whamcloud.com/24065 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 84c5551..59b5813 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -82,7 +82,8 @@ struct ptlrpcd { */ static int max_ptlrpcds; module_param(max_ptlrpcds, int, 0644); -MODULE_PARM_DESC(max_ptlrpcds, "Max ptlrpcd thread count to be started."); +MODULE_PARM_DESC(max_ptlrpcds, + "Max ptlrpcd thread count to be started (obsolete)."); /* * ptlrpcd_bind_policy is obsolete, but retained to ensure that @@ -102,7 +103,7 @@ struct ptlrpcd { static int ptlrpcd_per_cpt_max; module_param(ptlrpcd_per_cpt_max, int, 0644); MODULE_PARM_DESC(ptlrpcd_per_cpt_max, - "Max ptlrpcd thread count to be started per cpt."); + "Max ptlrpcd thread count to be started per CPT."); /* * ptlrpcd_partner_group_size: The desired number of threads in each -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:17 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:17 -0500 Subject: [lustre-devel] [PATCH 49/60] staging: lustre: socklnd: remove socklnd_init_msg In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-50-git-send-email-jsimmons@infradead.org> Remove the inline function socklnd_init_msg. Its only used by the kernel code so no point keeping it in an UAPI header. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/18506 Reviewed-by: Dmitry Eremin Reviewed-by: Doug Oucharek Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/socklnd.h | 9 --------- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 9 +++++++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index 7d24a91..acf20ce 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -80,15 +80,6 @@ } WIRE_ATTR ksm_u; } WIRE_ATTR ksock_msg_t; -static inline void -socklnd_init_msg(ksock_msg_t *msg, int type) -{ - msg->ksm_csum = 0; - msg->ksm_type = type; - msg->ksm_zc_cookies[0] = 0; - msg->ksm_zc_cookies[1] = 0; -} - #define KSOCK_MSG_NOOP 0xC0 /* ksm_u empty */ #define KSOCK_MSG_LNET 0xC1 /* lnet msg */ diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index b7043e2..b161c2b 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -80,7 +80,9 @@ struct ksock_tx * tx->tx_niov = 1; tx->tx_nonblk = nonblk; - socklnd_init_msg(&tx->tx_msg, KSOCK_MSG_NOOP); + tx->tx_msg.ksm_csum = 0; + tx->tx_msg.ksm_type = KSOCK_MSG_NOOP; + tx->tx_msg.ksm_zc_cookies[0] = 0; tx->tx_msg.ksm_zc_cookies[1] = cookie; return tx; @@ -1004,7 +1006,10 @@ struct ksock_route * tx->tx_zc_capable = 1; } - socklnd_init_msg(&tx->tx_msg, KSOCK_MSG_LNET); + tx->tx_msg.ksm_csum = 0; + tx->tx_msg.ksm_type = KSOCK_MSG_LNET; + tx->tx_msg.ksm_zc_cookies[0] = 0; + tx->tx_msg.ksm_zc_cookies[1] = 0; /* The first fragment will be set later in pro_pack */ rc = ksocknal_launch_packet(ni, tx, target); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:24 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:24 -0500 Subject: [lustre-devel] [PATCH 56/60] staging: lustre: llite: don't invoke direct_IO for the EOF case In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-57-git-send-email-jsimmons@infradead.org> From: Yang Sheng The function generic_file_read_iter() does not check EOF before invoke direct_IO callback. So we have to check it ourselves. Signed-off-by: Yang Sheng Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8969 Reviewed-on: https://review.whamcloud.com/24552 Reviewed-by: Bob Glossman Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/rw26.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 21e06e5..d89e795 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -345,6 +345,10 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter) ssize_t tot_bytes = 0, result = 0; long size = MAX_DIO_SIZE; + /* Check EOF by ourselves */ + if (iov_iter_rw(iter) == READ && file_offset >= i_size_read(inode)) + return 0; + /* FIXME: io smaller than PAGE_SIZE is broken on ia64 ??? */ if ((file_offset & ~PAGE_MASK) || (count & ~PAGE_MASK)) return -EINVAL; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:39 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:39 -0500 Subject: [lustre-devel] [PATCH 11/60] staging: lustre: obd: RCU stalls in lu_cache_shrink_count() In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-12-git-send-email-jsimmons@infradead.org> From: Ann Koehler The algorithm for counting freeable objects in the lu_cache shrinker does not scale with the number of cpus. The LU_SS_LRU_LEN counter for each cpu is read and summed at shrink time while holding the lu_sites_guard mutex. With a large number of cpus and low memory conditions, processes bottleneck on the mutex. This mod reduces the time spent counting by using the kernel's percpu counter functions to maintain the length of a site's lru. The summing occurs when a percpu value is incremented or decremented and a threshold is exceeded. lu_cache_shrink_count() simply returns the last such computed sum. This mod also replaces the lu_sites_guard mutex with a rw semaphore. The lock protects the lu_site list, which is modified when a file system is mounted/umounted or when the lu_site is purged. lu_cache_shrink_count simply reads data so it does not need to wait for other readers. lu_cache_shrink_scan, which actually frees the unused objects, is still serialized. Signed-off-by: Ann Koehler Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7997 Reviewed-on: http://review.whamcloud.com/19390 Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lu_object.h | 6 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 80 ++++++++++------------ 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 69b2812..f442a96 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -34,6 +34,7 @@ #define __LUSTRE_LU_OBJECT_H #include +#include #include "../../include/linux/libcfs/libcfs.h" #include "lustre/lustre_idl.h" #include "lu_ref.h" @@ -580,7 +581,6 @@ enum { LU_SS_CACHE_RACE, LU_SS_CACHE_DEATH_RACE, LU_SS_LRU_PURGED, - LU_SS_LRU_LEN, /* # of objects in lsb_lru lists */ LU_SS_LAST_STAT }; @@ -635,6 +635,10 @@ struct lu_site { * XXX: a hack! fld has to find md_site via site, remove when possible */ struct seq_server_site *ld_seq_site; + /** + * Number of objects in lsb_lru_lists - used for shrinking + */ + struct percpu_counter ls_lru_len_counter; }; static inline struct lu_site_bkt_data * diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 7971562..1805861 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -151,7 +151,7 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o) LASSERT(list_empty(&top->loh_lru)); list_add_tail(&top->loh_lru, &bkt->lsb_lru); bkt->lsb_lru_len++; - lprocfs_counter_incr(site->ls_stats, LU_SS_LRU_LEN); + percpu_counter_inc(&site->ls_lru_len_counter); CDEBUG(D_INODE, "Add %p to site lru. hash: %p, bkt: %p, lru_len: %ld\n", o, site->ls_obj_hash, bkt, bkt->lsb_lru_len); cfs_hash_bd_unlock(site->ls_obj_hash, &bd, 1); @@ -202,7 +202,7 @@ void lu_object_unhash(const struct lu_env *env, struct lu_object *o) list_del_init(&top->loh_lru); bkt = cfs_hash_bd_extra_get(obj_hash, &bd); bkt->lsb_lru_len--; - lprocfs_counter_decr(site->ls_stats, LU_SS_LRU_LEN); + percpu_counter_dec(&site->ls_lru_len_counter); } cfs_hash_bd_del_locked(obj_hash, &bd, &top->loh_hash); cfs_hash_bd_unlock(obj_hash, &bd, 1); @@ -379,7 +379,7 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) &bd2, &h->loh_hash); list_move(&h->loh_lru, &dispose); bkt->lsb_lru_len--; - lprocfs_counter_decr(s->ls_stats, LU_SS_LRU_LEN); + percpu_counter_dec(&s->ls_lru_len_counter); if (did_sth == 0) did_sth = 1; @@ -578,7 +578,7 @@ static struct lu_object *htable_lookup(struct lu_site *s, if (!list_empty(&h->loh_lru)) { list_del_init(&h->loh_lru); bkt->lsb_lru_len--; - lprocfs_counter_decr(s->ls_stats, LU_SS_LRU_LEN); + percpu_counter_dec(&s->ls_lru_len_counter); } return lu_object_top(h); } @@ -820,7 +820,7 @@ void lu_device_type_fini(struct lu_device_type *ldt) * Global list of all sites on this node */ static LIST_HEAD(lu_sites); -static DEFINE_MUTEX(lu_sites_guard); +static DECLARE_RWSEM(lu_sites_guard); /** * Global environment used by site shrinker. @@ -994,9 +994,15 @@ int lu_site_init(struct lu_site *s, struct lu_device *top) unsigned long bits; unsigned long i; char name[16]; + int rc; memset(s, 0, sizeof(*s)); mutex_init(&s->ls_purge_mutex); + + rc = percpu_counter_init(&s->ls_lru_len_counter, 0, GFP_NOFS); + if (rc) + return -ENOMEM; + snprintf(name, sizeof(name), "lu_site_%s", top->ld_type->ldt_name); for (bits = lu_htable_order(top); bits >= LU_SITE_BITS_MIN; bits--) { s->ls_obj_hash = cfs_hash_create(name, bits, bits, @@ -1042,12 +1048,6 @@ int lu_site_init(struct lu_site *s, struct lu_device *top) 0, "cache_death_race", "cache_death_race"); lprocfs_counter_init(s->ls_stats, LU_SS_LRU_PURGED, 0, "lru_purged", "lru_purged"); - /* - * Unlike other counters, lru_len can be decremented so - * need lc_sum instead of just lc_count - */ - lprocfs_counter_init(s->ls_stats, LU_SS_LRU_LEN, - LPROCFS_CNTR_AVGMINMAX, "lru_len", "lru_len"); INIT_LIST_HEAD(&s->ls_linkage); s->ls_top_dev = top; @@ -1069,9 +1069,11 @@ int lu_site_init(struct lu_site *s, struct lu_device *top) */ void lu_site_fini(struct lu_site *s) { - mutex_lock(&lu_sites_guard); + down_write(&lu_sites_guard); list_del_init(&s->ls_linkage); - mutex_unlock(&lu_sites_guard); + up_write(&lu_sites_guard); + + percpu_counter_destroy(&s->ls_lru_len_counter); if (s->ls_obj_hash) { cfs_hash_putref(s->ls_obj_hash); @@ -1097,11 +1099,11 @@ int lu_site_init_finish(struct lu_site *s) { int result; - mutex_lock(&lu_sites_guard); + down_write(&lu_sites_guard); result = lu_context_refill(&lu_shrink_env.le_ctx); if (result == 0) list_add(&s->ls_linkage, &lu_sites); - mutex_unlock(&lu_sites_guard); + up_write(&lu_sites_guard); return result; } EXPORT_SYMBOL(lu_site_init_finish); @@ -1820,12 +1822,15 @@ static void lu_site_stats_get(struct cfs_hash *hs, } /* - * lu_cache_shrink_count returns the number of cached objects that are - * candidates to be freed by shrink_slab(). A counter, which tracks - * the number of items in the site's lru, is maintained in the per cpu - * stats of each site. The counter is incremented when an object is added - * to a site's lru and decremented when one is removed. The number of - * free-able objects is the sum of all per cpu counters for all sites. + * lu_cache_shrink_count() returns an approximate number of cached objects + * that can be freed by shrink_slab(). A counter, which tracks the + * number of items in the site's lru, is maintained in a percpu_counter + * for each site. The percpu values are incremented and decremented as + * objects are added or removed from the lru. The percpu values are summed + * and saved whenever a percpu value exceeds a threshold. Thus the saved, + * summed value at any given time may not accurately reflect the current + * lru length. But this value is sufficiently accurate for the needs of + * a shrinker. * * Using a per cpu counter is a compromise solution to concurrent access: * lu_object_put() can update the counter without locking the site and @@ -1842,11 +1847,10 @@ static unsigned long lu_cache_shrink_count(struct shrinker *sk, if (!(sc->gfp_mask & __GFP_FS)) return 0; - mutex_lock(&lu_sites_guard); - list_for_each_entry_safe(s, tmp, &lu_sites, ls_linkage) { - cached += ls_stats_read(s->ls_stats, LU_SS_LRU_LEN); - } - mutex_unlock(&lu_sites_guard); + down_read(&lu_sites_guard); + list_for_each_entry_safe(s, tmp, &lu_sites, ls_linkage) + cached += percpu_counter_read_positive(&s->ls_lru_len_counter); + up_read(&lu_sites_guard); cached = (cached / 100) * sysctl_vfs_cache_pressure; CDEBUG(D_INODE, "%ld objects cached, cache pressure %d\n", @@ -1877,7 +1881,7 @@ static unsigned long lu_cache_shrink_scan(struct shrinker *sk, */ return SHRINK_STOP; - mutex_lock(&lu_sites_guard); + down_write(&lu_sites_guard); list_for_each_entry_safe(s, tmp, &lu_sites, ls_linkage) { freed = lu_site_purge(&lu_shrink_env, s, remain); remain -= freed; @@ -1888,7 +1892,7 @@ static unsigned long lu_cache_shrink_scan(struct shrinker *sk, list_move_tail(&s->ls_linkage, &splice); } list_splice(&splice, lu_sites.prev); - mutex_unlock(&lu_sites_guard); + up_write(&lu_sites_guard); return sc->nr_to_scan - remain; } @@ -1925,9 +1929,9 @@ int lu_global_init(void) * conservatively. This should not be too bad, because this * environment is global. */ - mutex_lock(&lu_sites_guard); + down_write(&lu_sites_guard); result = lu_env_init(&lu_shrink_env, LCT_SHRINKER); - mutex_unlock(&lu_sites_guard); + up_write(&lu_sites_guard); if (result != 0) return result; @@ -1953,9 +1957,9 @@ void lu_global_fini(void) * Tear shrinker environment down _after_ de-registering * lu_global_key, because the latter has a value in the former. */ - mutex_lock(&lu_sites_guard); + down_write(&lu_sites_guard); lu_env_fini(&lu_shrink_env); - mutex_unlock(&lu_sites_guard); + up_write(&lu_sites_guard); lu_ref_global_fini(); } @@ -1965,13 +1969,6 @@ static __u32 ls_stats_read(struct lprocfs_stats *stats, int idx) struct lprocfs_counter ret; lprocfs_stats_collect(stats, idx, &ret); - if (idx == LU_SS_LRU_LEN) - /* - * protect against counter on cpu A being decremented - * before counter is incremented on cpu B; unlikely - */ - return (__u32)((ret.lc_sum > 0) ? ret.lc_sum : 0); - return (__u32)ret.lc_count; } @@ -1986,7 +1983,7 @@ int lu_site_stats_print(const struct lu_site *s, struct seq_file *m) memset(&stats, 0, sizeof(stats)); lu_site_stats_get(s->ls_obj_hash, &stats, 1); - seq_printf(m, "%d/%d %d/%ld %d %d %d %d %d %d %d %d\n", + seq_printf(m, "%d/%d %d/%ld %d %d %d %d %d %d %d\n", stats.lss_busy, stats.lss_total, stats.lss_populated, @@ -1997,8 +1994,7 @@ int lu_site_stats_print(const struct lu_site *s, struct seq_file *m) ls_stats_read(s->ls_stats, LU_SS_CACHE_MISS), ls_stats_read(s->ls_stats, LU_SS_CACHE_RACE), ls_stats_read(s->ls_stats, LU_SS_CACHE_DEATH_RACE), - ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED), - ls_stats_read(s->ls_stats, LU_SS_LRU_LEN)); + ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED)); return 0; } EXPORT_SYMBOL(lu_site_stats_print); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:47 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:47 -0500 Subject: [lustre-devel] [PATCH 19/60] staging: lustre: llite: handle inactive OSTs better in statfs In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-20-git-send-email-jsimmons@infradead.org> From: Andreas Dilger Change the order of checks for inactive OSCs in lov_prep_statfs_set() so that administratively disabled OSTs do not generate any output in "lfs df" at all, to avoid needlessly cluttering the output. Enable the lazystatfs mount option by default, so that "df" does not hang when an OST is temporarily offline. Signed-off-by: Andreas Dilger Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7759 Reviewed-on: http://review.whamcloud.com/19195 Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_lib.c | 1 + drivers/staging/lustre/lustre/lov/lov_request.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 769b307..0a87058 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -103,6 +103,7 @@ static struct ll_sb_info *ll_init_sbi(struct super_block *sb) sbi->ll_flags |= LL_SBI_CHECKSUM; sbi->ll_flags |= LL_SBI_LRU_RESIZE; + sbi->ll_flags |= LL_SBI_LAZYSTATFS; for (i = 0; i <= LL_PROCESS_HIST_MAX; i++) { spin_lock_init(&sbi->ll_rw_extents_info.pp_extents[i]. diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index d43cc88..3a74791 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -344,9 +344,6 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, continue; } - if (!lov->lov_tgts[i]->ltd_active) - lov_check_and_wait_active(lov, i); - /* skip targets that have been explicitly disabled by the * administrator */ @@ -355,6 +352,9 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, continue; } + if (!lov->lov_tgts[i]->ltd_active) + lov_check_and_wait_active(lov, i); + req = kzalloc(sizeof(*req), GFP_NOFS); if (!req) { rc = -ENOMEM; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:57 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:57 -0500 Subject: [lustre-devel] [PATCH 29/60] staging: lustre: llite: Setting xattr are properly checked with and without ACLs In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-30-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Setting extended attributes permissions are properly checked with and without ACLs. In user.* namespace, only regular files and directories can have extended attributes. For sticky directories, only the owner and privileged user can write attributes. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1482 Reviewed-on: http://review.whamcloud.com/21496 Reviewed-by: John L. Hammond Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/xattr.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 7a848eb..421cc04 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -132,6 +132,15 @@ static int xattr_type_filter(struct ll_sb_info *sbi, (!strcmp(name, "ima") || !strcmp(name, "evm"))) return -EOPNOTSUPP; + /* + * In user.* namespace, only regular files and directories can have + * extended attributes. + */ + if (handler->flags == XATTR_USER_T) { + if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) + return -EPERM; + } + sprintf(fullname, "%s%s\n", handler->prefix, name); rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid, fullname, pv, size, 0, flags, -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:58 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:58 -0500 Subject: [lustre-devel] [PATCH 30/60] staging: lustre: ptlrpc: comment for FLD_QUERY RPC reply swab In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-31-git-send-email-jsimmons@infradead.org> From: Fan Yong The 'fld_read_server' uses 'RMF_GENERIC_DATA' to hold the 'FLD_QUERY' RPC reply that is composed of 'struct lu_seq_range_array'. But there is not registered swabber function for 'RMF_GENERIC_DATA'. So the RPC peers need to handle the RPC reply with fixed little-endian format. In theory, we can define new structure with some swabber registered to handle the 'FLD_QUERY' RPC reply result automatically. But from the implementation view, it is not easy to be done within current 'struct req_msg_field' framework. Because the sequence range array in the RPC reply is not fixed length, instead, its length depends on 'lu_seq_range' count, that is unknown when prepare the RPC buffer. Generally, for such flexible length RPC usage, there will be a field in the RPC layout to indicate the data length. But for the 'FLD_READ' RPC, we have no way to do that unless we add new length filed that will broken the on-wire RPC protocol and cause interoperability trouble with old peer. Signed-off-by: Fan Yong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6284 Reviewed-on: http://review.whamcloud.com/22309 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/layout.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 99d7c66..2052848 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -1181,6 +1181,23 @@ struct req_format RQF_FLD_QUERY = DEFINE_REQ_FMT0("FLD_QUERY", fld_query_client, fld_query_server); EXPORT_SYMBOL(RQF_FLD_QUERY); +/* + * The 'fld_read_server' uses 'RMF_GENERIC_DATA' to hold the 'FLD_QUERY' + * RPC reply that is composed of 'struct lu_seq_range_array'. But there + * is not registered swabber function for 'RMF_GENERIC_DATA'. So the RPC + * peers need to handle the RPC reply with fixed little-endian format. + * + * In theory, we can define new structure with some swabber registered to + * handle the 'FLD_QUERY' RPC reply result automatically. But from the + * implementation view, it is not easy to be done within current "struct + * req_msg_field" framework. Because the sequence range array in the RPC + * reply is not fixed length, instead, its length depends on 'lu_seq_range' + * count, that is unknown when prepare the RPC buffer. Generally, for such + * flexible length RPC usage, there will be a field in the RPC layout to + * indicate the data length. But for the 'FLD_READ' RPC, we have no way to + * do that unless we add new length filed that will broken the on-wire RPC + * protocol and cause interoperability trouble with old peer. + */ struct req_format RQF_FLD_READ = DEFINE_REQ_FMT0("FLD_READ", fld_read_client, fld_read_server); EXPORT_SYMBOL(RQF_FLD_READ); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:59 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:59 -0500 Subject: [lustre-devel] [PATCH 31/60] staging: lustre: clio: sync write should update mtime In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-32-git-send-email-jsimmons@infradead.org> From: Niu Yawei Sync write should update m/ctime promptly, otherwise, stale m/ctime could be updated on the OST object by the sync write RPC. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7310 Reviewed-on: http://review.whamcloud.com/21063 Reviewed-by: John L. Hammond Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_io.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 7e5cd3a..3e61f5e 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -210,6 +210,18 @@ static int osc_io_submit(const struct lu_env *env, if (queued > 0) result = osc_queue_sync_pages(env, osc, &list, cmd, brw_flags); + /* Update c/mtime for sync write. LU-7310 */ + if (qout->pl_nr > 0 && !result) { + struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_object *obj = ios->cis_obj; + + cl_object_attr_lock(obj); + attr->cat_mtime = LTIME_S(CURRENT_TIME); + attr->cat_ctime = attr->cat_mtime; + cl_object_attr_update(env, obj, attr, CAT_MTIME | CAT_CTIME); + cl_object_attr_unlock(obj); + } + CDEBUG(D_INFO, "%d/%d %d\n", qin->pl_nr, qout->pl_nr, result); return qout->pl_nr > 0 ? 0 : result; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:02 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:02 -0500 Subject: [lustre-devel] [PATCH 34/60] staging: lustre: libcfs: default CPT matches NUMA topology In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-35-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Change default value of CPT pattern and make it match NUMA topology Signed-off-by: Liang Zhen Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5050 Reviewed-on: http://review.whamcloud.com/22377 Reviewed-by: James Simmons Reviewed-by: Olaf Weber Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index 71a5b19..62ab76e 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -59,7 +59,7 @@ * * NB: If user specified cpu_pattern, cpu_npartitions will be ignored */ -static char *cpu_pattern = ""; +static char *cpu_pattern = "N"; module_param(cpu_pattern, charp, 0444); MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern"); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:06 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:06 -0500 Subject: [lustre-devel] [PATCH 38/60] staging: lustre: llite: Adding timed wait in ll_umount_begin In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-39-git-send-email-jsimmons@infradead.org> From: Rahul Deshmukh There exists timing race between umount and other thread which will increment the reference count on mnt e.g. getattr. If umount thread lose the race then umount fails with EBUSY error. To avoid this timed wait is added so that umount thread will wait for user to decrement the mnt reference count. Signed-off-by: Rahul Deshmukh Signed-off-by: Lokesh Nagappa Jaliminche Signed-off-by: Jian Yu Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1882 Seagate-bug-id: MRP-1192 Reviewed-on: http://review.whamcloud.com/20061 Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_internal.h | 1 + drivers/staging/lustre/lustre/llite/llite_lib.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 501957c..ecdfd0c 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -506,6 +506,7 @@ struct ll_sb_info { */ /* root squash */ struct root_squash_info ll_squash; + struct path ll_mnt; __kernel_fsid_t ll_fsid; struct kobject ll_kobj; /* sysfs object */ diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 0a87058..b229cbc 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -304,6 +304,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, sb->s_magic = LL_SUPER_MAGIC; sb->s_maxbytes = MAX_LFS_FILESIZE; sbi->ll_namelen = osfs->os_namelen; + sbi->ll_mnt.mnt = current->fs->root.mnt; if ((sbi->ll_flags & LL_SBI_USER_XATTR) && !(data->ocd_connect_flags & OBD_CONNECT_XATTR)) { @@ -1990,6 +1991,8 @@ void ll_umount_begin(struct super_block *sb) struct ll_sb_info *sbi = ll_s2sbi(sb); struct obd_device *obd; struct obd_ioctl_data *ioc_data; + wait_queue_head_t waitq; + struct l_wait_info lwi; CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb, sb->s_count, atomic_read(&sb->s_active)); @@ -2022,9 +2025,14 @@ void ll_umount_begin(struct super_block *sb) } /* Really, we'd like to wait until there are no requests outstanding, - * and then continue. For now, we just invalidate the requests, - * schedule() and sleep one second if needed, and hope. + * and then continue. For now, we just periodically checking for vfs + * to decrement mnt_cnt and hope to finish it within 10sec. */ + init_waitqueue_head(&waitq); + lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(10), + cfs_time_seconds(1), NULL, NULL); + l_wait_event(waitq, may_umount(sbi->ll_mnt.mnt), &lwi); + schedule(); } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:31 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:31 -0500 Subject: [lustre-devel] [PATCH 03/60] staging: lustre: clio: add cl_page LRU shrinker In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-4-git-send-email-jsimmons@infradead.org> From: Bobi Jam Register cache shrinker to reclaim memory from cl_page LRU list. Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6842 Reviewed-on: http://review.whamcloud.com/15630 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 2 + drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 + drivers/staging/lustre/lustre/osc/osc_internal.h | 9 +++ drivers/staging/lustre/lustre/osc/osc_page.c | 87 ++++++++++++++++++++++++ drivers/staging/lustre/lustre/osc/osc_request.c | 21 ++++++ 5 files changed, 120 insertions(+) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 7f0fc44..6d3bd05 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -287,6 +287,8 @@ struct client_obd { * the transaction has NOT yet committed. */ atomic_long_t cl_unstable_count; + /** Link to osc_shrinker_list */ + struct list_head cl_shrink_list; /* number of in flight destroy rpcs is limited to max_rpcs_in_flight */ atomic_t cl_destroy_in_flight; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 9be0142..675e25b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -336,6 +336,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) INIT_LIST_HEAD(&cli->cl_lru_list); spin_lock_init(&cli->cl_lru_list_lock); atomic_long_set(&cli->cl_unstable_count, 0); + INIT_LIST_HEAD(&cli->cl_shrink_list); init_waitqueue_head(&cli->cl_destroy_waitq); atomic_set(&cli->cl_destroy_in_flight, 0); diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index ff7c9ec..43a43e4 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -222,4 +222,13 @@ struct ldlm_lock *osc_dlmlock_at_pgoff(const struct lu_env *env, int osc_object_invalidate(const struct lu_env *env, struct osc_object *osc); +/** osc shrink list to link all osc client obd */ +extern struct list_head osc_shrink_list; +/** spin lock to protect osc_shrink_list */ +extern spinlock_t osc_shrink_lock; +unsigned long osc_cache_shrink_count(struct shrinker *sk, + struct shrink_control *sc); +unsigned long osc_cache_shrink_scan(struct shrinker *sk, + struct shrink_control *sc); + #endif /* OSC_INTERNAL_H */ diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index e356e4a..0461408 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -943,4 +943,91 @@ bool osc_over_unstable_soft_limit(struct client_obd *cli) cli->cl_max_rpcs_in_flight; } +/** + * Return how many LRU pages in the cache of all OSC devices + * + * Return: return # of cached LRU pages times reclaimation tendency + * SHRINK_STOP if it cannot do any scanning in this time + */ +unsigned long osc_cache_shrink_count(struct shrinker *sk, + struct shrink_control *sc) +{ + struct client_obd *cli; + unsigned long cached = 0; + + spin_lock(&osc_shrink_lock); + list_for_each_entry(cli, &osc_shrink_list, cl_shrink_list) + cached += atomic_long_read(&cli->cl_lru_in_list); + spin_unlock(&osc_shrink_lock); + + return (cached * sysctl_vfs_cache_pressure) / 100; +} + +/** + * Scan and try to reclaim sc->nr_to_scan cached LRU pages + * + * Return: number of cached LRU pages reclaimed + * SHRINK_STOP if it cannot do any scanning in this time + * + * Linux kernel will loop calling this shrinker scan routine with + * sc->nr_to_scan = SHRINK_BATCH(128 for now) until kernel got enough memory. + * + * If sc->nr_to_scan is 0, the VM is querying the cache size, we don't need + * to scan and try to reclaim LRU pages, just return 0 and + * osc_cache_shrink_count() will report the LRU page number. + */ +unsigned long osc_cache_shrink_scan(struct shrinker *sk, + struct shrink_control *sc) +{ + struct client_obd *stop_anchor = NULL; + struct client_obd *cli; + struct lu_env *env; + long shrank = 0; + int refcheck; + int rc; + + if (!sc->nr_to_scan) + return 0; + + if (!(sc->gfp_mask & __GFP_FS)) + return SHRINK_STOP; + + env = cl_env_get(&refcheck); + if (IS_ERR(env)) + return SHRINK_STOP; + + spin_lock(&osc_shrink_lock); + while (!list_empty(&osc_shrink_list)) { + cli = list_entry(osc_shrink_list.next, struct client_obd, + cl_shrink_list); + + if (!stop_anchor) + stop_anchor = cli; + else if (cli == stop_anchor) + break; + + list_move_tail(&cli->cl_shrink_list, &osc_shrink_list); + spin_unlock(&osc_shrink_lock); + + /* shrink no more than max_pages_per_rpc for an OSC */ + rc = osc_lru_shrink(env, cli, (sc->nr_to_scan - shrank) > + cli->cl_max_pages_per_rpc ? + cli->cl_max_pages_per_rpc : + sc->nr_to_scan - shrank, true); + if (rc > 0) + shrank += rc; + + if (shrank >= sc->nr_to_scan) + goto out; + + spin_lock(&osc_shrink_lock); + } + spin_unlock(&osc_shrink_lock); + +out: + cl_env_put(env, &refcheck); + + return shrank; +} + /** @} osc */ diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 3efae75..c2c0385 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -2675,6 +2675,11 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) INIT_LIST_HEAD(&cli->cl_grant_shrink_list); ns_register_cancel(obd->obd_namespace, osc_cancel_weight); + + spin_lock(&osc_shrink_lock); + list_add_tail(&cli->cl_shrink_list, &osc_shrink_list); + spin_unlock(&osc_shrink_lock); + return rc; out_ptlrpcd_work: @@ -2728,6 +2733,10 @@ static int osc_cleanup(struct obd_device *obd) struct client_obd *cli = &obd->u.cli; int rc; + spin_lock(&osc_shrink_lock); + list_del(&cli->cl_shrink_list); + spin_unlock(&osc_shrink_lock); + /* lru cleanup */ if (cli->cl_cache) { LASSERT(atomic_read(&cli->cl_cache->ccc_users) > 0); @@ -2795,6 +2804,15 @@ static int osc_process_config(struct obd_device *obd, u32 len, void *buf) .quotactl = osc_quotactl, }; +struct list_head osc_shrink_list = LIST_HEAD_INIT(osc_shrink_list); +DEFINE_SPINLOCK(osc_shrink_lock); + +static struct shrinker osc_cache_shrinker = { + .count_objects = osc_cache_shrink_count, + .scan_objects = osc_cache_shrink_scan, + .seeks = DEFAULT_SEEKS, +}; + static int __init osc_init(void) { struct lprocfs_static_vars lvars = { NULL }; @@ -2819,6 +2837,8 @@ static int __init osc_init(void) if (rc) goto out_kmem; + register_shrinker(&osc_cache_shrinker); + /* This is obviously too much memory, only prevent overflow here */ if (osc_reqpool_mem_max >= 1 << 12 || osc_reqpool_mem_max == 0) { rc = -EINVAL; @@ -2857,6 +2877,7 @@ static int __init osc_init(void) static void /*__exit*/ osc_exit(void) { + unregister_shrinker(&osc_cache_shrinker); class_unregister_type(LUSTRE_OSC_NAME); lu_kmem_fini(osc_caches); ptlrpc_free_rq_pool(osc_rq_pool); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:00 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:00 -0500 Subject: [lustre-devel] [PATCH 32/60] staging: lustre: osc: limits the number of chunks in write RPC In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-33-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong OSC has to make sure that it won't issue write RPCs with too many chunks otherwise it will casue ZFS to create transactions much bigger than DMU_MAX_ACCESS in size, which will end up with write failure. Signed-off-by: Jinshan Xiong Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8135 Reviewed-on: http://review.whamcloud.com/22369 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8632 Reviewed-on: http://review.whamcloud.com/22654 Reviewed-by: Andreas Dilger Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_cache.c | 124 ++++++++++++++++++-------- 1 file changed, 87 insertions(+), 37 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 72dd554..0490478 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1882,16 +1882,32 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, oap, osc, rc); } +struct extent_rpc_data { + struct list_head *erd_rpc_list; + unsigned int erd_page_count; + unsigned int erd_max_pages; + unsigned int erd_max_chunks; +}; + +static inline unsigned osc_extent_chunks(const struct osc_extent *ext) +{ + struct client_obd *cli = osc_cli(ext->oe_obj); + unsigned ppc_bits = cli->cl_chunkbits - PAGE_SHIFT; + + return (ext->oe_end >> ppc_bits) - (ext->oe_start >> ppc_bits) + 1; +} + /** * Try to add extent to one RPC. We need to think about the following things: * - # of pages must not be over max_pages_per_rpc * - extent must be compatible with previous ones */ static int try_to_add_extent_for_io(struct client_obd *cli, - struct osc_extent *ext, struct list_head *rpclist, - unsigned int *pc, unsigned int *max_pages) + struct osc_extent *ext, + struct extent_rpc_data *data) { struct osc_extent *tmp; + unsigned int chunk_count; struct osc_async_page *oap = list_first_entry(&ext->oe_pages, struct osc_async_page, oap_pending_item); @@ -1899,19 +1915,22 @@ static int try_to_add_extent_for_io(struct client_obd *cli, EASSERT((ext->oe_state == OES_CACHE || ext->oe_state == OES_LOCK_DONE), ext); - *max_pages = max(ext->oe_mppr, *max_pages); - if (*pc + ext->oe_nr_pages > *max_pages) + chunk_count = osc_extent_chunks(ext); + if (chunk_count > data->erd_max_chunks) + return 0; + + data->erd_max_pages = max(ext->oe_mppr, data->erd_max_pages); + if (data->erd_page_count + ext->oe_nr_pages > data->erd_max_pages) return 0; - list_for_each_entry(tmp, rpclist, oe_link) { + list_for_each_entry(tmp, data->erd_rpc_list, oe_link) { struct osc_async_page *oap2; oap2 = list_first_entry(&tmp->oe_pages, struct osc_async_page, oap_pending_item); EASSERT(tmp->oe_owner == current, tmp); if (oap2cl_page(oap)->cp_type != oap2cl_page(oap2)->cp_type) { - CDEBUG(D_CACHE, "Do not permit different type of IO" - " for a same RPC\n"); + CDEBUG(D_CACHE, "Do not permit different type of IO in one RPC\n"); return 0; } @@ -1924,12 +1943,41 @@ static int try_to_add_extent_for_io(struct client_obd *cli, break; } - *pc += ext->oe_nr_pages; - list_move_tail(&ext->oe_link, rpclist); + data->erd_max_chunks -= chunk_count; + data->erd_page_count += ext->oe_nr_pages; + list_move_tail(&ext->oe_link, data->erd_rpc_list); ext->oe_owner = current; return 1; } +static inline unsigned osc_max_write_chunks(const struct client_obd *cli) +{ + /* + * LU-8135: + * + * The maximum size of a single transaction is about 64MB in ZFS. + * #define DMU_MAX_ACCESS (64 * 1024 * 1024) + * + * Since ZFS is a copy-on-write file system, a single dirty page in + * a chunk will result in the rewrite of the whole chunk, therefore + * an RPC shouldn't be allowed to contain too many chunks otherwise + * it will make transaction size much bigger than 64MB, especially + * with big block size for ZFS. + * + * This piece of code is to make sure that OSC won't send write RPCs + * with too many chunks. The maximum chunk size that an RPC can cover + * is set to PTLRPC_MAX_BRW_SIZE, which is defined to 16MB. Ideally + * OST should tell the client what the biggest transaction size is, + * but it's good enough for now. + * + * This limitation doesn't apply to ldiskfs, which allows as many + * chunks in one RPC as we want. However, it won't have any benefits + * to have too many discontiguous pages in one RPC. Therefore, it + * can only have 256 chunks at most in one RPC. + */ + return min(PTLRPC_MAX_BRW_SIZE >> cli->cl_chunkbits, 256); +} + /** * In order to prevent multiple ptlrpcd from breaking contiguous extents, * get_write_extent() takes all appropriate extents in atomic. @@ -1949,26 +1997,28 @@ static unsigned int get_write_extents(struct osc_object *obj, struct client_obd *cli = osc_cli(obj); struct osc_extent *ext; struct osc_extent *temp; - unsigned int page_count = 0; - unsigned int max_pages = cli->cl_max_pages_per_rpc; + struct extent_rpc_data data = { + .erd_rpc_list = rpclist, + .erd_page_count = 0, + .erd_max_pages = cli->cl_max_pages_per_rpc, + .erd_max_chunks = osc_max_write_chunks(cli), + }; LASSERT(osc_object_is_locked(obj)); list_for_each_entry_safe(ext, temp, &obj->oo_hp_exts, oe_link) { LASSERT(ext->oe_state == OES_CACHE); - if (!try_to_add_extent_for_io(cli, ext, rpclist, &page_count, - &max_pages)) - return page_count; - EASSERT(ext->oe_nr_pages <= max_pages, ext); + if (!try_to_add_extent_for_io(cli, ext, &data)) + return data.erd_page_count; + EASSERT(ext->oe_nr_pages <= data.erd_max_pages, ext); } - if (page_count == max_pages) - return page_count; + if (data.erd_page_count == data.erd_max_pages) + return data.erd_page_count; while (!list_empty(&obj->oo_urgent_exts)) { ext = list_entry(obj->oo_urgent_exts.next, struct osc_extent, oe_link); - if (!try_to_add_extent_for_io(cli, ext, rpclist, &page_count, - &max_pages)) - return page_count; + if (!try_to_add_extent_for_io(cli, ext, &data)) + return data.erd_page_count; if (!ext->oe_intree) continue; @@ -1979,13 +2029,12 @@ static unsigned int get_write_extents(struct osc_object *obj, ext->oe_owner)) continue; - if (!try_to_add_extent_for_io(cli, ext, rpclist, - &page_count, &max_pages)) - return page_count; + if (!try_to_add_extent_for_io(cli, ext, &data)) + return data.erd_page_count; } } - if (page_count == max_pages) - return page_count; + if (data.erd_page_count == data.erd_max_pages) + return data.erd_page_count; ext = first_extent(obj); while (ext) { @@ -1996,13 +2045,12 @@ static unsigned int get_write_extents(struct osc_object *obj, continue; } - if (!try_to_add_extent_for_io(cli, ext, rpclist, &page_count, - &max_pages)) - return page_count; + if (!try_to_add_extent_for_io(cli, ext, &data)) + return data.erd_page_count; ext = next_extent(ext); } - return page_count; + return data.erd_page_count; } static int @@ -2087,27 +2135,29 @@ static unsigned int get_write_extents(struct osc_object *obj, struct osc_extent *ext; struct osc_extent *next; LIST_HEAD(rpclist); - unsigned int page_count = 0; - unsigned int max_pages = cli->cl_max_pages_per_rpc; + struct extent_rpc_data data = { + .erd_rpc_list = &rpclist, + .erd_page_count = 0, + .erd_max_pages = cli->cl_max_pages_per_rpc, + .erd_max_chunks = UINT_MAX, + }; int rc = 0; LASSERT(osc_object_is_locked(osc)); list_for_each_entry_safe(ext, next, &osc->oo_reading_exts, oe_link) { EASSERT(ext->oe_state == OES_LOCK_DONE, ext); - if (!try_to_add_extent_for_io(cli, ext, &rpclist, &page_count, - &max_pages)) + if (!try_to_add_extent_for_io(cli, ext, &data)) break; osc_extent_state_set(ext, OES_RPC); - EASSERT(ext->oe_nr_pages <= max_pages, ext); + EASSERT(ext->oe_nr_pages <= data.erd_max_pages, ext); } - LASSERT(page_count <= max_pages); + LASSERT(data.erd_page_count <= data.erd_max_pages); - osc_update_pending(osc, OBD_BRW_READ, -page_count); + osc_update_pending(osc, OBD_BRW_READ, -data.erd_page_count); if (!list_empty(&rpclist)) { osc_object_unlock(osc); - LASSERT(page_count > 0); rc = osc_build_rpc(env, cli, &rpclist, OBD_BRW_READ); LASSERT(list_empty(&rpclist)); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:13 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:13 -0500 Subject: [lustre-devel] [PATCH 45/60] staging: lustre: libcfs: Change positional struct initializers to C99 In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-46-git-send-email-jsimmons@infradead.org> From: Steve Guminski This patch makes no functional changes. Struct initializers in the libcfs directory that use C89 or GCC-only syntax are updated to C99 syntax. The C99 syntax prevents incorrect initialization if values are accidently placed in the wrong position, allows changes in the struct definition, and clears any members that are not given an explicit value. The following struct initializers have been updated: libcfs/include/libcfs/libcfs_crypto.h: static struct cfs_crypto_hash_type hash_types[] Signed-off-by: Steve Guminski Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6210 Reviewed-on: https://review.whamcloud.com/23332 Reviewed-by: Frank Zago Reviewed-by: Dmitry Eremin Reviewed-by: James Simmons Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_crypto.h | 60 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h index 8f34c5d..3f773a4 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h @@ -53,16 +53,56 @@ enum cfs_crypto_hash_alg { }; static struct cfs_crypto_hash_type hash_types[] = { - [CFS_HASH_ALG_NULL] = { "null", 0, 0 }, - [CFS_HASH_ALG_ADLER32] = { "adler32", 1, 4 }, - [CFS_HASH_ALG_CRC32] = { "crc32", ~0, 4 }, - [CFS_HASH_ALG_CRC32C] = { "crc32c", ~0, 4 }, - [CFS_HASH_ALG_MD5] = { "md5", 0, 16 }, - [CFS_HASH_ALG_SHA1] = { "sha1", 0, 20 }, - [CFS_HASH_ALG_SHA256] = { "sha256", 0, 32 }, - [CFS_HASH_ALG_SHA384] = { "sha384", 0, 48 }, - [CFS_HASH_ALG_SHA512] = { "sha512", 0, 64 }, - [CFS_HASH_ALG_MAX] = { NULL, 0, 64 }, + [CFS_HASH_ALG_NULL] = { + .cht_name = "null", + .cht_key = 0, + .cht_size = 0 + }, + [CFS_HASH_ALG_ADLER32] = { + .cht_name = "adler32", + .cht_key = 1, + .cht_size = 4 + }, + [CFS_HASH_ALG_CRC32] = { + .cht_name = "crc32", + .cht_key = ~0, + .cht_size = 4 + }, + [CFS_HASH_ALG_CRC32C] = { + .cht_name = "crc32c", + .cht_key = ~0, + .cht_size = 4 + }, + [CFS_HASH_ALG_MD5] = { + .cht_name = "md5", + .cht_key = 0, + .cht_size = 16 + }, + [CFS_HASH_ALG_SHA1] = { + .cht_name = "sha1", + .cht_key = 0, + .cht_size = 20 + }, + [CFS_HASH_ALG_SHA256] = { + .cht_name = "sha256", + .cht_key = 0, + .cht_size = 32 + }, + [CFS_HASH_ALG_SHA384] = { + .cht_name = "sha384", + .cht_key = 0, + .cht_size = 48 + }, + [CFS_HASH_ALG_SHA512] = { + .cht_name = "sha512", + .cht_key = 0, + .cht_size = 64 + }, + [CFS_HASH_ALG_MAX] = { + .cht_name = NULL, + .cht_key = 0, + .cht_size = 64 + }, }; /* Maximum size of hash_types[].cht_size */ -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:10 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:10 -0500 Subject: [lustre-devel] [PATCH 42/60] staging: lustre: ptlrpc: allow blocking asts to be delayed In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-43-git-send-email-jsimmons@infradead.org> From: Vladimir Saveliev ptlrpc_import_delay_req() refuses to delay blocking asts when import is not in LUSTRE_IMP_FULL yet. That leads to client eviction assuming that it failed to respond. Allow delays for blocking asts being resent. Signed-off-by: Vladimir Saveliev Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8351 Seagate-bug-id: MRP-3500 Reviewed-on: https://review.whamcloud.com/21065 Reviewed-by: Bobi Jam Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 3c18ab6..332b360 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1160,7 +1160,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, if (atomic_read(&imp->imp_inval_count) != 0) { DEBUG_REQ(D_ERROR, req, "invalidate in flight"); *status = -EIO; - } else if (imp->imp_dlm_fake || req->rq_no_delay) { + } else if (req->rq_no_delay) { *status = -EWOULDBLOCK; } else if (req->rq_allow_replay && (imp->imp_state == LUSTRE_IMP_REPLAY || diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c index c004490..c03e113 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/recover.c +++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c @@ -221,6 +221,7 @@ int ptlrpc_resend(struct obd_import *imp) } spin_unlock(&imp->imp_lock); + OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_ENQUEUE_OLD_EXPORT, 2); return 0; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:18 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:18 -0500 Subject: [lustre-devel] [PATCH 50/60] staging: lustre: ptlrpc: remove unused pc->pc_env In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-51-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Environment for request interpreters is not used any more. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8887 Reviewed-on: https://review.whamcloud.com/24061 Reviewed-by: John L. Hammond Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre_net.h | 4 ---- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 13 ------------- 2 files changed, 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 411eb0d..a73f168 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -1661,10 +1661,6 @@ struct ptlrpcd_ctl { */ char pc_name[16]; /** - * Environment for request interpreters to run in. - */ - struct lu_env pc_env; - /** * CPT the thread is bound on. */ int pc_cpt; diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 1f55d64..84c5551 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -562,15 +562,6 @@ int ptlrpcd_start(struct ptlrpcd_ctl *pc) return 0; } - /* - * So far only "client" ptlrpcd uses an environment. In the future, - * ptlrpcd thread (or a thread-set) has to be given an argument, - * describing its "scope". - */ - rc = lu_context_init(&pc->pc_env.le_ctx, LCT_CL_THREAD | LCT_REMEMBER); - if (rc != 0) - goto out; - task = kthread_run(ptlrpcd, pc, "%s", pc->pc_name); if (IS_ERR(task)) { rc = PTR_ERR(task); @@ -593,9 +584,6 @@ int ptlrpcd_start(struct ptlrpcd_ctl *pc) spin_unlock(&pc->pc_lock); ptlrpc_set_destroy(set); } - lu_context_fini(&pc->pc_env.le_ctx); - -out: clear_bit(LIOD_START, &pc->pc_flags); return rc; } @@ -623,7 +611,6 @@ void ptlrpcd_free(struct ptlrpcd_ctl *pc) } wait_for_completion(&pc->pc_finishing); - lu_context_fini(&pc->pc_env.le_ctx); spin_lock(&pc->pc_lock); pc->pc_set = NULL; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:27 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:27 -0500 Subject: [lustre-devel] [PATCH 59/60] staging: lustre: ptlrpc : remove userland usage from ptlrpc In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-60-git-send-email-jsimmons@infradead.org> The reason for __REQ_LAYOUT_USER__ was to expose a section of code in layout.c to userland for a utility similar to wireshark. This was done before wireshark existed but now that it does we no longer need to do this type of hack. This also reduces lustre_acl.h to strictly a kernel header now. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8945 Reviewed-on: https://review.whamcloud.com/24396 Reviewed-by: Dmitry Eremin Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre_req_layout.h | 10 ++-------- drivers/staging/lustre/lustre/ptlrpc/layout.c | 9 --------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h index fbcd395..cd62ccd 100644 --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h @@ -39,6 +39,8 @@ #ifndef _LUSTRE_REQ_LAYOUT_H__ #define _LUSTRE_REQ_LAYOUT_H__ +#include + /** \defgroup req_layout req_layout * * @{ @@ -66,11 +68,6 @@ struct req_capsule { __u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR]; }; -#if !defined(__REQ_LAYOUT_USER__) - -/* struct ptlrpc_request, lustre_msg* */ -#include "lustre_net.h" - void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req, enum req_location location); void req_capsule_fini(struct req_capsule *pill); @@ -120,9 +117,6 @@ void req_capsule_shrink(struct req_capsule *pill, int req_layout_init(void); void req_layout_fini(void); -/* __REQ_LAYOUT_USER__ */ -#endif - extern struct req_format RQF_OBD_PING; extern struct req_format RQF_OBD_SET_INFO; extern struct req_format RQF_SEC_CTX; diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 2052848..356d735 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -42,8 +42,6 @@ * of the format that the request conforms to. */ -#if !defined(__REQ_LAYOUT_USER__) - #define DEBUG_SUBSYSTEM S_RPC #include @@ -57,8 +55,6 @@ #include "../include/obd.h" #include "../include/obd_support.h" -/* __REQ_LAYOUT_USER__ */ -#endif /* struct ptlrpc_request, lustre_msg* */ #include "../include/lustre_req_layout.h" #include "../include/lustre_acl.h" @@ -1558,8 +1554,6 @@ struct req_format RQF_OST_GET_INFO_FIEMAP = ost_get_fiemap_server); EXPORT_SYMBOL(RQF_OST_GET_INFO_FIEMAP); -#if !defined(__REQ_LAYOUT_USER__) - /* Convenience macro */ #define FMT_FIELD(fmt, i, j) (fmt)->rf_fields[(i)].d[(j)] @@ -2238,6 +2232,3 @@ void req_capsule_shrink(struct req_capsule *pill, 1); } EXPORT_SYMBOL(req_capsule_shrink); - -/* __REQ_LAYOUT_USER__ */ -#endif -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:09 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:09 -0500 Subject: [lustre-devel] [PATCH 41/60] staging: lustre: osc: osc_match_base prototype differs from declaration In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-42-git-send-email-jsimmons@infradead.org> From: Steve Guminski The patch updates the prototype in osc_internal.h to match the enums used in the declaration. The osc_match_base declaration in lustre/osc/osc_request.c uses enums for stricter checking on the type and mode parameters: int osc_match_base(struct obd_export *exp, ... --> enum ldlm_type type, union ldlm_policy_data *policy, --> enum ldlm_mode mode, ... int unref) The prototype in lustre/osc/osc_internal.h instead used unsigned ints: int osc_match_base(struct obd_export *exp, ... --> __u32 type, union ldlm_policy_data *policy, --> __u32 mode, ... int unref); Signed-off-by: Steve Guminski Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8189 Reviewed-on: http://review.whamcloud.com/23167 Reviewed-by: Frank Zago Reviewed-by: Bob Glossman Reviewed-by: James Simmons Reviewed-by: John L. Hammond Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_internal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index 43a43e4..8abd83f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -114,9 +114,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, struct ptlrpc_request_set *rqset, int async, int agl); int osc_match_base(struct obd_export *exp, struct ldlm_res_id *res_id, - __u32 type, union ldlm_policy_data *policy, __u32 mode, - __u64 *flags, void *data, struct lustre_handle *lockh, - int unref); + enum ldlm_type type, union ldlm_policy_data *policy, + enum ldlm_mode mode, __u64 *flags, void *data, + struct lustre_handle *lockh, int unref); int osc_setattr_async(struct obd_export *exp, struct obdo *oa, obd_enqueue_update_f upcall, void *cookie, -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:25 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:25 -0500 Subject: [lustre-devel] [PATCH 57/60] staging: lustre: lmv: remove nlink check in lmv_revalidate_slaves In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-58-git-send-email-jsimmons@infradead.org> From: wang di If an application attempts to remove millions of files in a single directory it will fail. This failure was tracked down to the nlink < 2 check in lmv_revalidate_slaves, because after nlink reaches to maximum value of LDISKFS_LINK_MAX (65000), the nlink broadcast back from the server will be reported as one. The return value of 1 is not invalid so lets remove the check. Signed-off-by: wang di Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6984 Reviewed-on: http://review.whamcloud.com/16490 Reviewed-by: James Simmons Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index b1071cf..aa42066 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -220,21 +220,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, /* refresh slave from server */ body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); - LASSERT(body); - - if (unlikely(body->mbo_nlink < 2)) { - /* - * If this is bad stripe, most likely due - * to the race between close(unlink) and - * getattr, let's return -EONENT, so llite - * will revalidate the dentry see - * ll_inode_revalidate_fini() - */ - CDEBUG(D_INODE, "%s: nlink %d < 2 corrupt stripe %d "DFID":" DFID"\n", - obd->obd_name, body->mbo_nlink, i, - PFID(&lsm->lsm_md_oinfo[i].lmo_fid), - PFID(&lsm->lsm_md_oinfo[0].lmo_fid)); - + if (!body) { if (it.it_lock_mode && lockh) { ldlm_lock_decref(lockh, it.it_lock_mode); it.it_lock_mode = 0; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:51 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:51 -0500 Subject: [lustre-devel] [PATCH 23/60] staging: lustre: lmv: remove unused placement parameter In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-24-git-send-email-jsimmons@infradead.org> From: "John L. Hammond" Remove the unused lmv.*.placement parameter along with supporting functions and struct members. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7674 Reviewed-on: http://review.whamcloud.com/18019 Reviewed-by: Ben Evans Reviewed-by: Frank Zago Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 8 ---- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 1 - drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 68 --------------------------- 3 files changed, 77 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 6d3bd05..5c217c0 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -403,18 +403,10 @@ struct lmv_tgt_desc { unsigned long ltd_active:1; /* target up for requests */ }; -enum placement_policy { - PLACEMENT_CHAR_POLICY = 0, - PLACEMENT_NID_POLICY = 1, - PLACEMENT_INVAL_POLICY = 2, - PLACEMENT_MAX_POLICY -}; - struct lmv_obd { int refcount; struct lu_client_fld lmv_fld; spinlock_t lmv_lock; - enum placement_policy lmv_placement; struct lmv_desc desc; struct obd_uuid cluuid; struct obd_export *exp; diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 915415c..5926461 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -1284,7 +1284,6 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg) lmv->desc.ld_active_tgt_count = 0; lmv->max_def_easize = 0; lmv->max_easize = 0; - lmv->lmv_placement = PLACEMENT_CHAR_POLICY; spin_lock_init(&lmv->lmv_lock); mutex_init(&lmv->lmv_init_mutex); diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c index 14fbc9c..ff45802 100644 --- a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c +++ b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c @@ -50,73 +50,6 @@ static ssize_t numobd_show(struct kobject *kobj, struct attribute *attr, } LUSTRE_RO_ATTR(numobd); -static const char *placement_name[] = { - [PLACEMENT_CHAR_POLICY] = "CHAR", - [PLACEMENT_NID_POLICY] = "NID", - [PLACEMENT_INVAL_POLICY] = "INVAL" -}; - -static enum placement_policy placement_name2policy(char *name, int len) -{ - int i; - - for (i = 0; i < PLACEMENT_MAX_POLICY; i++) { - if (!strncmp(placement_name[i], name, len)) - return i; - } - return PLACEMENT_INVAL_POLICY; -} - -static const char *placement_policy2name(enum placement_policy placement) -{ - LASSERT(placement < PLACEMENT_MAX_POLICY); - return placement_name[placement]; -} - -static ssize_t placement_show(struct kobject *kobj, struct attribute *attr, - char *buf) -{ - struct obd_device *dev = container_of(kobj, struct obd_device, - obd_kobj); - struct lmv_obd *lmv; - - lmv = &dev->u.lmv; - return sprintf(buf, "%s\n", placement_policy2name(lmv->lmv_placement)); -} - -#define MAX_POLICY_STRING_SIZE 64 - -static ssize_t placement_store(struct kobject *kobj, struct attribute *attr, - const char *buffer, - size_t count) -{ - struct obd_device *dev = container_of(kobj, struct obd_device, - obd_kobj); - char dummy[MAX_POLICY_STRING_SIZE + 1]; - enum placement_policy policy; - struct lmv_obd *lmv = &dev->u.lmv; - - memcpy(dummy, buffer, MAX_POLICY_STRING_SIZE); - - if (count > MAX_POLICY_STRING_SIZE) - count = MAX_POLICY_STRING_SIZE; - - if (dummy[count - 1] == '\n') - count--; - dummy[count] = '\0'; - - policy = placement_name2policy(dummy, count); - if (policy != PLACEMENT_INVAL_POLICY) { - spin_lock(&lmv->lmv_lock); - lmv->lmv_placement = policy; - spin_unlock(&lmv->lmv_lock); - } else { - return -EINVAL; - } - return count; -} -LUSTRE_RW_ATTR(placement); - static ssize_t activeobd_show(struct kobject *kobj, struct attribute *attr, char *buf) { @@ -226,7 +159,6 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file) static struct attribute *lmv_attrs[] = { &lustre_attr_activeobd.attr, &lustre_attr_numobd.attr, - &lustre_attr_placement.attr, NULL, }; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:56 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:56 -0500 Subject: [lustre-devel] [PATCH 28/60] staging: lustre: ldlm: ASSERTION(flock->blocking_export!=0) failed In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-29-git-send-email-jsimmons@infradead.org> From: Andriy Skulysh Whole policy structure was zeroed twice. Once during enqueue and second time during resend or replay. Policy structure should be initialized with default values only in ldlm_lock_new(). Signed-off-by: Andriy Skulysh Signed-off-by: Ben Evans Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8349 Seagate-bug-id: MRP-2536, MRP-2909 Reviewed-on: http://review.whamcloud.com/21061 Reviewed-by: Alexander Boyko Reviewed-by: Vitaly Fertman Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_inodebits.c | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index 32b73ee..5616ea4 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -243,7 +243,6 @@ void ldlm_extent_unlink_lock(struct ldlm_lock *lock) void ldlm_extent_policy_wire_to_local(const union ldlm_wire_policy_data *wpolicy, union ldlm_policy_data *lpolicy) { - memset(lpolicy, 0, sizeof(*lpolicy)); lpolicy->l_extent.start = wpolicy->l_extent.start; lpolicy->l_extent.end = wpolicy->l_extent.end; lpolicy->l_extent.gid = wpolicy->l_extent.gid; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index f815827..b7f28b3 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -615,7 +615,6 @@ struct ldlm_flock_wait_data { void ldlm_flock_policy_wire_to_local(const union ldlm_wire_policy_data *wpolicy, union ldlm_policy_data *lpolicy) { - memset(lpolicy, 0, sizeof(*lpolicy)); lpolicy->l_flock.start = wpolicy->l_flock.lfw_start; lpolicy->l_flock.end = wpolicy->l_flock.lfw_end; lpolicy->l_flock.pid = wpolicy->l_flock.lfw_pid; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_inodebits.c b/drivers/staging/lustre/lustre/ldlm/ldlm_inodebits.c index 8e1709d..ae37c36 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_inodebits.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_inodebits.c @@ -57,7 +57,6 @@ void ldlm_ibits_policy_wire_to_local(const union ldlm_wire_policy_data *wpolicy, union ldlm_policy_data *lpolicy) { - memset(lpolicy, 0, sizeof(*lpolicy)); lpolicy->l_inodebits.bits = wpolicy->l_inodebits.bits; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:04:32 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:04:32 -0500 Subject: [lustre-devel] [PATCH 04/60] staging: lustre: mdc: quiet console message for known -EINTR In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-5-git-send-email-jsimmons@infradead.org> From: Andreas Dilger If a user process is waiting for MDS recovery during close, but the process is interrupted, the file is still closed but it prints a message on the console. Quiet the console message for -EINTR, since this is expected behaviour. Signed-off-by: Andreas Dilger Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6627 Reviewed-on: http://review.whamcloud.com/14911 Reviewed-by: Frank Zago Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 0ee02f1..a1e51a5 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -122,26 +122,25 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, enum mds_op_bias bias, void *data) { - struct obd_export *exp = ll_i2mdexp(inode); + const struct ll_inode_info *lli = ll_i2info(inode); struct md_op_data *op_data; struct ptlrpc_request *req = NULL; - struct obd_device *obd = class_exp2obd(exp); int rc; - if (!obd) { - /* - * XXX: in case of LMV, is this correct to access - * ->exp_handle? - */ - CERROR("Invalid MDC connection handle %#llx\n", - ll_i2mdexp(inode)->exp_handle.h_cookie); + if (!class_exp2obd(md_exp)) { + CERROR("%s: invalid MDC connection handle closing " DFID "\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(&lli->lli_fid)); rc = 0; goto out; } op_data = kzalloc(sizeof(*op_data), GFP_NOFS); + /* + * We leak openhandle and request here on error, but not much to be + * done in OOM case since app won't retry close on error either. + */ if (!op_data) { - /* XXX We leak openhandle and request here. */ rc = -ENOMEM; goto out; } @@ -170,10 +169,9 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, } rc = md_close(md_exp, op_data, och->och_mod, &req); - if (rc) { - CERROR("%s: inode "DFID" mdc close failed: rc = %d\n", - ll_i2mdexp(inode)->exp_obd->obd_name, - PFID(ll_inode2fid(inode)), rc); + if (rc && rc != -EINTR) { + CERROR("%s: inode " DFID " mdc close failed: rc = %d\n", + md_exp->exp_obd->obd_name, PFID(&lli->lli_fid), rc); } if (op_data->op_bias & (MDS_HSM_RELEASE | MDS_CLOSE_LAYOUT_SWAP) && @@ -192,8 +190,7 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, och->och_fh.cookie = DEAD_HANDLE_MAGIC; kfree(och); - if (req) /* This is close request */ - ptlrpc_req_finished(req); + ptlrpc_req_finished(req); return rc; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:21 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:21 -0500 Subject: [lustre-devel] [PATCH 53/60] staging: lustre: ptlrpc: update replay cursor when close during replay In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-54-git-send-email-jsimmons@infradead.org> From: Niu Yawei The replay cursor should be updated properly when close happened during replay, otherwise, ptlrpc_replay_next() could run into a dead loop due to an invalid replay cursor: - replay cursor is moved to an open request during replay; - application close that open file, so the rq_replay of the open request is cleared; - ptlrpc_replay_next() calls ptlrpc_free_committed() to free committed/closed requests, the open request is removed from the committed list, so the replay cursor is changed to an empty list_head now. The open request won't be freed now since it's still held by the pending close request; - ptlrpc_replay_next() continue to move the replay cursor to next and run into a dead loop at the end; Another change in this patch is to remove the out of date comments in ptlrpc_replay_next() and cover the whole process of finding replay request within imp_lock, because: 1. With two separated replay lists and replay cursor introduced, finding replay request won't take much time as before, it's not necessary to do this "lock -> unlock -> lock -> unlock" trick anymore; 2. Nowadays there are various kind of non-replay requests are allowed during recovery, so ptlrpc_free_committed() may run in parallel to remove an open request while ptlrpc_replay_next() is iterating the open requests list; Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8765 Reviewed-on: https://review.whamcloud.com/23418 Reviewed-by: Yang Sheng Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/client.c | 15 ++++++++++----- drivers/staging/lustre/lustre/ptlrpc/recover.c | 23 +---------------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 332b360..8dfb40f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -2662,11 +2662,16 @@ void ptlrpc_free_committed(struct obd_import *imp) list_for_each_entry_safe(req, saved, &imp->imp_committed_list, rq_replay_list) { LASSERT(req->rq_transno != 0); - if (req->rq_import_generation < imp->imp_generation) { - DEBUG_REQ(D_RPCTRACE, req, "free stale open request"); - ptlrpc_free_request(req); - } else if (!req->rq_replay) { - DEBUG_REQ(D_RPCTRACE, req, "free closed open request"); + if (req->rq_import_generation < imp->imp_generation || + !req->rq_replay) { + DEBUG_REQ(D_RPCTRACE, req, "free %s open request", + req->rq_import_generation < + imp->imp_generation ? "stale" : "closed"); + + if (imp->imp_replay_cursor == &req->rq_replay_list) + imp->imp_replay_cursor = + req->rq_replay_list.next; + ptlrpc_free_request(req); } } diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c index c03e113..7b58545 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/recover.c +++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c @@ -78,28 +78,11 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) imp->imp_last_transno_checked = 0; ptlrpc_free_committed(imp); last_transno = imp->imp_last_replay_transno; - spin_unlock(&imp->imp_lock); CDEBUG(D_HA, "import %p from %s committed %llu last %llu\n", imp, obd2cli_tgt(imp->imp_obd), imp->imp_peer_committed_transno, last_transno); - /* Do I need to hold a lock across this iteration? We shouldn't be - * racing with any additions to the list, because we're in recovery - * and are therefore not processing additional requests to add. Calls - * to ptlrpc_free_committed might commit requests, but nothing "newer" - * than the one we're replaying (it can't be committed until it's - * replayed, and we're doing that here). l_f_e_safe protects against - * problems with the current request being committed, in the unlikely - * event of that race. So, in conclusion, I think that it's safe to - * perform this list-walk without the imp_lock held. - * - * But, the {mdc,osc}_replay_open callbacks both iterate - * request lists, and have comments saying they assume the - * imp_lock is being held by ptlrpc_replay, but it's not. it's - * just a little race... - */ - /* Replay all the committed open requests on committed_list first */ if (!list_empty(&imp->imp_committed_list)) { tmp = imp->imp_committed_list.prev; @@ -107,10 +90,6 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) /* The last request on committed_list hasn't been replayed */ if (req->rq_transno > last_transno) { - /* Since the imp_committed_list is immutable before - * all of it's requests being replayed, it's safe to - * use a cursor to accelerate the search - */ if (!imp->imp_resend_replay || imp->imp_replay_cursor == &imp->imp_committed_list) imp->imp_replay_cursor = imp->imp_replay_cursor->next; @@ -124,6 +103,7 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) break; req = NULL; + LASSERT(!list_empty(imp->imp_replay_cursor)); imp->imp_replay_cursor = imp->imp_replay_cursor->next; } @@ -156,7 +136,6 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) if (req && imp->imp_resend_replay) lustre_msg_add_flags(req->rq_reqmsg, MSG_RESENT); - spin_lock(&imp->imp_lock); /* The resend replay request may have been removed from the * unreplied list. */ -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:26 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:26 -0500 Subject: [lustre-devel] [PATCH 58/60] staging: lustre: osc: avoid 64 divide in osc_cache_too_much In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-59-git-send-email-jsimmons@infradead.org> The use of 64 bit time introduces an expensive 64 bit division operation. Since the time lapse being calculated in osc_cache_too_much will never be more than seventy years we can cast the time lapse to an long and perform a normal 32 bit divison operation instead. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8835 Reviewed-on: https://review.whamcloud.com/23814 Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_page.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 0461408..ab9d0d7 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -370,12 +370,17 @@ static int osc_cache_too_much(struct client_obd *cli) return lru_shrink_min(cli); } else { time64_t duration = ktime_get_real_seconds(); + long timediff; /* knock out pages by duration of no IO activity */ duration -= cli->cl_lru_last_used; - duration >>= 6; /* approximately 1 minute */ - if (duration > 0 && - pages >= div64_s64((s64)budget, duration)) + /* + * The difference shouldn't be more than 70 years + * so we can safely case to a long. Round to + * approximately 1 minute. + */ + timediff = (long)(duration >> 6); + if (timediff > 0 && pages >= budget / timediff) return lru_shrink_min(cli); } return 0; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:14 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:14 -0500 Subject: [lustre-devel] [PATCH 46/60] staging: lustre: mdc: Make IT_OPEN take lookup bits lock In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-47-git-send-email-jsimmons@infradead.org> From: Patrick Farrell An earlier commit accidentally changed handling of IT_OPEN, making it take the MDS_INODELOCK_UPDATE bits lock instead of MDS_INODELOCK_LOOKUP. This does not cause any known bugs. Signed-off-by: Patrick Farrell Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8842 Reviewed-on: https://review.whamcloud.com/23797 Fixes: 70a251f68dea ("staging: lustre: obd: decruft md_enqueue() and md_intent_lock()" Reviewed-by: John L. Hammond Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 156add7..91a7243 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -721,7 +721,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, LASSERT(!policy); saved_flags |= LDLM_FL_HAS_INTENT; - if (it->it_op & (IT_OPEN | IT_UNLINK | IT_GETATTR | IT_READDIR)) + if (it->it_op & (IT_UNLINK | IT_GETATTR | IT_READDIR)) policy = &update_policy; else if (it->it_op & IT_LAYOUT) policy = &layout_policy; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:28 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:28 -0500 Subject: [lustre-devel] [PATCH 60/60] staging: lustre: libcfs: fix minimum size check for libcfs ioctl In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-61-git-send-email-jsimmons@infradead.org> The check for the smallest ioctl data in libcfs_ioctl_getdata() is incorrect. Instead of checking against struct libcfs_ioctl_data compare the size to struct libcfs_ioctl_hdr. Reported-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c index 3f5d58b..bda6c16 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c @@ -134,7 +134,7 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, return -EINVAL; } - if (hdr.ioc_len < sizeof(struct libcfs_ioctl_data)) { + if (hdr.ioc_len < sizeof(hdr)) { CERROR("libcfs ioctl: user buffer too small for ioctl\n"); return -EINVAL; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:08 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:08 -0500 Subject: [lustre-devel] [PATCH 40/60] staging: ptlrpc: leaked rs on difficult reply In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-41-git-send-email-jsimmons@infradead.org> From: Niu Yawei reply_out_callback() should call ptlrpc_schedule_difficult_reply() to finalize the rs if it's already not on uncommitted list, otherwise, the rs and the export held by rs could be leaked: - target_send_reply() sends a difficult reply before the transaction committed, the reply is linked to scp_rep_active; - export gets disconnected by umount or whatever reason, server_disconnect_export() is called to complete all outstanding replies, which will calls into ptlrpc_handle_rs() to dispose of the rs, so the rs is removed from the uncommitted list and LNetMDUnlink() is called to unlink the reply buffer and generate an unlink event; - reply_out_callback() is called to process above unlink event, ptlrpc_schedule_difficult_reply() is supposed to be called to dispose of the rs finally. However, it could be skipped because of following flawed code snippet: if (!rs->rs_no_ack || rs->rs_transno <= rs->rs_export->exp_obd->obd_last_committed) ptlrpc_schedule_difficult_reply(rs); The intention of above code is: if rs_no_ack is true (COS enabled), and transaction is not committed, we should rely on commit callback to release the rs. However, it overlooked the situation that rs could have been removed from the uncommitted list by disconnecting export. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7903 Reviewed-on: http://review.whamcloud.com/22696 Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/events.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index ae1650d..dc0fe9d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -420,7 +420,8 @@ void reply_out_callback(lnet_event_t *ev) rs->rs_on_net = 0; if (!rs->rs_no_ack || rs->rs_transno <= - rs->rs_export->exp_obd->obd_last_committed) + rs->rs_export->exp_obd->obd_last_committed || + list_empty(&rs->rs_obd_list)) ptlrpc_schedule_difficult_reply(rs); spin_unlock(&rs->rs_lock); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:20 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:20 -0500 Subject: [lustre-devel] [PATCH 52/60] staging: lustre: linkea: linkEA size limitation In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-53-git-send-email-jsimmons@infradead.org> From: Fan Yong Under DNE mode, if we do not restrict the linkEA size, and if there are too many cross-MDTs hard links to the same object, then it will casue the llog overflow. On the other hand, too many linkEA entries in the linkEA will serious affect the linkEA performance because we only support to locate linkEA entry consecutively. So we need to restrict the linkEA size. Currently, it is 4096 bytes, that is independent from the backend. If too many hard links caused the linkEA overflowed, we will add overflow timestamp in the linkEA header. Such overflow timestamp has some functionalities: 1. It will prevent the object being migrated to other MDT, because some name entries may be not in the linkEA, so we cannot update these name entries for the migration. 2. It will tell the namespace LFSCK that the 'nlink' attribute may be more trustable than the linkEA, then avoid misguiding the namespace LFSCK to repair 'nlink' attribute based on linkEA. There will be subsequent patch(es) for namespace LFSCK to handle the linkEA size limitation and overflow cases. Signed-off-by: Fan Yong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8569 Reviewed-on: https://review.whamcloud.com/23500 Reviewed-by: Andreas Dilger Reviewed-by: wangdi Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre/lustre_idl.h | 5 +- .../staging/lustre/lustre/include/lustre_linkea.h | 15 ++++- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- drivers/staging/lustre/lustre/obdclass/linkea.c | 70 +++++++++++++++++----- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 16 ++--- 5 files changed, 81 insertions(+), 27 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index b0eb80d..fc960da 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -3217,9 +3217,8 @@ struct link_ea_header { __u32 leh_magic; __u32 leh_reccount; __u64 leh_len; /* total size */ - /* future use */ - __u32 padding1; - __u32 padding2; + __u32 leh_overflow_time; + __u32 leh_padding; }; /** Hardlink data is name and parent fid. diff --git a/drivers/staging/lustre/lustre/include/lustre_linkea.h b/drivers/staging/lustre/lustre/include/lustre_linkea.h index 249e8bf..3ff008f 100644 --- a/drivers/staging/lustre/lustre/include/lustre_linkea.h +++ b/drivers/staging/lustre/lustre/include/lustre_linkea.h @@ -26,7 +26,19 @@ * Author: di wang */ -#define DEFAULT_LINKEA_SIZE 4096 +/* There are several reasons to restrict the linkEA size: + * + * 1. Under DNE mode, if we do not restrict the linkEA size, and if there + * are too many cross-MDTs hard links to the same object, then it will + * casue the llog overflow. + * + * 2. Some backend has limited size for EA. For example, if without large + * EA enabled, the ldiskfs will make all EAs to share one (4K) EA block. + * + * 3. Too many entries in linkEA will seriously affect linkEA performance + * because we only support to locate linkEA entry consecutively. + */ +#define MAX_LINKEA_SIZE 4096 struct linkea_data { /** @@ -43,6 +55,7 @@ struct linkea_data { int linkea_data_new(struct linkea_data *ldata, struct lu_buf *buf); int linkea_init(struct linkea_data *ldata); +int linkea_init_with_rec(struct linkea_data *ldata); void linkea_entry_unpack(const struct link_ea_entry *lee, int *reclen, struct lu_name *lname, struct lu_fid *pfid); int linkea_entry_pack(struct link_ea_entry *lee, const struct lu_name *lname, diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index b229cbc..9a9cdb0 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -2553,7 +2553,7 @@ static int ll_linkea_decode(struct linkea_data *ldata, unsigned int linkno, unsigned int idx; int rc; - rc = linkea_init(ldata); + rc = linkea_init_with_rec(ldata); if (rc < 0) return rc; diff --git a/drivers/staging/lustre/lustre/obdclass/linkea.c b/drivers/staging/lustre/lustre/obdclass/linkea.c index 0b1d2f0..dddd0c4 100644 --- a/drivers/staging/lustre/lustre/obdclass/linkea.c +++ b/drivers/staging/lustre/lustre/obdclass/linkea.c @@ -39,6 +39,8 @@ int linkea_data_new(struct linkea_data *ldata, struct lu_buf *buf) ldata->ld_leh->leh_magic = LINK_EA_MAGIC; ldata->ld_leh->leh_len = sizeof(struct link_ea_header); ldata->ld_leh->leh_reccount = 0; + ldata->ld_leh->leh_overflow_time = 0; + ldata->ld_leh->leh_padding = 0; return 0; } EXPORT_SYMBOL(linkea_data_new); @@ -53,11 +55,15 @@ int linkea_init(struct linkea_data *ldata) leh->leh_magic = LINK_EA_MAGIC; leh->leh_reccount = __swab32(leh->leh_reccount); leh->leh_len = __swab64(leh->leh_len); - /* entries are swabbed by linkea_entry_unpack */ + leh->leh_overflow_time = __swab32(leh->leh_overflow_time); + leh->leh_padding = __swab32(leh->leh_padding); + /* individual entries are swabbed by linkea_entry_unpack() */ } + if (leh->leh_magic != LINK_EA_MAGIC) return -EINVAL; - if (leh->leh_reccount == 0) + + if (leh->leh_reccount == 0 && leh->leh_overflow_time == 0) return -ENODATA; ldata->ld_leh = leh; @@ -65,6 +71,18 @@ int linkea_init(struct linkea_data *ldata) } EXPORT_SYMBOL(linkea_init); +int linkea_init_with_rec(struct linkea_data *ldata) +{ + int rc; + + rc = linkea_init(ldata); + if (!rc && ldata->ld_leh->leh_reccount == 0) + rc = -ENODATA; + + return rc; +} +EXPORT_SYMBOL(linkea_init_with_rec); + /** * Pack a link_ea_entry. * All elements are stored as chars to avoid alignment issues. @@ -94,6 +112,8 @@ int linkea_entry_pack(struct link_ea_entry *lee, const struct lu_name *lname, void linkea_entry_unpack(const struct link_ea_entry *lee, int *reclen, struct lu_name *lname, struct lu_fid *pfid) { + LASSERT(lee); + *reclen = (lee->lee_reclen[0] << 8) | lee->lee_reclen[1]; memcpy(pfid, &lee->lee_parent_fid, sizeof(*pfid)); fid_be_to_cpu(pfid, pfid); @@ -110,25 +130,45 @@ void linkea_entry_unpack(const struct link_ea_entry *lee, int *reclen, int linkea_add_buf(struct linkea_data *ldata, const struct lu_name *lname, const struct lu_fid *pfid) { - LASSERT(ldata->ld_leh); + struct link_ea_header *leh = ldata->ld_leh; + int reclen; + + LASSERT(leh); if (!lname || !pfid) return -EINVAL; - ldata->ld_reclen = lname->ln_namelen + sizeof(struct link_ea_entry); - if (ldata->ld_leh->leh_len + ldata->ld_reclen > - ldata->ld_buf->lb_len) { + reclen = lname->ln_namelen + sizeof(struct link_ea_entry); + if (unlikely(leh->leh_len + reclen > MAX_LINKEA_SIZE)) { + /* + * Use 32-bits to save the overflow time, although it will + * shrink the ktime_get_real_seconds() returned 64-bits value + * to 32-bits value, it is still quite large and can be used + * for about 140 years. That is enough. + */ + leh->leh_overflow_time = ktime_get_real_seconds(); + if (unlikely(leh->leh_overflow_time == 0)) + leh->leh_overflow_time++; + + CDEBUG(D_INODE, "No enough space to hold linkea entry '" DFID ": %.*s' at %u\n", + PFID(pfid), lname->ln_namelen, + lname->ln_name, leh->leh_overflow_time); + return 0; + } + + if (leh->leh_len + reclen > ldata->ld_buf->lb_len) { if (lu_buf_check_and_grow(ldata->ld_buf, - ldata->ld_leh->leh_len + - ldata->ld_reclen) < 0) + leh->leh_len + reclen) < 0) return -ENOMEM; + + ldata->ld_leh = ldata->ld_buf->lb_buf; + leh = ldata->ld_leh; } - ldata->ld_leh = ldata->ld_buf->lb_buf; - ldata->ld_lee = ldata->ld_buf->lb_buf + ldata->ld_leh->leh_len; + ldata->ld_lee = ldata->ld_buf->lb_buf + leh->leh_len; ldata->ld_reclen = linkea_entry_pack(ldata->ld_lee, lname, pfid); - ldata->ld_leh->leh_len += ldata->ld_reclen; - ldata->ld_leh->leh_reccount++; + leh->leh_len += ldata->ld_reclen; + leh->leh_reccount++; CDEBUG(D_INODE, "New link_ea name '" DFID ":%.*s' is added\n", PFID(pfid), lname->ln_namelen, lname->ln_name); return 0; @@ -139,6 +179,7 @@ int linkea_add_buf(struct linkea_data *ldata, const struct lu_name *lname, void linkea_del_buf(struct linkea_data *ldata, const struct lu_name *lname) { LASSERT(ldata->ld_leh && ldata->ld_lee); + LASSERT(ldata->ld_leh->leh_reccount > 0); ldata->ld_leh->leh_reccount--; ldata->ld_leh->leh_len -= ldata->ld_reclen; @@ -174,8 +215,9 @@ int linkea_links_find(struct linkea_data *ldata, const struct lu_name *lname, LASSERT(ldata->ld_leh); - /* link #0 */ - ldata->ld_lee = (struct link_ea_entry *)(ldata->ld_leh + 1); + /* link #0, if leh_reccount == 0 we skip the loop and return -ENOENT */ + if (likely(ldata->ld_leh->leh_reccount > 0)) + ldata->ld_lee = (struct link_ea_entry *)(ldata->ld_leh + 1); for (count = 0; count < ldata->ld_leh->leh_reccount; count++) { linkea_entry_unpack(ldata->ld_lee, &ldata->ld_reclen, diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index a04e36c..f166518 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -3820,14 +3820,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct link_ea_header, leh_len)); LASSERTF((int)sizeof(((struct link_ea_header *)0)->leh_len) == 8, "found %lld\n", (long long)(int)sizeof(((struct link_ea_header *)0)->leh_len)); - LASSERTF((int)offsetof(struct link_ea_header, padding1) == 16, "found %lld\n", - (long long)(int)offsetof(struct link_ea_header, padding1)); - LASSERTF((int)sizeof(((struct link_ea_header *)0)->padding1) == 4, "found %lld\n", - (long long)(int)sizeof(((struct link_ea_header *)0)->padding1)); - LASSERTF((int)offsetof(struct link_ea_header, padding2) == 20, "found %lld\n", - (long long)(int)offsetof(struct link_ea_header, padding2)); - LASSERTF((int)sizeof(((struct link_ea_header *)0)->padding2) == 4, "found %lld\n", - (long long)(int)sizeof(((struct link_ea_header *)0)->padding2)); + LASSERTF((int)offsetof(struct link_ea_header, leh_overflow_time) == 16, "found %lld\n", + (long long)(int)offsetof(struct link_ea_header, leh_overflow_time)); + LASSERTF((int)sizeof(((struct link_ea_header *)0)->leh_overflow_time) == 4, "found %lld\n", + (long long)(int)sizeof(((struct link_ea_header *)0)->leh_overflow_time)); + LASSERTF((int)offsetof(struct link_ea_header, leh_padding) == 20, "found %lld\n", + (long long)(int)offsetof(struct link_ea_header, leh_padding)); + LASSERTF((int)sizeof(((struct link_ea_header *)0)->leh_padding) == 4, "found %lld\n", + (long long)(int)sizeof(((struct link_ea_header *)0)->leh_padding)); CLASSERT(LINK_EA_MAGIC == 0x11EAF1DFUL); /* Checks for struct link_ea_entry */ -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 00:05:22 2017 From: jsimmons at infradead.org (James Simmons) Date: Sat, 28 Jan 2017 19:05:22 -0500 Subject: [lustre-devel] [PATCH 54/60] staging: lustre: fid: Change positional struct initializers to C99 In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Message-ID: <1485648328-2141-55-git-send-email-jsimmons@infradead.org> From: Steve Guminski This patch makes no functional changes. Struct initializers in the fid directory that use C89 or GCC-only syntax are updated to C99 syntax. The C99 syntax prevents incorrect initialization if values are accidently placed in the wrong position, allows changes in the struct definition, and clears any members that are not given an explicit value. The following struct initializers have been updated: lustre/fid/fid_lib.c: const struct lu_seq_range LUSTRE_SEQ_SPACE_RANGE const struct lu_seq_range LUSTRE_SEQ_ZERO_RANGE lustre/fid/lproc_fid.c: struct lprocfs_vars seq_client_debugfs_list Signed-off-by: Steve Guminski Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6210 Reviewed-on: https://review.whamcloud.com/23789 Reviewed-by: Nathaniel Clark Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/fid/fid_lib.c | 7 +++---- drivers/staging/lustre/lustre/fid/lproc_fid.c | 12 ++++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_lib.c b/drivers/staging/lustre/lustre/fid/fid_lib.c index 4e49cb3..9eb4059 100644 --- a/drivers/staging/lustre/lustre/fid/fid_lib.c +++ b/drivers/staging/lustre/lustre/fid/fid_lib.c @@ -60,14 +60,13 @@ * FID_SEQ_START + 2 is for .lustre directory and its objects */ const struct lu_seq_range LUSTRE_SEQ_SPACE_RANGE = { - FID_SEQ_NORMAL, - (__u64)~0ULL + .lsr_start = FID_SEQ_NORMAL, + .lsr_end = (__u64)~0ULL, }; /* Zero range, used for init and other purposes. */ const struct lu_seq_range LUSTRE_SEQ_ZERO_RANGE = { - 0, - 0 + .lsr_start = 0, }; /* Lustre Big Fs Lock fid. */ diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c index 97d4849..3eed838 100644 --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c @@ -203,9 +203,13 @@ LPROC_SEQ_FOPS_RO(ldebugfs_fid_fid); struct lprocfs_vars seq_client_debugfs_list[] = { - { "space", &ldebugfs_fid_space_fops }, - { "width", &ldebugfs_fid_width_fops }, - { "server", &ldebugfs_fid_server_fops }, - { "fid", &ldebugfs_fid_fid_fops }, + { .name = "space", + .fops = &ldebugfs_fid_space_fops }, + { .name = "width", + .fops = &ldebugfs_fid_width_fops }, + { .name = "server", + .fops = &ldebugfs_fid_server_fops }, + { .name = "fid", + .fops = &ldebugfs_fid_fid_fops }, { NULL } }; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 29 23:56:38 2017 From: jsimmons at infradead.org (James Simmons) Date: Sun, 29 Jan 2017 23:56:38 +0000 (GMT) Subject: [lustre-devel] [PATCH 0/8] staging: lustre: lnet: change wire protocol typedefs to proper structure In-Reply-To: <1485205276.12563.30.camel@perches.com> References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> <1485205276.12563.30.camel@perches.com> Message-ID: > On Sat, 2017-01-21 at 19:40 -0500, James Simmons wrote: > > The upstream kernel requires proper structures so > > convert nearly all the LNet wire protocols typedefs in > > the LNet core. > > Thanks. > > Perhaps s/\bWIRE_ATTR\b/__packed/g one day too I liked to keep that one. The point of WIRE_ATTR isn't to be some abstraction but to label that struct as something that goes over the wire. This lets people know that it would break something if you change that structure. Looks like I need to send a patch that adds a comment explaning the meaning of WIRE_ATTR. From jsimmons at infradead.org Mon Jan 30 00:09:26 2017 From: jsimmons at infradead.org (James Simmons) Date: Mon, 30 Jan 2017 00:09:26 +0000 (GMT) Subject: [lustre-devel] [PATCH] staging: lustre: headers: potential UAPI headers In-Reply-To: <20170121092459.GA29138@kroah.com> References: <1482167207-22800-1-git-send-email-jsimmons@infradead.org> <20170103141248.GA8695@kroah.com> <20170117074140.GA19328@kroah.com> <20170121092459.GA29138@kroah.com> Message-ID: > > > > > On Mon, Dec 19, 2016 at 12:06:47PM -0500, James Simmons wrote: > > > > > > Not for landing. This is the purposed UAPI headers > > > > > > with the removal of unlikely and debugging macros. > > > > > > This is just for feedback to see if this is acceptable > > > > > > for the upstream client. > > > > > > > > > > > > Signed-off-by: James Simmons > > > > > > --- > > > > > > .../lustre/lustre/include/lustre/lustre_fid.h | 353 +++++++++++++++++++++ > > > > > > .../lustre/lustre/include/lustre/lustre_ostid.h | 233 ++++++++++++++ > > > > > > > > > > Can you make a lustre "uapi" directory so we can see which files you > > > > > really want to be UAPI and which you don't as time goes on? > > > > > > > > Where do you want them placed? In uapi/linux/lustre or uapi/lustre. Does > > > > it matter to you? The below was to forth coming UAPI headers which from > > > > your response you seem okay with in general. > > > > > > How many .h files are there going to be? It's just a single filesystem, > > > shouldn't you just need a single file? If so, how about > > > drivers/staging/lustre/include/uapi/lustre.h > > > ? > > > > > > If you really need multiple .h files, put them all in the same uapi/ > > > directory with a lustre_ prefix, you don't need a whole subdir just for > > > yourself, right? > > > > We have 12 UAPI headers and yes they all begin with lustre_*. Okay I will > > create a driver/staging/lustre/include/uapi/linux directory and start > > moving headers there. > > 12 seems like a lot just for a single, tiny, filesystem :) I bet several lustre sys admins find this funny. Lustre exposes a lot of functionality to the applications to help them best optimize their behavior. That extra complexity can make admins and even normal users head spin!!! > But moving them all to a single directory will see where we can later > merge them together, sounds like a good plan. That would be one big header that would be constantly change. BTW we also have a few headers for LNet as well. One of them is lnetst.h which is for the LNet testing utility. It would be strange to merge a network simulation api into what standard users would use. Lets see once the work is done. I'm discussing currently with Intel developers the path forward on this work but it show be done in the near future. From gregkh at linuxfoundation.org Mon Jan 30 06:40:19 2017 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 30 Jan 2017 07:40:19 +0100 Subject: [lustre-devel] [PATCH 0/8] staging: lustre: lnet: change wire protocol typedefs to proper structure In-Reply-To: References: <1485045632-5886-1-git-send-email-jsimmons@infradead.org> <1485205276.12563.30.camel@perches.com> Message-ID: <20170130064018.GA4108@kroah.com> On Sun, Jan 29, 2017 at 11:56:38PM +0000, James Simmons wrote: > > > On Sat, 2017-01-21 at 19:40 -0500, James Simmons wrote: > > > The upstream kernel requires proper structures so > > > convert nearly all the LNet wire protocols typedefs in > > > the LNet core. > > > > Thanks. > > > > Perhaps s/\bWIRE_ATTR\b/__packed/g one day too > > I liked to keep that one. Sorry, but no. > The point of WIRE_ATTR isn't to be some abstraction but to label that > struct as something that goes over the wire. This lets people know > that it would break something if you change that structure. Looks like > I need to send a patch that adds a comment explaning the meaning of > WIRE_ATTR. No, please remove it, it's not anything that any other kernel subsystem uses. It's easy to know if you will break something, anything that crosses the user/kernel boundry falls into that category, so if it is in a uapi .h file, that's going to be the case. thanks, greg k-h From dan.carpenter at oracle.com Mon Jan 30 10:51:49 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 30 Jan 2017 13:51:49 +0300 Subject: [lustre-devel] [patch] staging: lustre: libcfs: double copy bug Message-ID: <20170130105149.GA14399@mwanda> The problem is that we copy hdr.ioc_len, we verify it, then we copy it again without checking to see if it has changed in between the two copies. This could result in an information leak. Signed-off-by: Dan Carpenter diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c index 3f5d58babc2f..075826bd3a2a 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c @@ -122,7 +122,7 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, const struct libcfs_ioctl_hdr __user *uhdr) { struct libcfs_ioctl_hdr hdr; - int err = 0; + int err; if (copy_from_user(&hdr, uhdr, sizeof(hdr))) return -EFAULT; @@ -150,9 +150,20 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, return -ENOMEM; if (copy_from_user(*hdr_pp, uhdr, hdr.ioc_len)) { - LIBCFS_FREE(*hdr_pp, hdr.ioc_len); err = -EFAULT; + goto free; } + + if ((*hdr_pp)->ioc_version != hdr.ioc_version || + (*hdr_pp)->ioc_len != hdr.ioc_len) { + err = -EINVAL; + goto free; + } + + return 0; + +free: + LIBCFS_FREE(*hdr_pp, hdr.ioc_len); return err; } From dan.carpenter at oracle.com Mon Jan 30 10:51:56 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 30 Jan 2017 13:51:56 +0300 Subject: [lustre-devel] [PATCH 60/60] staging: lustre: libcfs: fix minimum size check for libcfs ioctl In-Reply-To: <1485648328-2141-61-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-61-git-send-email-jsimmons@infradead.org> Message-ID: <20170130105156.GA6881@mwanda> It looks like what happened is there were two patches applied out of sync. Let's add a fixes tag and CC the original author. Fixes: ed2f549dc0f6 ("staging: lustre: libcfs: test if userland data is to small") This patch was probably correct when it was written but commit 1290932728e5 ("staging: lustre: Dynamic LNet Configuration (DLC) IOCTL changes") ended up getting applied first so the size was wrong. The lstcon_ioctl_entry() function doesn't have enough size checking. Also I'm uncomfortable with: data = container_of(hdr, struct libcfs_ioctl_data, ioc_hdr); If hdr isn't the first member of the struct then the code is broken but container_of() implies that that isn't a hard requirement. It should just be: data = (struct libcfs_ioctl_data *)hdr; regards, dan carpenter From dan.carpenter at oracle.com Mon Jan 30 10:54:46 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 30 Jan 2017 13:54:46 +0300 Subject: [lustre-devel] [PATCH 60/60] staging: lustre: libcfs: fix minimum size check for libcfs ioctl In-Reply-To: <20170130105156.GA6881@mwanda> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-61-git-send-email-jsimmons@infradead.org> <20170130105156.GA6881@mwanda> Message-ID: <20170130105446.GA6970@mwanda> On Mon, Jan 30, 2017 at 01:51:56PM +0300, Dan Carpenter wrote: > The lstcon_ioctl_entry() function doesn't have enough size checking. Actually, the lstcon_ioctl_entry() would have been fine before we apply this [patch 60/60]... As near as I can tell, no in kernel code is negatively affected by the bug this patch fixes. regards, dan carpenter From dan.carpenter at oracle.com Mon Jan 30 11:34:23 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 30 Jan 2017 14:34:23 +0300 Subject: [lustre-devel] [PATCH 05/60] staging: lustre: llite: check request != NULL in ll_migrate In-Reply-To: <1485648328-2141-6-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-6-git-send-email-jsimmons@infradead.org> Message-ID: <20170130113423.GB6881@mwanda> On Sat, Jan 28, 2017 at 07:04:33PM -0500, James Simmons wrote: > From: wang di > > Check if the request is NULL, before retrieve reply body > from the request. > > Signed-off-by: wang di > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7396 > Reviewed-on: http://review.whamcloud.com/17079 > Reviewed-by: John L. Hammond > Reviewed-by: Andreas Dilger > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/llite/file.c | 41 +++++++++++++++++------------- > 1 file changed, 23 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c > index a1e51a5..b681e15 100644 > --- a/drivers/staging/lustre/lustre/llite/file.c > +++ b/drivers/staging/lustre/lustre/llite/file.c > @@ -2656,28 +2656,33 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, > if (!rc) > ll_update_times(request, parent); > I don't like how we return a non-NULL request on many error paths. It would be simpler to understand if mdc_rename() freed request on error. So mdc_reint() fails but we still continue? I don't understand that but there are no comments about it. > - body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); > - if (!body) { > - rc = -EPROTO; > - goto out_free; > - } > + if (request) { > + body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); > + if (!body) { > + rc = -EPROTO; > + goto out_free; We should call ptlrpc_req_finished(request) before returning on this path. regards, dan carpenter From dan.carpenter at oracle.com Mon Jan 30 12:03:52 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Mon, 30 Jan 2017 15:03:52 +0300 Subject: [lustre-devel] [PATCH 13/60] staging: lustre: obdclass: health_check to report unhealthy upon LBUG In-Reply-To: <1485648328-2141-14-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-14-git-send-email-jsimmons@infradead.org> Message-ID: <20170130120352.GC6881@mwanda> Wat? I'm sorry but this patch makes no sense at all. On Sat, Jan 28, 2017 at 07:04:41PM -0500, James Simmons wrote: > From: Bruno Faccini > > When a LBUG has occurred, without panic_on_lbug being set, > health_check sysfs file must return an unhealthy state. Why? > > Signed-off-by: Bruno Faccini > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7486 > Reviewed-on: http://review.whamcloud.com/17981 > Reviewed-by: Bobi Jam > Reviewed-by: Niu Yawei > Reviewed-by: James Simmons > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c > index 22e6d1f..ef25db6 100644 > --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c > +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c > @@ -224,8 +224,10 @@ static ssize_t pinger_show(struct kobject *kobj, struct attribute *attr, > int i; > size_t len = 0; > > - if (libcfs_catastrophe) > - return sprintf(buf, "LBUG\n"); > + if (libcfs_catastrophe) { > + len = sprintf(buf, "LBUG\n"); This line is dead code, now. > + healthy = false; > + } > regards, dan carpenter From jsimmons at infradead.org Tue Jan 31 00:48:29 2017 From: jsimmons at infradead.org (James Simmons) Date: Tue, 31 Jan 2017 00:48:29 +0000 (GMT) Subject: [lustre-devel] [PATCH 60/60] staging: lustre: libcfs: fix minimum size check for libcfs ioctl In-Reply-To: <20170130105446.GA6970@mwanda> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-61-git-send-email-jsimmons@infradead.org> <20170130105156.GA6881@mwanda> <20170130105446.GA6970@mwanda> Message-ID: > On Mon, Jan 30, 2017 at 01:51:56PM +0300, Dan Carpenter wrote: > > The lstcon_ioctl_entry() function doesn't have enough size checking. > > Actually, the lstcon_ioctl_entry() would have been fine before we apply > this [patch 60/60]... As near as I can tell, no in kernel code is > negatively affected by the bug this patch fixes. There is one, the ioctl IOC_LIBCFS_GET_LNET_STATS was affected by this bug. That is how it was founded. From jsimmons at infradead.org Tue Jan 31 01:00:59 2017 From: jsimmons at infradead.org (James Simmons) Date: Tue, 31 Jan 2017 01:00:59 +0000 (GMT) Subject: [lustre-devel] [PATCH 13/60] staging: lustre: obdclass: health_check to report unhealthy upon LBUG In-Reply-To: <20170130120352.GC6881@mwanda> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-14-git-send-email-jsimmons@infradead.org> <20170130120352.GC6881@mwanda> Message-ID: > Wat? > > I'm sorry but this patch makes no sense at all. > > On Sat, Jan 28, 2017 at 07:04:41PM -0500, James Simmons wrote: > > From: Bruno Faccini > > > > When a LBUG has occurred, without panic_on_lbug being set, > > health_check sysfs file must return an unhealthy state. > > Why? Its a patch being applied out of order issue. Originally this patch was written before this was moved to sysfs and the original code didn't return right after printing "LBUG". The move to sysfs changed this behavior. I will fix up the out of tree code in this case. > > > > Signed-off-by: Bruno Faccini > > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7486 > > Reviewed-on: http://review.whamcloud.com/17981 > > Reviewed-by: Bobi Jam > > Reviewed-by: Niu Yawei > > Reviewed-by: James Simmons > > Reviewed-by: Oleg Drokin > > Signed-off-by: James Simmons > > --- > > drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c > > index 22e6d1f..ef25db6 100644 > > --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c > > +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c > > @@ -224,8 +224,10 @@ static ssize_t pinger_show(struct kobject *kobj, struct attribute *attr, > > int i; > > size_t len = 0; > > > > - if (libcfs_catastrophe) > > - return sprintf(buf, "LBUG\n"); > > + if (libcfs_catastrophe) { > > + len = sprintf(buf, "LBUG\n"); > > This line is dead code, now. > > > + healthy = false; > > + } > > > > regards, > dan carpenter > > From jsimmons at infradead.org Tue Jan 31 02:25:22 2017 From: jsimmons at infradead.org (James Simmons) Date: Tue, 31 Jan 2017 02:25:22 +0000 (GMT) Subject: [lustre-devel] [PATCH 60/60] staging: lustre: libcfs: fix minimum size check for libcfs ioctl In-Reply-To: <20170130105156.GA6881@mwanda> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-61-git-send-email-jsimmons@infradead.org> <20170130105156.GA6881@mwanda> Message-ID: > It looks like what happened is there were two patches applied out of > sync. Let's add a fixes tag and CC the original author. So the only problem here is the commit message. I will update it then. > Fixes: ed2f549dc0f6 ("staging: lustre: libcfs: test if userland data is to small") > > This patch was probably correct when it was written but commit > 1290932728e5 ("staging: lustre: Dynamic LNet Configuration (DLC) IOCTL > changes") ended up getting applied first so the size was wrong. > > The lstcon_ioctl_entry() function doesn't have enough size checking. This sounds like a separate patch. I will open a ticket about this and your comments below. > Also I'm uncomfortable with: > > data = container_of(hdr, struct libcfs_ioctl_data, ioc_hdr); > > If hdr isn't the first member of the struct then the code is broken but > container_of() implies that that isn't a hard requirement. It should > just be: > > data = (struct libcfs_ioctl_data *)hdr; Don't know if hdr being first is a hard requirment. Doug, Amir do you know if it is an requirement? From dan.carpenter at oracle.com Tue Jan 31 08:13:29 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 31 Jan 2017 11:13:29 +0300 Subject: [lustre-devel] [PATCH 60/60] staging: lustre: libcfs: fix minimum size check for libcfs ioctl In-Reply-To: References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-61-git-send-email-jsimmons@infradead.org> <20170130105156.GA6881@mwanda> Message-ID: <20170131081329.GE6881@mwanda> On Tue, Jan 31, 2017 at 02:25:22AM +0000, James Simmons wrote: > This sounds like a separate patch. I will open a ticket about this and > your comments below. There are a some other places that need a size requirement like LNetCtl(). It really feels like it should be a part of this patch because this patch is introducing a security breakage and it's just fixing a normal bug. regards, dan carpenter From dan.carpenter at oracle.com Tue Jan 31 08:53:24 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 31 Jan 2017 11:53:24 +0300 Subject: [lustre-devel] [PATCH 14/60] staging: lustre: lov: Ensure correct operation for large object sizes In-Reply-To: <1485648328-2141-15-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-15-git-send-email-jsimmons@infradead.org> Message-ID: <20170131085324.GG6881@mwanda> On Sat, Jan 28, 2017 at 07:04:42PM -0500, James Simmons wrote: > From: Nathaniel Clark > > If a backing filesystem (ZFS) returns that it supports very large > (LLONG_MAX) object sizes, that should be correctly supported. This > fixes the check for unitialized stripe_maxbytes in > lsm_unpackmd_common(), so that ZFS can return LLONG_MAX and it will be > okay. This issue is excersized by writing to or past the 2TB boundary > of a singly stripped file. > > Signed-off-by: Nathaniel Clark > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7890 > Reviewed-on: http://review.whamcloud.com/19066 > Reviewed-by: Andreas Dilger > Reviewed-by: Jinshan Xiong > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/lov/lov_ea.c | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c > index ac0bf64..07dee87 100644 > --- a/drivers/staging/lustre/lustre/lov/lov_ea.c > +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c > @@ -150,7 +150,7 @@ static int lsm_unpackmd_common(struct lov_obd *lov, > struct lov_mds_md *lmm, > struct lov_ost_data_v1 *objects) > { > - loff_t stripe_maxbytes = LLONG_MAX; > + loff_t min_stripe_maxbytes = 0, lov_bytes; I've seen this thing in sevaral patches and I haven't commented on it but please don't do this. unsigned long foo = 0, bar; It took my a long time to find the lov_bytes declaration hiding off the end here. We haven't made checkpatch.pl complain about it yet but it's not kernel style. One declaration per line and especially if they aren't closely related like "int left, right;" and doubly especially if there is an initialization involved. > unsigned int stripe_count; > struct lov_oinfo *loi; > unsigned int i; > @@ -168,8 +168,6 @@ static int lsm_unpackmd_common(struct lov_obd *lov, > stripe_count = lsm_is_released(lsm) ? 0 : lsm->lsm_stripe_count; > > for (i = 0; i < stripe_count; i++) { > - loff_t tgt_bytes; > - > loi = lsm->lsm_oinfo[i]; > ostid_le_to_cpu(&objects[i].l_ost_oi, &loi->loi_oi); > loi->loi_ost_idx = le32_to_cpu(objects[i].l_ost_idx); > @@ -194,17 +192,21 @@ static int lsm_unpackmd_common(struct lov_obd *lov, > continue; > } > > - tgt_bytes = lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx]); > - stripe_maxbytes = min_t(loff_t, stripe_maxbytes, tgt_bytes); > + lov_bytes = lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx]); > + if (min_stripe_maxbytes == 0 || lov_bytes < min_stripe_maxbytes) > + min_stripe_maxbytes = lov_bytes; > } > > - if (stripe_maxbytes == LLONG_MAX) > - stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; > + if (min_stripe_maxbytes == 0) > + min_stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; > + > + stripe_count = lsm->lsm_stripe_count ?: lov->desc.ld_tgt_count; > + lov_bytes = min_stripe_maxbytes * stripe_count; > > - if (!lsm->lsm_stripe_count) > - lsm->lsm_maxbytes = stripe_maxbytes * lov->desc.ld_tgt_count; > + if (lov_bytes < min_stripe_maxbytes) /* handle overflow */ Signed overflows are undefined. I think we use GCC options so that the compiler does not remove these checks but I also know that I have been wrong before about GCC options and undefined behavior. regards, dan carpenter From dan.carpenter at oracle.com Tue Jan 31 08:54:29 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 31 Jan 2017 11:54:29 +0300 Subject: [lustre-devel] [PATCH 21/60] staging: lustre: ptlrpc: correct use of list_add_tail() In-Reply-To: <1485648328-2141-22-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-22-git-send-email-jsimmons@infradead.org> Message-ID: <20170131085429.GH6881@mwanda> On Sat, Jan 28, 2017 at 07:04:49PM -0500, James Simmons wrote: > From: "John L. Hammond" > > In sptlrpc_gc_add_sec() swap the arguments to list_add_tail() so that > it does what we meant it to do. > Huh... This is from before lustre was merged into staging. What are the user visible effects of this bug? I would have expected it to get caught earlier. > Signed-off-by: John L. Hammond > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8270 I bet the answer to my question is on this link but I'm reviewing offline right now. Plus that's not where the bug description belongs. regards, dan carpenter From dan.carpenter at oracle.com Tue Jan 31 08:55:42 2017 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Tue, 31 Jan 2017 11:55:42 +0300 Subject: [lustre-devel] [PATCH 22/60] staging: lustre: fid: fix race in fid allocation In-Reply-To: <1485648328-2141-23-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-23-git-send-email-jsimmons@infradead.org> Message-ID: <20170131085542.GI6881@mwanda> On Sat, Jan 28, 2017 at 07:04:50PM -0500, James Simmons wrote: > - if (!fid_is_zero(&seq->lcs_fid) && > - fid_oid(&seq->lcs_fid) < seq->lcs_width) { > + if (unlikely(!fid_is_zero(&seq->lcs_fid) && > + fid_oid(&seq->lcs_fid) < seq->lcs_width)) { What does adding an unlikely have to do with the race condition? Also only add likely/unlikely when it makes a difference to benchmarks. Otherwise leave it out. > /* Just bump last allocated fid and return to caller. */ > - seq->lcs_fid.f_oid += 1; > + seq->lcs_fid.f_oid++; Ok... I'm pretty sure the compiler can figure this out on its own. Stop mixing white space changes into your bug fixes. It just makes reviewing more complicated. > rc = 0; > break; > } > regards, dan carpenter From paf at cray.com Tue Jan 31 13:25:20 2017 From: paf at cray.com (Patrick Farrell) Date: Tue, 31 Jan 2017 13:25:20 +0000 Subject: [lustre-devel] [PATCH 21/60] staging: lustre: ptlrpc: correct use of list_add_tail() In-Reply-To: <20170131085429.GH6881@mwanda> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> <1485648328-2141-22-git-send-email-jsimmons@infradead.org>, <20170131085429.GH6881@mwanda> Message-ID: Dan, This is a A) a still fairly rarely used crypto feature [A full and usable implementation of it is relatively recent, and this is supporting code that I believe is older.], and B) per that link, the crash only happens when you change your shared key during operation. So, I'd guess it's a pretty rare thing to do. - Patrick ________________________________ From: lustre-devel on behalf of Dan Carpenter Sent: Tuesday, January 31, 2017 2:54:29 AM To: James Simmons Cc: devel at driverdev.osuosl.org; Greg Kroah-Hartman; Linux Kernel Mailing List; Oleg Drokin; Lustre Development List Subject: Re: [lustre-devel] [PATCH 21/60] staging: lustre: ptlrpc: correct use of list_add_tail() On Sat, Jan 28, 2017 at 07:04:49PM -0500, James Simmons wrote: > From: "John L. Hammond" > > In sptlrpc_gc_add_sec() swap the arguments to list_add_tail() so that > it does what we meant it to do. > Huh... This is from before lustre was merged into staging. What are the user visible effects of this bug? I would have expected it to get caught earlier. > Signed-off-by: John L. Hammond > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8270 I bet the answer to my question is on this link but I'm reviewing offline right now. Plus that's not where the bug description belongs. regards, dan carpenter _______________________________________________ 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: