lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
* [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing
@ 2019-07-22  2:12 James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 01/10] lustre: ldlm: discard varname in ldlm_pool James Simmons
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

Several patches from lustre-testing have been reviewed and tested.
They are ready to land to the main lustre branch. One patch in
lustre-testing to remove set_cblist in ptlrpc has been replaced by
a patch from John Hammond that removed even more.

John L. Hammond (1):
  lustre: ptlrpc: simplify struct ptlrpc_request_set

NeilBrown (9):
  lustre: ldlm: discard varname in ldlm_pool.
  lustre: lprocfs: use log2.h macros instead of shift loop.
  lustre: ptlrpc: make ptlrpc_bulk_frag_ops always const.
  lustre: mgc: remove llog_process_lock
  lustre: don't declare extern variables in C files.
  lnet: socklnd: fix infinite loop in ksocknal_push()
  lustre: ptlrpc: remove inline on non-inlined functions.
  lustre: convert rsi_sem to a spinlock.
  lustre: ptlrpc: make ptlrpc_last_xid an atomic64_t

 fs/lustre/include/lustre_net.h      | 47 +-------------------
 fs/lustre/include/obd_class.h       | 25 +----------
 fs/lustre/ldlm/ldlm_internal.h      |  2 -
 fs/lustre/ldlm/ldlm_pool.c          | 18 +++-----
 fs/lustre/ldlm/ldlm_resource.c      |  2 -
 fs/lustre/llite/llite_lib.c         |  8 ++--
 fs/lustre/llite/lproc_llite.c       |  4 +-
 fs/lustre/lov/lov_obd.c             | 85 ++++++++++++-------------------------
 fs/lustre/mgc/mgc_request.c         |  6 +--
 fs/lustre/obdclass/lprocfs_status.c | 18 +++-----
 fs/lustre/ptlrpc/client.c           | 82 ++++++++++++++---------------------
 fs/lustre/ptlrpc/import.c           |  1 -
 fs/lustre/ptlrpc/ptlrpc_module.c    |  5 ---
 net/lnet/klnds/socklnd/socklnd.c    |  2 +-
 14 files changed, 82 insertions(+), 223 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 01/10] lustre: ldlm: discard varname in ldlm_pool.
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 02/10] lustre: lprocfs: use log2.h macros instead of shift loop James Simmons
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

This allocated buffer serves no purpose.
A constant string is copied into it, it is passed to some
function which copies it out again, then the buffer is freed.
Instead, we can pass the constant string to that function.

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-4423
Reviewed-on: https://review.whamcloud.com/35273
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ldlm/ldlm_internal.h |  2 --
 fs/lustre/ldlm/ldlm_pool.c     | 18 +++++-------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/fs/lustre/ldlm/ldlm_internal.h b/fs/lustre/ldlm/ldlm_internal.h
index 05d5b08..a6dee9f 100644
--- a/fs/lustre/ldlm/ldlm_internal.h
+++ b/fs/lustre/ldlm/ldlm_internal.h
@@ -31,8 +31,6 @@
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
-#define MAX_STRING_SIZE 128
-
 extern int ldlm_srv_namespace_nr;
 extern int ldlm_cli_namespace_nr;
 extern struct mutex ldlm_srv_namespace_lock;
diff --git a/fs/lustre/ldlm/ldlm_pool.c b/fs/lustre/ldlm/ldlm_pool.c
index 6714c30..3dfbde5 100644
--- a/fs/lustre/ldlm/ldlm_pool.c
+++ b/fs/lustre/ldlm/ldlm_pool.c
@@ -504,9 +504,9 @@ static ssize_t grant_speed_show(struct kobject *kobj, struct attribute *attr,
 LDLM_POOL_SYSFS_WRITER_NOLOCK_STORE(lock_volume_factor, atomic);
 LUSTRE_RW_ATTR(lock_volume_factor);
 
-#define LDLM_POOL_ADD_VAR(name, var, ops)			\
+#define LDLM_POOL_ADD_VAR(_name, var, ops)			\
 	do {							\
-		snprintf(var_name, MAX_STRING_SIZE, #name);	\
+		pool_vars[0].name = #_name;			\
 		pool_vars[0].data = var;			\
 		pool_vars[0].fops = ops;			\
 		ldebugfs_add_vars(pl->pl_debugfs_entry, pool_vars, NULL);\
@@ -558,25 +558,18 @@ static int ldlm_pool_debugfs_init(struct ldlm_pool *pl)
 						 ns_pool);
 	struct dentry *debugfs_ns_parent;
 	struct lprocfs_vars pool_vars[2];
-	char *var_name = NULL;
 	int rc = 0;
 
-	var_name = kzalloc(MAX_STRING_SIZE + 1, GFP_NOFS);
-	if (!var_name)
-		return -ENOMEM;
-
 	debugfs_ns_parent = ns->ns_debugfs_entry;
 	if (IS_ERR_OR_NULL(debugfs_ns_parent)) {
 		CERROR("%s: debugfs entry is not initialized\n",
 		       ldlm_ns_name(ns));
 		rc = -EINVAL;
-		goto out_free_name;
+		goto out;
 	}
 	pl->pl_debugfs_entry = debugfs_create_dir("pool", debugfs_ns_parent);
 
-	var_name[MAX_STRING_SIZE] = '\0';
 	memset(pool_vars, 0, sizeof(pool_vars));
-	pool_vars[0].name = var_name;
 
 	LDLM_POOL_ADD_VAR(state, pl, &lprocfs_pool_state_fops);
 
@@ -584,7 +577,7 @@ static int ldlm_pool_debugfs_init(struct ldlm_pool *pl)
 					   LDLM_POOL_FIRST_STAT, 0);
 	if (!pl->pl_stats) {
 		rc = -ENOMEM;
-		goto out_free_name;
+		goto out;
 	}
 
 	lprocfs_counter_init(pl->pl_stats, LDLM_POOL_GRANTED_STAT,
@@ -623,8 +616,7 @@ static int ldlm_pool_debugfs_init(struct ldlm_pool *pl)
 	debugfs_create_file("stats", 0644, pl->pl_debugfs_entry, pl->pl_stats,
 			    &lprocfs_stats_seq_fops);
 
-out_free_name:
-	kfree(var_name);
+out:
 	return rc;
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 02/10] lustre: lprocfs: use log2.h macros instead of shift loop.
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 01/10] lustre: ldlm: discard varname in ldlm_pool James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 03/10] lustre: ptlrpc: make ptlrpc_bulk_frag_ops always const James Simmons
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

