Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1697299

[PATCH 01/20] staging: lustre: osc: soft lock - osc_makes_rpc()

From James Simmons <jsimmons@infradead.org>
Newsgroups linux.kernel
Subject [PATCH 01/20] staging: lustre: osc: soft lock - osc_makes_rpc()
Date 2017-07-26 17:30 +0200
Message-ID <u7wq7-23J-55@gated-at.bofh.it> (permalink)
References <u7wq5-23J-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Bobi Jam <bobijam.xu@intel.com>

It is possible that an osc_extent contains more than 256 chunks, and
the IO engine won't add this extent in one RPC
(try_to_add_extent_for_io) so that osc_check_rpcs() run into a loop
upon this extent and never break.

This patch changes osc_max_write_chunks() to make sure the value
can cover all possible osc_extent, so that all osc_extent will be
added into one RPC.

This patch also add another field erd_max_extents in extent_rpc_data
to make sure not to add too many fragments in a single RPC.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8680
Reviewed-on: http://review.whamcloud.com/23326
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/osc/osc_cache.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index d8a95f8..0100d27 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -1887,6 +1887,7 @@ struct extent_rpc_data {
 	unsigned int		erd_page_count;
 	unsigned int		erd_max_pages;
 	unsigned int		erd_max_chunks;
+	unsigned int		erd_max_extents;
 };
 
 static inline unsigned int osc_extent_chunks(const struct osc_extent *ext)
@@ -1915,11 +1916,23 @@ 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);
 
+	if (!data->erd_max_extents)
+		return 0;
+
 	chunk_count = osc_extent_chunks(ext);
+	EASSERTF(data->erd_page_count != 0 ||
+		 chunk_count <= data->erd_max_chunks, ext,
+		 "The first extent to be fit in a RPC contains %u chunks, which is over the limit %u.\n",
+		 chunk_count, data->erd_max_chunks);
+
 	if (chunk_count > data->erd_max_chunks)
 		return 0;
 
 	data->erd_max_pages = max(ext->oe_mppr, data->erd_max_pages);
+	EASSERTF(data->erd_page_count != 0 ||
+		 ext->oe_nr_pages <= data->erd_max_pages, ext,
+		 "The first extent to be fit in a RPC contains %u pages, which is over the limit %u.\n",
+		 ext->oe_nr_pages, data->erd_max_pages);
 	if (data->erd_page_count + ext->oe_nr_pages > data->erd_max_pages)
 		return 0;
 
@@ -1943,6 +1956,7 @@ static int try_to_add_extent_for_io(struct client_obd *cli,
 		break;
 	}
 
+	data->erd_max_extents--;
 	data->erd_max_chunks -= chunk_count;
 	data->erd_page_count += ext->oe_nr_pages;
 	list_move_tail(&ext->oe_link, data->erd_rpc_list);
@@ -1972,10 +1986,12 @@ static inline unsigned int osc_max_write_chunks(const struct client_obd *cli)
 	 *
 	 * 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.
+	 * to have too many discontiguous pages in one RPC.
+	 *
+	 * An osc_extent won't cover over a RPC size, so the chunks in an
+	 * osc_extent won't bigger than PTLRPC_MAX_BRW_SIZE >> chunkbits.
 	 */
-	return min(PTLRPC_MAX_BRW_SIZE >> cli->cl_chunkbits, 256);
+	return PTLRPC_MAX_BRW_SIZE >> cli->cl_chunkbits;
 }
 
 /**
@@ -2002,6 +2018,7 @@ static unsigned int get_write_extents(struct osc_object *obj,
 		.erd_page_count = 0,
 		.erd_max_pages = cli->cl_max_pages_per_rpc,
 		.erd_max_chunks = osc_max_write_chunks(cli),
+		.erd_max_extents = 256,
 	};
 
 	LASSERT(osc_object_is_locked(obj));
@@ -2140,6 +2157,7 @@ static unsigned int get_write_extents(struct osc_object *obj,
 		.erd_page_count = 0,
 		.erd_max_pages = cli->cl_max_pages_per_rpc,
 		.erd_max_chunks = UINT_MAX,
+		.erd_max_extents = UINT_MAX,
 	};
 	int rc = 0;
 
-- 
1.8.3.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/20] staging: lustre: batch of fixes to decrease test failures James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 17/20] staging: lustre: llite: allow cached acls James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 04/20] staging: lustre: lov: fix 'control flow' error in lov_io_init_released James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 13/20] staging: lustre: ptlrpc: restore 64-bit time for struct ptlrpc_cli_req James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 06/20] staging: lustre: lmv: assume a real connection in lmv_connect() James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 07/20] staging: lustre: lov: Ensure correct operation for large object sizes James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 11/20] staging: lustre: lustre: fix all less than 0 comparison for unsigned values James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 03/20] staging: lustre: ldlm: crash on umount in cleanup_resource James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 10/20] staging: lustre: ldlm: restore interval_iterate_reverse function James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 14/20] staging: lustre: ptlrpc: don't use CFS_DURATION_T for time64_t James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 08/20] staging: lustre: ptlrpc: correct use of list_add_tail() James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 01/20] staging: lustre: osc: soft lock - osc_makes_rpc() James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 19/20] staging: lustre: llite: add xattr.h header to xattr.c James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 16/20] staging: lustre: libcfs: fix test for libcfs_ioctl_hdr minimum size James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 05/20] staging: lustre: lov: remove unused code James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 20/20] staging: lustre: llite: set security xattr using __vfs_setxattr James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 12/20] staging: lustre: linkea: linkEA size limitation James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 02/20] staging: lustre: ldlm: restore missing newlines in ldlm sysfs files James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200
  [PATCH 09/20] staging: lustre: ptlrpc: no need to reassign mbits for replay James Simmons <jsimmons@infradead.org> - 2017-07-26 17:30 +0200

csiph-web