Whamcloud - gitweb
LU-10026 csdc: reserve OBD_BRW_SPECULATIVE_COMPR flag 04/55104/5
authorArtem Blagodarenko <ablagodarenko@ddn.com>
Tue, 14 May 2024 12:25:19 +0000 (08:25 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 19 Jun 2024 01:11:37 +0000 (01:11 +0000)
DIO does not set KMS like buffered IO, and the KMS it sets
is not safe.  So this requires special handling for last
chunk compression.

Since we can't know when we're doing the last chunk with
DIO, the solution is as follows:
If a DIO write is chunk aligned at the start but not a full
chunk, we compress it but mark it 'speculative'.  Then the
server double checks that the write is beyond current file
size, and if it's not, it will ask the client to do a
resend, and the client will send the data back
uncompressed.

This makes it reasonable to fully enable DIO to compressed
files - previously we converted unaligned DIO to buffered
IO.

This patch reserves OBD_BRW_SPECULATIVE_COMPR flag.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Signed-off-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Change-Id: I679bc103bd2862115d94286e7c2ed43e1580b29e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55104
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Patrick Farrell <patrick.farrell@oracle.com>
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 2a26077..f051c19 100644 (file)
@@ -1450,6 +1450,8 @@ struct hsm_state_set {
 #define OBD_BRW_RDMA_ONLY    0x20000 /* RPC contains RDMA-only pages*/
 #define OBD_BRW_SYS_RESOURCE 0x40000 /* page has CAP_SYS_RESOURCE */
 #define OBD_BRW_COMPRESSED   0x80000 /* data compressed on client */
+/* client compressed data optimistically but server must check file size */
+#define OBD_BRW_SPECULATIVE_COMPR  0x100000
 
 #define OBD_BRW_OVER_ALLQUOTA (OBD_BRW_OVER_USRQUOTA | \
                               OBD_BRW_OVER_GRPQUOTA | \
index 7ac85f3..91a3861 100644 (file)
@@ -2508,6 +2508,8 @@ void lustre_assert_wire_constants(void)
                OBD_BRW_SYS_RESOURCE);
        LASSERTF(OBD_BRW_COMPRESSED == 0x80000, "found 0x%.8x\n",
                OBD_BRW_COMPRESSED);
+       LASSERTF(OBD_BRW_SPECULATIVE_COMPR == 0x100000, "found 0x%.8x\n",
+               OBD_BRW_SPECULATIVE_COMPR);
 
        /* Checks for struct ost_body */
        LASSERTF((int)sizeof(struct ost_body) == 208, "found %lld\n",
index 4c970b8..1529b80 100644 (file)
@@ -1188,6 +1188,7 @@ check_niobuf_remote(void)
        CHECK_DEFINE_X(OBD_BRW_RDMA_ONLY);
        CHECK_DEFINE_X(OBD_BRW_SYS_RESOURCE);
        CHECK_DEFINE_X(OBD_BRW_COMPRESSED);
+       CHECK_DEFINE_X(OBD_BRW_SPECULATIVE_COMPR);
 }
 
 static void
index 5a8bd5f..e4e5427 100644 (file)
@@ -2533,6 +2533,8 @@ void lustre_assert_wire_constants(void)
                OBD_BRW_SYS_RESOURCE);
        LASSERTF(OBD_BRW_COMPRESSED == 0x80000, "found 0x%.8x\n",
                OBD_BRW_COMPRESSED);
+       LASSERTF(OBD_BRW_SPECULATIVE_COMPR == 0x100000, "found 0x%.8x\n",
+               OBD_BRW_SPECULATIVE_COMPR);
 
        /* Checks for struct ost_body */
        LASSERTF((int)sizeof(struct ost_body) == 208, "found %lld\n",