These shift loops seem to be trying to avoid doing a
multiplication.
The same effect can be achieved more transparently using
rounddown_pow_of_two().  Even though there is a multiplication
in the C code, the resulting machine code just does a single shift.

As rounddown_pow_of_two() is not defined for 0, and as we cannot be
positively use the blk_size is non-zero, use blk_size ?: 1.

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-4423
Reviewed-on: https://review.whamcloud.com/35274
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/obdclass/lprocfs_status.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/lustre/obdclass/lprocfs_status.c b/fs/lustre/obdclass/lprocfs_status.c
index c5f5807..2b4302e 100644
--- a/fs/lustre/obdclass/lprocfs_status.c
+++ b/fs/lustre/obdclass/lprocfs_status.c
@@ -373,9 +373,7 @@ static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr,
 		u32 blk_size = osfs.os_bsize >> 10;
 		u64 result = osfs.os_blocks;
 
-		while (blk_size >>= 1)
-			result <<= 1;
-
+		result *= rounddown_pow_of_two(blk_size ?: 1);
 		return sprintf(buf, "%llu\n", result);
 	}
 
@@ -396,8 +394,7 @@ static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr,
 		u32 blk_size = osfs.os_bsize >> 10;
 		u64 result = osfs.os_bfree;
 
-		while (blk_size >>= 1)
-			result <<= 1;
+		result *= rounddown_pow_of_two(blk_size ?: 1);
 
 		return sprintf(buf, "%llu\n", result);
 	}
@@ -419,8 +416,7 @@ static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr,
 		u32 blk_size = osfs.os_bsize >> 10;
 		u64 result = osfs.os_bavail;
 
-		while (blk_size >>= 1)
-			result <<= 1;
+		result *= rounddown_pow_of_two(blk_size ?: 1);
 
 		return sprintf(buf, "%llu\n", result);
 	}
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 03/10] lustre: ptlrpc: make ptlrpc_bulk_frag_ops always const.
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 01/10] lustre: ldlm: discard varname in ldlm_pool James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 02/10] lustre: lprocfs: use log2.h macros instead of shift loop James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 04/10] lustre: mgc: remove llog_process_lock James Simmons
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

There is one place where a non-const pointer to this struct
exists, and that causes a cast to be required.

Make it always const, and discard the cast.

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-4423
Reviewed-on: https://review.whamcloud.com/35295
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_net.h | 2 +-
 fs/lustre/ptlrpc/client.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/lustre/include/lustre_net.h b/fs/lustre/include/lustre_net.h
index 1cf0f12..83f8aff 100644
--- a/fs/lustre/include/lustre_net.h
+++ b/fs/lustre/include/lustre_net.h
@@ -1222,7 +1222,7 @@ struct ptlrpc_bulk_desc {
 	struct obd_import		*bd_import;
 	/** Back pointer to the request */
 	struct ptlrpc_request		*bd_req;
-	struct ptlrpc_bulk_frag_ops	*bd_frag_ops;
+	const struct ptlrpc_bulk_frag_ops *bd_frag_ops;
 	wait_queue_head_t		bd_waitq;     /* server side only WQ */
 	int				bd_iov_count; /* # entries in bd_iov */
 	int				bd_max_iov;   /* allocated size of bd_iov */
diff --git a/fs/lustre/ptlrpc/client.c b/fs/lustre/ptlrpc/client.c
index 364c61f..ff1fa68 100644
--- a/fs/lustre/ptlrpc/client.c
+++ b/fs/lustre/ptlrpc/client.c
@@ -150,7 +150,7 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int nfrags,
 	desc->bd_portal = portal;
 	desc->bd_type = type;
 	desc->bd_md_count = 0;
-	desc->bd_frag_ops = (struct ptlrpc_bulk_frag_ops *)ops;
+	desc->bd_frag_ops = ops;
 	LASSERT(max_brw > 0);
 	desc->bd_md_max_brw = min(max_brw, PTLRPC_BULK_OPS_COUNT);
 	/*
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 04/10] lustre: mgc: remove llog_process_lock
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
                   ` (2 preceding siblings ...)
  2019-07-22  2:12 ` [lustre-devel] [PATCH 03/10] lustre: ptlrpc: make ptlrpc_bulk_frag_ops always const James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 05/10] lustre: don't declare extern variables in C files James Simmons
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

This mutex is never used, so remove it.

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-4423
Reviewed-on: https://review.whamcloud.com/35293
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/mgc/mgc_request.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/lustre/mgc/mgc_request.c b/fs/lustre/mgc/mgc_request.c
index fa0be5c..581ffb0 100644
--- a/fs/lustre/mgc/mgc_request.c
+++ b/fs/lustre/mgc/mgc_request.c
@@ -384,8 +384,6 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd,
 	return ERR_PTR(rc);
 }
 
-static DEFINE_MUTEX(llog_process_lock);
-
 static inline void config_mark_cld_stop(struct config_llog_data *cld)
 {
 	if (!cld)
@@ -1538,9 +1536,7 @@ static int mgc_process_cfg_log(struct obd_device *mgc,
 	__llog_ctxt_put(env, ctxt);
 
 	/*
-	 * update settings on existing OBDs. doing it inside
-	 * of llog_process_lock so no device is attaching/detaching
-	 * in parallel.
+	 * update settings on existing OBDs.
 	 * the logname must be <fsname>-sptlrpc
 	 */
 	if (sptlrpc_started) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 05/10] lustre: don't declare extern variables in C files.
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
                   ` (3 preceding siblings ...)
  2019-07-22  2:12 ` [lustre-devel] [PATCH 04/10] lustre: mgc: remove llog_process_lock James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 06/10] lnet: socklnd: fix infinite loop in ksocknal_push() James Simmons
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

'extern' declarations should only appear in .h files.
All these names are declared in .h files as needed,
and these duplicate declarations in .c files can
be removed.

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-4423
Reviewed-on: https://review.whamcloud.com/35294
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ldlm/ldlm_resource.c   | 2 --
 fs/lustre/ptlrpc/import.c        | 1 -
 fs/lustre/ptlrpc/ptlrpc_module.c | 5 -----
 3 files changed, 8 deletions(-)

diff --git a/fs/lustre/ldlm/ldlm_resource.c b/fs/lustre/ldlm/ldlm_resource.c
index 45b2e97..372a290 100644
--- a/fs/lustre/ldlm/ldlm_resource.c
+++ b/fs/lustre/ldlm/ldlm_resource.c
@@ -681,8 +681,6 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
 }
 EXPORT_SYMBOL(ldlm_namespace_new);
 
-extern struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock);
-
 /**
  * Cancel and destroy all locks on a resource.
  *
diff --git a/fs/lustre/ptlrpc/import.c b/fs/lustre/ptlrpc/import.c
index d49707a..67a66a5 100644
--- a/fs/lustre/ptlrpc/import.c
+++ b/fs/lustre/ptlrpc/import.c
@@ -1572,7 +1572,6 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose)
 EXPORT_SYMBOL(ptlrpc_disconnect_import);
 
 /* Adaptive Timeout utils */
-extern unsigned int at_min, at_max, at_history;
 
 /*
  *Update at_current with the specified value (bounded by at_min and at_max),
diff --git a/fs/lustre/ptlrpc/ptlrpc_module.c b/fs/lustre/ptlrpc/ptlrpc_module.c
index f73ba41..6888df9 100644
--- a/fs/lustre/ptlrpc/ptlrpc_module.c
+++ b/fs/lustre/ptlrpc/ptlrpc_module.c
@@ -40,11 +40,6 @@
 
 #include "ptlrpc_internal.h"
 
-extern spinlock_t ptlrpc_last_xid_lock;
-#if RS_DEBUG
-extern spinlock_t ptlrpc_rs_debug_lock;
-#endif
-
 DEFINE_MUTEX(ptlrpc_startup);
 static int ptlrpc_active;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 06/10] lnet: socklnd: fix infinite loop in ksocknal_push()
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
                   ` (4 preceding siblings ...)
  2019-07-22  2:12 ` [lustre-devel] [PATCH 05/10] lustre: don't declare extern variables in C files James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 07/10] lustre: ptlrpc: remove inline on non-inlined functions James Simmons
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

If the list_for_each_entry() loop in ksocknal_push()
ever finds a match, then it will increment 'i', and the outer
loop will continue.

Once peer_off becomes larger than the number of matches
in a given chain, 'peer_ni' will be an invalid pointer, and
ksocknal_push_peer() will probably crash when called on it.

To abort the outer loop properly, we need to test if
"i <= peer_off", which indicates that all patching peers
have been found.

This bug can easily be reproduced by running
  lctl --net tcp push

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-12101
Reviewed-on: https://review.whamcloud.com/34499
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Sonia Sharma <sharmaso@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/klnds/socklnd/socklnd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/lnet/klnds/socklnd/socklnd.c b/net/lnet/klnds/socklnd/socklnd.c
index 08feaf7..a422481 100644
--- a/net/lnet/klnds/socklnd/socklnd.c
+++ b/net/lnet/klnds/socklnd/socklnd.c
@@ -1952,7 +1952,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id)
 			}
 			read_unlock(&ksocknal_data.ksnd_global_lock);
 
-			if (!i) /* no match */
+			if (i <= peer_off) /* no match */
 				break;
 
 			rc = 0;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 07/10] lustre: ptlrpc: remove inline on non-inlined functions.
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
                   ` (5 preceding siblings ...)
  2019-07-22  2:12 ` [lustre-devel] [PATCH 06/10] lnet: socklnd: fix infinite loop in ksocknal_push() James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 08/10] lustre: convert rsi_sem to a spinlock James Simmons
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

