diff mbox series

[02/50] lustre: osc: Fix grant test for ARM

Message ID 1647783064-20688-3-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: update to OpenSFS tree as of March 20, 2022 | expand

Commit Message

James Simmons March 20, 2022, 1:30 p.m. UTC
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@infradead.org>
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Reviewed-on: https://review.whamcloud.com/40758
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 fs/lustre/osc/osc_cache.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
diff mbox series

Patch

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)