Commit db238504 authored by Bobi Jam's avatar Bobi Jam Committed by Greg Kroah-Hartman

staging: lustre: osc: soft lock - osc_makes_rpc()

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: default avatarBobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8680
Reviewed-on: http://review.whamcloud.com/23326Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: default avatarNiu Yawei <yawei.niu@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cc9af01e
......@@ -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 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli,
.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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment