[lustre-devel] [PATCH 02/50] lustre: osc: Fix grant test for ARM
James Simmons
jsimmons at infradead.org
Sun Mar 20 06:30:16 PDT 2022
If both OST and OSC support OBD_CONNECT_GRANT_PARAM, OST side will not
change client side claimed grant (a.k.a. o_grant_used) regardless of
the client page size. So no grant loss in this case.
Fixes: 4d8c38a8a882 ("lustre: grant: add support for OBD_CONNECT_GRANT_PARAM")
WC-bug-id: https://jira.whamcloud.com/browse/LU-11596
Lustre-commit: 7d3edce0650f0b66b ("LU-11596 osc: Fix and re-enable sanity grant test for ARM")
Signed-off-by: James Simmons <jsimmons at infradead.org>
Signed-off-by: Jian Yu <yujian at whamcloud.com>
Signed-off-by: Xinliang Liu <xinliang.liu at linaro.org>
Reviewed-on: https://review.whamcloud.com/40758
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
---
fs/lustre/osc/osc_cache.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/fs/lustre/osc/osc_cache.c b/fs/lustre/osc/osc_cache.c
index 7b7b49f..7bd28c5 100644
--- a/fs/lustre/osc/osc_cache.c
+++ b/fs/lustre/osc/osc_cache.c
@@ -905,11 +905,13 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext,
if (!sent) {
lost_grant = ext->oe_grants;
- } else if (blocksize < PAGE_SIZE &&
+ } else if (cli->cl_ocd_grant_param == 0 &&
+ blocksize < PAGE_SIZE &&
last_count != PAGE_SIZE) {
- /* For short writes we shouldn't count parts of pages that
- * span a whole chunk on the OST side, or our accounting goes
- * wrong. Should match the code in filter_grant_check.
+ /* For short writes without OBD_CONNECT_GRANT support, we
+ * shouldn't count parts of pages that span a whole chunk on
+ * the OST side, or our accounting goes wrong. Should match
+ * the code in tgt_grant_check.
*/
int offset = last_off & ~PAGE_MASK;
int count = last_count + (offset & (blocksize - 1));
@@ -1505,11 +1507,11 @@ static void osc_unreserve_grant(struct client_obd *cli,
* used, we should return these grants to OST. There're two cases where grants
* can be lost:
* 1. truncate;
- * 2. blocksize at OST is less than PAGE_SIZE and a partial page was
- * written. In this case OST may use less chunks to serve this partial
- * write. OSTs don't actually know the page size on the client side. so
- * clients have to calculate lost grant by the blocksize on the OST.
- * See filter_grant_check() for details.
+ * 2. Without OBD_CONNECT_GRANT support and blocksize at OST is less than
+ * PAGE_SIZE and a partial page was written. In this case OST may use less
+ * chunks to serve this partial write. OSTs don't actually know the page
+ * size on the client side. so clients have to calculate lost grant by the
+ * blocksize on the OST. See tgt_grant_check() for details.
*/
static void osc_free_grant(struct client_obd *cli, unsigned int nr_pages,
unsigned int lost_grant, unsigned int dirty_grant)
--
1.8.3.1
More information about the lustre-devel
mailing list