[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio: sync pcs_mds_sys_info struct

Konstantin Khorenko khorenko at virtuozzo.com
Mon Apr 15 16:36:19 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.10.1.vz7.94.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.10.1.vz7.94.13
------>
commit 4046801685a6d664bb84c9d6b3b9c840eac8312f
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Mon Apr 15 16:36:18 2019 +0300

    fs/fuse kio: sync pcs_mds_sys_info struct
    
    For some reason pcs_mds_sys_info structure is different in the kernel and
    userspace. Let's synchronize it to avoid inaccuracies and discrepancies in
    the future.
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
    
    ==================================
    Patchset description:
    fix jumbo chunk warning
    
    Initially the warning was added incorrectly due to unsynchronization of
    pcs_mds_sys_info structure with the userspace client. Let's sync the structure
    and fix that.
    
    Pavel Butsykin (2):
      fs/fuse kio: sync pcs_mds_sys_info struct
      fs/fuse kio: add warning about jumbo chunks
---
 fs/fuse/kio/pcs/pcs_client_types.h |  6 +++---
 fs/fuse/kio/pcs/pcs_cluster.c      |  8 ++++----
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c |  2 +-
 fs/fuse/kio/pcs/pcs_prot_types.h   | 10 ++++++----
 4 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_client_types.h b/fs/fuse/kio/pcs/pcs_client_types.h
index 1be32cbbf285..c0d14ec5b5d4 100644
--- a/fs/fuse/kio/pcs/pcs_client_types.h
+++ b/fs/fuse/kio/pcs/pcs_client_types.h
@@ -87,9 +87,9 @@ static inline void pcs_set_fileinfo(struct pcs_dentry_info *i, const struct pcs_
 
 	if (mi->sys.stripe_depth == 0) {
 		mi->sys.stripe_depth = 1;
-		mi->sys.strip_width = mi->sys.chunk_size;
+		mi->sys.strip_width = mi->sys.chunk_size_lo;
 	}
-	i->mapping.chunk_size_bits = ilog2(mi->sys.chunk_size);
+	i->mapping.chunk_size_bits = ilog2(mi->sys.chunk_size_lo);
 
 }
 
@@ -170,7 +170,7 @@ typedef struct _pcs_api_csconnreq_t {
 #define DENTRY_ARGS(de)	      PCS_FILE_ID_ARGS((de)->id.parent), PCS_FILE_ID_ARGS((de)->fileinfo.attr.id)
 
 #define DENTRY_SIZE(de)       ((de)->fileinfo.attr.size)
-#define DENTRY_CHUNK_SIZE(de) ((de)->fileinfo.sys.chunk_size)
+#define DENTRY_CHUNK_SIZE(de) ((de)->fileinfo.sys.chunk_size_lo)
 #define DENTRY_CHUNK_SIZE_BITS(de) ((de)->mapping.chunk_size_bits)
 
 void pcs_mapset_limit(struct pcs_map_set *maps, int limit);
diff --git a/fs/fuse/kio/pcs/pcs_cluster.c b/fs/fuse/kio/pcs/pcs_cluster.c
index 5df263f01f98..a73120c97e5e 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.c
+++ b/fs/fuse/kio/pcs/pcs_cluster.c
@@ -364,9 +364,9 @@ static noinline void __pcs_cc_process_ireq_rw(struct pcs_int_request *ireq)
 		unsigned int len;
 		u64 rpos, chunk, end_pos;
 
-		rpos = map_file_to_chunk(pos, di->fileinfo.sys.chunk_size, di->fileinfo.sys.stripe_depth, di->fileinfo.sys.strip_width);
+		rpos = map_file_to_chunk(pos, di->fileinfo.sys.chunk_size_lo, di->fileinfo.sys.stripe_depth, di->fileinfo.sys.strip_width);
 
-		chunk = rpos & ~((u64)di->fileinfo.sys.chunk_size - 1);
+		chunk = rpos & ~((u64)di->fileinfo.sys.chunk_size_lo - 1);
 		end_pos = ((rpos / di->fileinfo.sys.strip_width) + 1) * (u64)di->fileinfo.sys.strip_width;
 
 		sreq = ireq_alloc(di);
@@ -385,9 +385,9 @@ static noinline void __pcs_cc_process_ireq_rw(struct pcs_int_request *ireq)
 		sreq->iochunk.cmd = ireq->apireq.req->type;
 		sreq->iochunk.cs_index = 0;
 		sreq->iochunk.chunk = chunk;
-		sreq->iochunk.offset = rpos % di->fileinfo.sys.chunk_size;
+		sreq->iochunk.offset = rpos % di->fileinfo.sys.chunk_size_lo;
 		sreq->iochunk.dio_offset = dio_offset;
-		len = di->fileinfo.sys.chunk_size - sreq->iochunk.offset;
+		len = di->fileinfo.sys.chunk_size_lo - sreq->iochunk.offset;
 		if (len > sz)
 			len = sz;
 		if (rpos + len > end_pos)
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 38d7885f99c7..01f267ee1906 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -354,7 +354,7 @@ static int kpcs_do_file_open(struct fuse_conn *fc, struct file *file, struct ino
 	INIT_LIST_HEAD(&di->kq);
 	spin_lock_init(&di->kq_lock);
 	TRACE("init id:%llu chunk_size:%d stripe_depth:%d strip_width:%d\n",
-	      fi->nodeid, di->fileinfo.sys.chunk_size,
+	      fi->nodeid, di->fileinfo.sys.chunk_size_lo,
 	      di->fileinfo.sys.stripe_depth, di->fileinfo.sys.strip_width);
 
 	ret = fuse_pcs_kdirect_claim_op(fc, file, true);
diff --git a/fs/fuse/kio/pcs/pcs_prot_types.h b/fs/fuse/kio/pcs/pcs_prot_types.h
index 5905fabbfad8..11986252f23c 100644
--- a/fs/fuse/kio/pcs/pcs_prot_types.h
+++ b/fs/fuse/kio/pcs/pcs_prot_types.h
@@ -107,15 +107,17 @@ struct __pre_aligned(8) pcs_mds_fattr
 };
 
 struct __pre_aligned(8) pcs_mds_sys_info {
-	u32	map_type;     /* reserved for RAID */
-	u32	chunk_size;   /* global constant */
+	u8	map_type;     /* reserved for RAID */
+	u8	reserved[2];
+	u8	chunk_size_hi; /* chunk size (hi bits) */
+	u32	chunk_size_lo; /* chunk size (lo bits) */
 	u8	stripe_depth; /* for RAID6/RS  */
 	u8	redundancy;   /* number of checksums for RAID6/RS */
 	u8	tolerance;    /* write-tolerance (how much lost replicas we can tolerate still allowing writing) */
-	u8	reserved8;
+	u8	reserved2;
 	u32	strip_width;  /* length of strip for RAID6/RS */
 	u32	lease_tout;   /* lease expiration timeout (in milliseconds) */
-	u32	reserved;
+	u32	reserved3;
 } __aligned(8);
 
 #define PCS_CHUNK_SIZE_MIN 4096u



More information about the Devel mailing list