diff options
Diffstat (limited to 'include/xen/interface/io/blkif.h')
-rw-r--r-- | include/xen/interface/io/blkif.h | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index ae665ac59c36..32ec05a6572f 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h | |||
@@ -113,13 +113,13 @@ typedef uint64_t blkif_sector_t; | |||
113 | * it's less than the number provided by the backend. The indirect_grefs field | 113 | * it's less than the number provided by the backend. The indirect_grefs field |
114 | * in blkif_request_indirect should be filled by the frontend with the | 114 | * in blkif_request_indirect should be filled by the frontend with the |
115 | * grant references of the pages that are holding the indirect segments. | 115 | * grant references of the pages that are holding the indirect segments. |
116 | * This pages are filled with an array of blkif_request_segment_aligned | 116 | * These pages are filled with an array of blkif_request_segment that hold the |
117 | * that hold the information about the segments. The number of indirect | 117 | * information about the segments. The number of indirect pages to use is |
118 | * pages to use is determined by the maximum number of segments | 118 | * determined by the number of segments an indirect request contains. Every |
119 | * a indirect request contains. Every indirect page can contain a maximum | 119 | * indirect page can contain a maximum of |
120 | * of 512 segments (PAGE_SIZE/sizeof(blkif_request_segment_aligned)), | 120 | * (PAGE_SIZE / sizeof(struct blkif_request_segment)) segments, so to |
121 | * so to calculate the number of indirect pages to use we have to do | 121 | * calculate the number of indirect pages to use we have to do |
122 | * ceil(indirect_segments/512). | 122 | * ceil(indirect_segments / (PAGE_SIZE / sizeof(struct blkif_request_segment))). |
123 | * | 123 | * |
124 | * If a backend does not recognize BLKIF_OP_INDIRECT, it should *not* | 124 | * If a backend does not recognize BLKIF_OP_INDIRECT, it should *not* |
125 | * create the "feature-max-indirect-segments" node! | 125 | * create the "feature-max-indirect-segments" node! |
@@ -135,13 +135,12 @@ typedef uint64_t blkif_sector_t; | |||
135 | 135 | ||
136 | #define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 | 136 | #define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 |
137 | 137 | ||
138 | struct blkif_request_segment_aligned { | 138 | struct blkif_request_segment { |
139 | grant_ref_t gref; /* reference to I/O buffer frame */ | 139 | grant_ref_t gref; /* reference to I/O buffer frame */ |
140 | /* @first_sect: first sector in frame to transfer (inclusive). */ | 140 | /* @first_sect: first sector in frame to transfer (inclusive). */ |
141 | /* @last_sect: last sector in frame to transfer (inclusive). */ | 141 | /* @last_sect: last sector in frame to transfer (inclusive). */ |
142 | uint8_t first_sect, last_sect; | 142 | uint8_t first_sect, last_sect; |
143 | uint16_t _pad; /* padding to make it 8 bytes, so it's cache-aligned */ | 143 | }; |
144 | } __attribute__((__packed__)); | ||
145 | 144 | ||
146 | struct blkif_request_rw { | 145 | struct blkif_request_rw { |
147 | uint8_t nr_segments; /* number of segments */ | 146 | uint8_t nr_segments; /* number of segments */ |
@@ -151,12 +150,7 @@ struct blkif_request_rw { | |||
151 | #endif | 150 | #endif |
152 | uint64_t id; /* private guest value, echoed in resp */ | 151 | uint64_t id; /* private guest value, echoed in resp */ |
153 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 152 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
154 | struct blkif_request_segment { | 153 | struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
155 | grant_ref_t gref; /* reference to I/O buffer frame */ | ||
156 | /* @first_sect: first sector in frame to transfer (inclusive). */ | ||
157 | /* @last_sect: last sector in frame to transfer (inclusive). */ | ||
158 | uint8_t first_sect, last_sect; | ||
159 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
160 | } __attribute__((__packed__)); | 154 | } __attribute__((__packed__)); |
161 | 155 | ||
162 | struct blkif_request_discard { | 156 | struct blkif_request_discard { |