Thread (61 messages) 61 messages, 8 authors, 2020-07-21

Re: [PATCH v3 4/4] io_uring: add support for zone-append

From: Matthew Wilcox <willy@infradead.org>
Date: 2020-07-20 17:14:30
Also in: io-uring, linux-fsdevel, lkml

On Mon, Jul 20, 2020 at 10:19:57PM +0530, Kanchan Joshi wrote:
On Fri, Jul 10, 2020 at 7:41 PM Kanchan Joshi [off-list ref] wrote:
quoted
If we are doing this for zone-append (and not general cases), "__s64
res64" should work -.
64 bits = 1 (sign) + 23 (bytes-copied: cqe->res) + 40
(written-location: chunk_sector bytes limit)
No, don't do this.

 struct io_uring_cqe {
	__u64   user_data;      /* sqe->data submission passed back */
-	__s32   res;            /* result code for this event */
-	__u32   flags;
+	union {
+		struct {
+			__s32   res;    /* result code for this event */
+			__u32   flags;
+		};
+		__s64		res64;
+	};
 };

Return the value in bytes in res64, or a negative errno.  Done.
			
  * IO completion data structure (Completion Queue Entry)
  */
 struct io_uring_cqe {
-       __u64   user_data;      /* sqe->data submission passed back */
-       __s32   res;            /* result code for this event */
-       __u32   flags;
+       __u64   user_data;      /* sqe->data submission passed back */
+        union {
+                struct {
+                        __s32   res;            /* result code for
this event */
+                        __u32   flags;
+                };
+               /* Alternate for zone-append */
+               struct {
+                       union {
+                               /*
+                                * kernel uses this to store append result
+                                * Most significant 23 bits to return number of
+                                * bytes or error, and least significant 41 bits
+                                * to return zone-relative offset in bytes
+                                * */
+                               __s64 res64;
+                               /*for user-space ease, kernel does not use*/
+                               struct {
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+                                       __u64 append_offset :
APPEND_OFFSET_BITS;
+                                       __s32 append_res : APPEND_RES_BITS;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+                                       __s32 append_res : APPEND_RES_BITS;
+                                       __u64 append_offset :
APPEND_OFFSET_BITS;
+#endif
+                               }__attribute__ ((__packed__));
+                       };
+                };
+        };
 };

-- 
Joshi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help