These three functions are never inlined.  The only time they
are used, their address is taken, and this forces them to
be compiled as stand-alone functions.  So having the "inline"
declaration is misleading.

Move the functions to the place where their address is used, and
remove the 'inline' tag.

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-4423
Reviewed-on: https://review.whamcloud.com/35296
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_net.h | 21 ---------------------
 fs/lustre/ptlrpc/client.c      | 22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/fs/lustre/include/lustre_net.h b/fs/lustre/include/lustre_net.h
index 83f8aff..f7bd8ad 100644
--- a/fs/lustre/include/lustre_net.h
+++ b/fs/lustre/include/lustre_net.h
@@ -1872,30 +1872,9 @@ int ptlrpc_prep_bulk_frag(struct ptlrpc_bulk_desc *desc,
 void __ptlrpc_prep_bulk_page(struct ptlrpc_bulk_desc *desc,
 			     struct page *page, int pageoffset, int len,
 			     int pin);
-static inline void ptlrpc_prep_bulk_page_pin(struct ptlrpc_bulk_desc *desc,
-					     struct page *page, int pageoffset,
-					     int len)
-{
-	__ptlrpc_prep_bulk_page(desc, page, pageoffset, len, 1);
-}
-
-static inline void ptlrpc_prep_bulk_page_nopin(struct ptlrpc_bulk_desc *desc,
-					       struct page *page, int pageoffset,
-					       int len)
-{
-	__ptlrpc_prep_bulk_page(desc, page, pageoffset, len, 0);
-}
 
 void ptlrpc_free_bulk(struct ptlrpc_bulk_desc *bulk);
 
-static inline void ptlrpc_release_bulk_page_pin(struct ptlrpc_bulk_desc *desc)
-{
-	int i;
-
-	for (i = 0; i < desc->bd_iov_count ; i++)
-		put_page(BD_GET_KIOV(desc, i).bv_page);
-}
-
 void ptlrpc_retain_replayable_request(struct ptlrpc_request *req,
 				      struct obd_import *imp);
 u64 ptlrpc_next_xid(void);
diff --git a/fs/lustre/ptlrpc/client.c b/fs/lustre/ptlrpc/client.c
index ff1fa68..5f3dc3f 100644
--- a/fs/lustre/ptlrpc/client.c
+++ b/fs/lustre/ptlrpc/client.c
@@ -48,6 +48,28 @@
 
 #include "ptlrpc_internal.h"
 
+static void ptlrpc_prep_bulk_page_pin(struct ptlrpc_bulk_desc *desc,
+				      struct page *page, int pageoffset,
+				      int len)
+{
+	__ptlrpc_prep_bulk_page(desc, page, pageoffset, len, 1);
+}
+
+static void ptlrpc_prep_bulk_page_nopin(struct ptlrpc_bulk_desc *desc,
+					struct page *page, int pageoffset,
+					int len)
+{
+	__ptlrpc_prep_bulk_page(desc, page, pageoffset, len, 0);
+}
+
+static void ptlrpc_release_bulk_page_pin(struct ptlrpc_bulk_desc *desc)
+{
+	int i;
+
+	for (i = 0; i < desc->bd_iov_count ; i++)
+		put_page(BD_GET_KIOV(desc, i).bv_page);
+}
+
 const struct ptlrpc_bulk_frag_ops ptlrpc_bulk_kiov_pin_ops = {
 	.add_kiov_frag		= ptlrpc_prep_bulk_page_pin,
 	.release_frags		= ptlrpc_release_bulk_page_pin,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 08/10] lustre: convert rsi_sem to a spinlock.
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
                   ` (6 preceding siblings ...)
  2019-07-22  2:12 ` [lustre-devel] [PATCH 07/10] lustre: ptlrpc: remove inline on non-inlined functions James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 09/10] lustre: ptlrpc: make ptlrpc_last_xid an atomic64_t James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 10/10] lustre: ptlrpc: simplify struct ptlrpc_request_set James Simmons
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

This lock is never held over code that sleeps, and is
only ever held for short periods of time.
So a simple spinlock is best.

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-4423
Reviewed-on: https://review.whamcloud.com/35279
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/obd_class.h       | 3 +--
 fs/lustre/llite/llite_lib.c         | 6 +++---
 fs/lustre/llite/lproc_llite.c       | 4 ++--
 fs/lustre/obdclass/lprocfs_status.c | 8 ++++----
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/fs/lustre/include/obd_class.h b/fs/lustre/include/obd_class.h
index 34a8511..2f02efe 100644
--- a/fs/lustre/include/obd_class.h
+++ b/fs/lustre/include/obd_class.h
@@ -1689,12 +1689,11 @@ static inline void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out)
 void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs);
 
 /* root squash info */
