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>
#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 | \
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",
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
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",