|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH 2/2] xen-unstable/blkif: Add trim operation interface
From: Owen Smith <owen.smith@xxxxxxxxxx>
# HG
changeset patch
# User root@xxxxxxxxxxxxxxxxxxxxxxx
# Date 1294921282 0
# Node ID ab006de92c098a54d9e029e885f91d5c3c62c3c0
# Parent 428420495fd3cfda164e7b355b0ffcc0845af2e4
blkif: Add trim operation interface
Patches xen-unstable.hg
Trim operation is a request for the underlying block device to mark
extents to be erased. Add the operation code and ring data structure
to the public header file.
Trim operations are passed with sector_number as the sector index to
begin trim operations at and nr_sectors as the number of sectors to
be trimmed. The specified sectors should be trimmed if the underlying
block device supports trim operations, or a BLKIF_RSP_EOPNOTSUPP should
be returned. More information about trim operations at;
http://t13.org/Documents/UploadedDocuments/docs2008/
e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
diff -r 428420495fd3 -r ab006de92c09 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h Thu Jan 13 11:48:41 2011 +0000
+++ b/xen/include/public/io/blkif.h Thu Jan 13 12:21:22 2011 +0000
@@ -81,6 +81,17 @@
* contained within the request. Reserved for that purpose.
*/
#define BLKIF_OP_RESERVED_1 4
+/*
+ * Recognised only if "feature-trim" is present in backend xenbus info.
+ * The "feature-trim" node contains a boolean indicating whether trim
+ * requests are likely to succeed or fail. Either way, a trim request
+ * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by
+ * the underlying block-device hardware. The boolean simply indicates whether
+ * or not it is worthwhile for the frontend to attempt trim requests.
+ * If a backend does not recognise BLKIF_OP_TRIM, it should *not*
+ * create the "feature-trim" node!
+ */
+#define BLKIF_OP_TRIM 5
/*
* Maximum scatter/gather segments per request.
@@ -108,6 +119,11 @@
struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
};
+struct blkif_request_trim {
+ blkif_sector_t sector_number;/* start sector idx on disk */
+ uint64_t nr_sectors; /* number of sectors to trim */
+};
+
struct blkif_request {
uint8_t operation; /* BLKIF_OP_??? */
uint8_t nr_segments; /* number of segments */
@@ -115,6 +131,7 @@
uint64_t id; /* private guest value, echoed in resp */
union {
struct blkif_request_rw rw;
+ struct blkif_request_trim trim;
} u;
};
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|