-struct rw_semaphore;
 struct root_squash_info {
 	uid_t			rsi_uid;
 	gid_t			rsi_gid;
 	struct list_head	rsi_nosquash_nids;
-	struct rw_semaphore	rsi_sem;
+	spinlock_t		rsi_lock;	/* protects rsi_nosquash_nids */
 };
 
 /* linux-module.c */
diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index 4e09f0f..b933f37 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -131,7 +131,7 @@ static struct ll_sb_info *ll_init_sbi(void)
 	sbi->ll_squash.rsi_uid = 0;
 	sbi->ll_squash.rsi_gid = 0;
 	INIT_LIST_HEAD(&sbi->ll_squash.rsi_nosquash_nids);
-	init_rwsem(&sbi->ll_squash.rsi_sem);
+	spin_lock_init(&sbi->ll_squash.rsi_lock);
 
 	return sbi;
 }
@@ -2578,7 +2578,7 @@ void ll_compute_rootsquash_state(struct ll_sb_info *sbi)
 	int i;
 
 	/* Update norootsquash flag */
-	down_write(&squash->rsi_sem);
+	spin_lock(&squash->rsi_lock);
 	if (list_empty(&squash->rsi_nosquash_nids)) {
 		spin_lock(&sbi->ll_lock);
 		sbi->ll_flags &= ~LL_SBI_NOROOTSQUASH;
@@ -2606,7 +2606,7 @@ void ll_compute_rootsquash_state(struct ll_sb_info *sbi)
 			sbi->ll_flags &= ~LL_SBI_NOROOTSQUASH;
 		spin_unlock(&sbi->ll_lock);
 	}
-	up_write(&squash->rsi_sem);
+	spin_unlock(&squash->rsi_lock);
 }
 
 /**
diff --git a/fs/lustre/llite/lproc_llite.c b/fs/lustre/llite/lproc_llite.c
index 99e8a82..69f4f25 100644
--- a/fs/lustre/llite/lproc_llite.c
+++ b/fs/lustre/llite/lproc_llite.c
@@ -1157,7 +1157,7 @@ static int ll_nosquash_nids_seq_show(struct seq_file *m, void *v)
 	struct root_squash_info *squash = &sbi->ll_squash;
 	int len;
 
-	down_read(&squash->rsi_sem);
+	spin_lock(&squash->rsi_lock);
 	if (!list_empty(&squash->rsi_nosquash_nids)) {
 		len = cfs_print_nidlist(m->buf + m->count, m->size - m->count,
 					&squash->rsi_nosquash_nids);
@@ -1166,7 +1166,7 @@ static int ll_nosquash_nids_seq_show(struct seq_file *m, void *v)
 	} else {
 		seq_puts(m, "NONE\n");
 	}
-	up_read(&squash->rsi_sem);
+	spin_unlock(&squash->rsi_lock);
 
 	return 0;
 }
diff --git a/fs/lustre/obdclass/lprocfs_status.c b/fs/lustre/obdclass/lprocfs_status.c
index 2b4302e..01b8f90 100644
--- a/fs/lustre/obdclass/lprocfs_status.c
+++ b/fs/lustre/obdclass/lprocfs_status.c
@@ -1747,10 +1747,10 @@ int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
 	if ((len == 4 && !strncmp(kernbuf, "NONE", len)) ||
 	    (len == 5 && !strncmp(kernbuf, "clear", len))) {
 		/* empty string is special case */
-		down_write(&squash->rsi_sem);
+		spin_lock(&squash->rsi_lock);
 		if (!list_empty(&squash->rsi_nosquash_nids))
 			cfs_free_nidlist(&squash->rsi_nosquash_nids);
-		up_write(&squash->rsi_sem);
+		spin_unlock(&squash->rsi_lock);
 		LCONSOLE_INFO("%s: nosquash_nids is cleared\n", name);
 		kfree(kernbuf);
 		return count;
@@ -1767,11 +1767,11 @@ int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
 	kfree(kernbuf);
 	kernbuf = NULL;
 
-	down_write(&squash->rsi_sem);
+	spin_lock(&squash->rsi_lock);
 	if (!list_empty(&squash->rsi_nosquash_nids))
 		cfs_free_nidlist(&squash->rsi_nosquash_nids);
 	list_splice(&tmp, &squash->rsi_nosquash_nids);
-	up_write(&squash->rsi_sem);
+	spin_unlock(&squash->rsi_lock);
 
 	return count;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 09/10] lustre: ptlrpc: make ptlrpc_last_xid an atomic64_t
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
                   ` (7 preceding siblings ...)
  2019-07-22  2:12 ` [lustre-devel] [PATCH 08/10] lustre: convert rsi_sem to a spinlock James Simmons
@ 2019-07-22  2:12 ` James Simmons
  2019-07-22  2:12 ` [lustre-devel] [PATCH 10/10] lustre: ptlrpc: simplify struct ptlrpc_request_set James Simmons
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: NeilBrown <neilb@suse.com>

This variable is treated like an atomic64_t,
so change it's type and simplify the code.

Signed-off-by: NeilBrown <neilb@suse.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-4423
Reviewed-on: https://review.whamcloud.com/35510
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/client.c | 39 ++++++++++-----------------------------
 1 file changed, 10 insertions(+), 29 deletions(-)

diff --git a/fs/lustre/ptlrpc/client.c b/fs/lustre/ptlrpc/client.c
index 5f3dc3f..5c0a3ec 100644
--- a/fs/lustre/ptlrpc/client.c
+++ b/fs/lustre/ptlrpc/client.c
@@ -3062,8 +3062,7 @@ void ptlrpc_abort_set(struct ptlrpc_request_set *set)
 	}
 }
 
-static u64 ptlrpc_last_xid;
-static spinlock_t ptlrpc_last_xid_lock;
+static atomic64_t ptlrpc_last_xid;
 
 /**
  * Initialize the XID for the node.  This is common among all requests on
@@ -3084,19 +3083,20 @@ void ptlrpc_abort_set(struct ptlrpc_request_set *set)
 void ptlrpc_init_xid(void)
 {
 	time64_t now = ktime_get_real_seconds();
+	u64 xid;
 
-	spin_lock_init(&ptlrpc_last_xid_lock);
 	if (now < YEAR_2004) {
-		get_random_bytes(&ptlrpc_last_xid, sizeof(ptlrpc_last_xid));
-		ptlrpc_last_xid >>= 2;
-		ptlrpc_last_xid |= (1ULL << 61);
+		get_random_bytes(&xid, sizeof(xid));
+		xid >>= 2;
+		xid |= (1ULL << 61);
 	} else {
-		ptlrpc_last_xid = (u64)now << 20;
+		xid = (u64)now << 20;
 	}
 
 	/* Always need to be aligned to a power-of-two for multi-bulk BRW */
 	BUILD_BUG_ON(((PTLRPC_BULK_OPS_COUNT - 1) & PTLRPC_BULK_OPS_COUNT) != 0);
-	ptlrpc_last_xid &= PTLRPC_BULK_OPS_MASK;
+	xid &= PTLRPC_BULK_OPS_MASK;
+	atomic64_set(&ptlrpc_last_xid, xid);
 }
 
 /**
@@ -3113,14 +3113,7 @@ void ptlrpc_init_xid(void)
  */
 u64 ptlrpc_next_xid(void)
 {
-	u64 next;
-
-	spin_lock(&ptlrpc_last_xid_lock);
-	next = ptlrpc_last_xid + PTLRPC_BULK_OPS_COUNT;
-	ptlrpc_last_xid = next;
-	spin_unlock(&ptlrpc_last_xid_lock);
-
-	return next;
+	return atomic64_add_return(PTLRPC_BULK_OPS_COUNT, &ptlrpc_last_xid);
 }
 
 /**
@@ -3195,19 +3188,7 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
  */
 u64 ptlrpc_sample_next_xid(void)
 {
-#if BITS_PER_LONG == 32
-	/* need to avoid possible word tearing on 32-bit systems */
-	u64 next;
-
-	spin_lock(&ptlrpc_last_xid_lock);
-	next = ptlrpc_last_xid + PTLRPC_BULK_OPS_COUNT;
-	spin_unlock(&ptlrpc_last_xid_lock);
-
-	return next;
-#else
-	/* No need to lock, since returned value is racy anyways */
-	return ptlrpc_last_xid + PTLRPC_BULK_OPS_COUNT;
-#endif
+	return atomic64_read(&ptlrpc_last_xid) + PTLRPC_BULK_OPS_COUNT;
 }
 EXPORT_SYMBOL(ptlrpc_sample_next_xid);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [lustre-devel] [PATCH 10/10] lustre: ptlrpc: simplify struct ptlrpc_request_set
  2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
                   ` (8 preceding siblings ...)
  2019-07-22  2:12 ` [lustre-devel] [PATCH 09/10] lustre: ptlrpc: make ptlrpc_last_xid an atomic64_t James Simmons
