[lustre-devel] [PATCH 09/27] lustre: readahead: clip readahead with kms
James Simmons <[email protected]> Mon, 17 Apr 2023 09:47:05 -0400
| Newsgroups | org.lustre.lists.lustre-devel |
|---|---|
| Message-ID | <[email protected]> |
From: Qian Yingjin <[email protected]> During I/O test, it found that the read-ahead pages reach 255 for small files with only several KiB. The amount of read data reaches more than 1MiB. The reason is that the granted DLM extent lock is [0, EOF], which is larger than the requested extent. During readahead, the OSC layer will also return [0, EOF] extent which will clip into stripe size (1MiB) regardless the actual object size. In this patch, the readahead range is clipped to the known min size (kms) on OSC layer during readahead. By this way, the read-ahead data will not beyong the last page of the file. This patch also fixes multiop to return successfully when reaching EOF instead of exiting with ENODATA during read. WC-bug-id: https://jira.whamcloud.com/browse/LU-16338 Lustre-commit: b33808d3aebb06cf0 ("LU-16338 readahead: clip readahead with kms") Signed-off-by: Qian Yingjin <[email protected]> Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49226 Reviewed-by: Andreas Dilger <[email protected]> Reviewed-by: Patrick Farrell <[email protected]> Reviewed-by: Oleg Drokin <[email protected]> Signed-off-by: James Simmons <[email protected]> --- fs/lustre/osc/osc_io.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/lustre/osc/osc_io.c b/fs/lustre/osc/osc_io.c index c9a3175..d0ee748 100644 --- a/fs/lustre/osc/osc_io.c +++ b/fs/lustre/osc/osc_io.c @@ -83,6 +83,8 @@ static int osc_io_read_ahead(const struct lu_env *env, oio->oi_is_readahead = true; dlmlock = osc_dlmlock_at_pgoff(env, osc, start, 0); if (dlmlock) { + struct lov_oinfo *oinfo = osc->oo_oinfo; + LASSERT(dlmlock->l_ast_data == osc); if (dlmlock->l_req_mode != LCK_PR) { struct lustre_handle lockh; @@ -100,6 +102,9 @@ static int osc_io_read_ahead(const struct lu_env *env, ra->cra_oio = oio; if (ra->cra_end_idx != CL_PAGE_EOF) ra->cra_contention = true; + ra->cra_end_idx = min_t(pgoff_t, ra->cra_end_idx, + cl_index(osc2cl(osc), + oinfo->loi_kms - 1)); result = 0; } -- 1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org