@ 2019-07-22  2:12 ` James Simmons
  9 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2019-07-22  2:12 UTC (permalink / raw)
  To: lustre-devel

From: "John L. Hammond" <jhammond@whamcloud.com>

Remove obd_statfs_rqset(), replacing its only use with
obd_statfs(). Collapse lov_statfs_async() and lov_statfs() into a
single function, removing the need for lov_statfs_interpret().

Remove the then unused set_wakeup_ptr, set_cblist, set_interpret, and
set_arg members of struct ptlrpc_request_set. Remove struct
ptlrpc_set_cbdata and ptlrpc_set_add_cb(). On x86_64 this reduces the
size of struct ptlrpc_request_set from 152 bytes to 112.

Signed-off-by: John L. Hammond <jhammond@whamcloud.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-10227
Reviewed-on: https://review.whamcloud.com/30060
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_net.h | 24 ------------
 fs/lustre/include/obd_class.h  | 22 -----------
 fs/lustre/llite/llite_lib.c    |  2 +-
 fs/lustre/lov/lov_obd.c        | 85 ++++++++++++++----------------------------
 fs/lustre/ptlrpc/client.c      | 19 ----------
 5 files changed, 28 insertions(+), 124 deletions(-)

diff --git a/fs/lustre/include/lustre_net.h b/fs/lustre/include/lustre_net.h
index f7bd8ad..fde59df 100644
--- a/fs/lustre/include/lustre_net.h
+++ b/fs/lustre/include/lustre_net.h
@@ -331,7 +331,6 @@ struct ptlrpc_client {
 };
 
 struct ptlrpc_request_set;
-typedef int (*set_interpreter_func)(struct ptlrpc_request_set *, void *, int);
 typedef int (*set_producer_func)(struct ptlrpc_request_set *, void *);
 
 /**
@@ -353,20 +352,9 @@ struct ptlrpc_request_set {
 	atomic_t		set_remaining;
 	/** wait queue to wait on for request events */
 	wait_queue_head_t	set_waitq;
-	wait_queue_head_t	*set_wakeup_ptr;
 	/** List of requests in the set */
 	struct list_head	set_requests;
 	/**
-	 * List of completion callbacks to be called when the set is completed
-	 * This is only used if @set_interpret is NULL.
-	 * Links struct ptlrpc_set_cbdata.
-	 */
-	struct list_head	set_cblist;
-	/** Completion callback, if only one. */
-	set_interpreter_func	set_interpret;
-	/** opaq argument passed to completion @set_interpret callback. */
-	void			*set_arg;
-	/**
 	 * Lock for @set_new_requests manipulations
 	 * locked so that any old caller can communicate requests to
 	 * the set holder who can then fold them into the lock-free set
@@ -386,18 +374,6 @@ struct ptlrpc_request_set {
 	void			*set_producer_arg;
 };
 
-/**
- * Description of a single ptrlrpc_set callback
- */
-struct ptlrpc_set_cbdata {
-	/** List linkage item */
-	struct list_head	psc_item;
-	/** Pointer to interpreting function */
-	set_interpreter_func    psc_interpret;
-	/** Opaq argument to pass to the callback */
-	void			*psc_data;
-};
-
 struct ptlrpc_bulk_desc;
 struct ptlrpc_service_part;
 struct ptlrpc_service;
diff --git a/fs/lustre/include/obd_class.h b/fs/lustre/include/obd_class.h
index 2f02efe..f26ca17 100644
--- a/fs/lustre/include/obd_class.h
+++ b/fs/lustre/include/obd_class.h
@@ -909,28 +909,6 @@ static inline int obd_statfs_async(struct obd_export *exp,
 	return rc;
 }
 
-static inline int obd_statfs_rqset(struct obd_export *exp,
-				   struct obd_statfs *osfs, u64 max_age,
-				   u32 flags)
-{
-	struct ptlrpc_request_set *set = NULL;
-	struct obd_info oinfo = {
-		.oi_osfs = osfs,
-		.oi_flags = flags,
-	};
-	int rc = 0;
-
-	set = ptlrpc_prep_set();
-	if (!set)
-		return -ENOMEM;
-
-	rc = obd_statfs_async(exp, &oinfo, max_age, set);
-	if (rc == 0)
-		rc = ptlrpc_set_wait(set);
-	ptlrpc_set_destroy(set);
-	return rc;
-}
-
 /*
  * @max_age is the oldest time in jiffies that we accept using a cached data.
  * If the cache is older than @max_age we will get a new value from the
diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index b933f37..83b63d8 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -1710,7 +1710,7 @@ int ll_statfs_internal(struct ll_sb_info *sbi, struct obd_statfs *osfs,
 	if (sbi->ll_flags & LL_SBI_LAZYSTATFS)
 		flags |= OBD_STATFS_NODELAY;
 
-	rc = obd_statfs_rqset(sbi->ll_dt_exp, &obd_osfs, max_age, flags);
+	rc = obd_statfs(NULL, sbi->ll_dt_exp, &obd_osfs, max_age, flags);
 	if (rc) {
 		CERROR("obd_statfs fails: rc = %d\n", rc);
 		return rc;
diff --git a/fs/lustre/lov/lov_obd.c b/fs/lustre/lov/lov_obd.c
index 1d96f28..5dbc00e 100644
--- a/fs/lustre/lov/lov_obd.c
+++ b/fs/lustre/lov/lov_obd.c
@@ -911,78 +911,48 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg,
 	return rc;
 }
 
-static int
-lov_statfs_interpret(struct ptlrpc_request_set *rqset, void *data, int rc)
-{
-	struct lov_request_set *lovset = (struct lov_request_set *)data;
-	int err;
-
-	if (rc)
-		atomic_set(&lovset->set_completes, 0);
-
-	err = lov_fini_statfs_set(lovset);
-	return rc ? rc : err;
-}
-
-static int lov_statfs_async(struct obd_export *exp, struct obd_info *oinfo,
-			    u64 max_age, struct ptlrpc_request_set *rqset)
+static int lov_statfs(const struct lu_env *env, struct obd_export *exp,
+		      struct obd_statfs *osfs, u64 max_age, u32 flags)
 {
 	struct obd_device *obd = class_exp2obd(exp);
-	struct lov_request_set *set;
+	struct lov_obd *lov = &obd->u.lov;
+	struct ptlrpc_request_set *rqset;
+	struct obd_info oinfo = {
+		.oi_osfs = osfs,
+		.oi_flags = flags,
+	};
+	struct lov_request_set *set = NULL;
 	struct lov_request *req;
-	struct lov_obd *lov;
 	int rc = 0;
+	int rc2;
 
-	LASSERT(oinfo->oi_osfs);
+	rqset = ptlrpc_prep_set();
+	if (!rqset)
+		return -ENOMEM;
 
-	lov = &obd->u.lov;
-	rc = lov_prep_statfs_set(obd, oinfo, &set);
-	if (rc)
-		return rc;
+	rc = lov_prep_statfs_set(obd, &oinfo, &set);
+	if (rc < 0)
+		goto out_rqset;
 
 	list_for_each_entry(req, &set->set_list, rq_link) {
 		rc = obd_statfs_async(lov->lov_tgts[req->rq_idx]->ltd_exp,
 				      &req->rq_oi, max_age, rqset);
-		if (rc)
-			break;
-	}
-
-	if (rc || list_empty(&rqset->set_requests)) {
-		int err;
-
-		if (rc)
-			atomic_set(&set->set_completes, 0);
-		err = lov_fini_statfs_set(set);
-		return rc ? rc : err;
+		if (rc < 0)
+			goto out_set;
 	}
 
-	LASSERT(!rqset->set_interpret);
-	rqset->set_interpret = lov_statfs_interpret;
-	rqset->set_arg = (void *)set;
-	return 0;
-}
+	rc = ptlrpc_set_wait(rqset);
 
-static int lov_statfs(const struct lu_env *env, struct obd_export *exp,
-		      struct obd_statfs *osfs, u64 max_age, u32 flags)
-{
-	struct ptlrpc_request_set *set = NULL;
-	struct obd_info oinfo = {
-		.oi_osfs = osfs,
-		.oi_flags = flags,
-	};
-	int rc = 0;
+out_set:
+	if (rc < 0)
+		atomic_set(&set->set_completes, 0);
 
-	/* for obdclass we forbid using obd_statfs_rqset, but prefer using async
-	 * statfs requests
-	 */
-	set = ptlrpc_prep_set();
-	if (!set)
-		return -ENOMEM;
-
-	rc = lov_statfs_async(exp, &oinfo, max_age, set);
+	rc2 = lov_fini_statfs_set(set);
 	if (rc == 0)
-		rc = ptlrpc_set_wait(set);
-	ptlrpc_set_destroy(set);
+		rc = rc2;
+
+out_rqset:
+	ptlrpc_set_destroy(rqset);
 
 	return rc;
 }
@@ -1341,7 +1311,6 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp,
 	.connect	= lov_connect,
 	.disconnect	= lov_disconnect,
 	.statfs		= lov_statfs,
-	.statfs_async	= lov_statfs_async,
 	.iocontrol	= lov_iocontrol,
 	.get_info	= lov_get_info,
 	.set_info_async	= lov_set_info_async,
diff --git a/fs/lustre/ptlrpc/client.c b/fs/lustre/ptlrpc/client.c
index 5c0a3ec..f7f3678 100644
--- a/fs/lustre/ptlrpc/client.c
+++ b/fs/lustre/ptlrpc/client.c
@@ -980,7 +980,6 @@ struct ptlrpc_request_set *ptlrpc_prep_set(void)
 	atomic_set(&set->set_remaining, 0);
 	spin_lock_init(&set->set_new_req_lock);
 	INIT_LIST_HEAD(&set->set_new_requests);
-	INIT_LIST_HEAD(&set->set_cblist);
 	set->set_max_inflight = UINT_MAX;
 	set->set_producer = NULL;
 	set->set_producer_arg = NULL;
@@ -2353,24 +2352,6 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set)
 			rc = req->rq_status;
 	}
 
-	if (set->set_interpret) {
-		int (*interpreter)(struct ptlrpc_request_set *set, void *, int) =
-			set->set_interpret;
-		rc = interpreter(set, set->set_arg, rc);
-	} else {
-		struct ptlrpc_set_cbdata *cbdata, *n;
-		int err;
-
-		list_for_each_entry_safe(cbdata, n,
-					 &set->set_cblist, psc_item) {
-			list_del_init(&cbdata->psc_item);
-			err = cbdata->psc_interpret(set, cbdata->psc_data, rc);
-			if (err && !rc)
-				rc = err;
-			kfree(cbdata);
-		}
-	}
-
 	return rc;
 }
 EXPORT_SYMBOL(ptlrpc_set_wait);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-07-22  2:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-22  2:12 [lustre-devel] [PATCH 00/10] lustre: push patches ready from lustre-testing James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 01/10] lustre: ldlm: discard varname in ldlm_pool James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 02/10] lustre: lprocfs: use log2.h macros instead of shift loop James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 03/10] lustre: ptlrpc: make ptlrpc_bulk_frag_ops always const James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 04/10] lustre: mgc: remove llog_process_lock James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 05/10] lustre: don't declare extern variables in C files James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 06/10] lnet: socklnd: fix infinite loop in ksocknal_push() James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 07/10] lustre: ptlrpc: remove inline on non-inlined functions James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 08/10] lustre: convert rsi_sem to a spinlock James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 09/10] lustre: ptlrpc: make ptlrpc_last_xid an atomic64_t James Simmons
2019-07-22  2:12 ` [lustre-devel] [PATCH 10/10] lustre: ptlrpc: simplify struct ptlrpc_request_set James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).