Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163399254
D21912.id63655.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D21912.id63655.diff
View Options
Index: head/sys/cam/nvme/nvme_da.c
===================================================================
--- head/sys/cam/nvme/nvme_da.c
+++ head/sys/cam/nvme/nvme_da.c
@@ -129,12 +129,11 @@
};
struct nda_trim_request {
- union {
- struct nvme_dsm_range dsm;
- uint8_t data[NVME_MAX_DSM_TRIM];
- };
+ struct nvme_dsm_range dsm[NVME_MAX_DSM_TRIM / sizeof(struct nvme_dsm_range)];
TAILQ_HEAD(, bio) bps;
};
+_Static_assert(NVME_MAX_DSM_TRIM % sizeof(struct nvme_dsm_range) == 0,
+ "NVME_MAX_DSM_TRIM must be an integral number of ranges");
/* Need quirk table */
@@ -957,9 +956,8 @@
}
TAILQ_INIT(&trim->bps);
bp1 = bp;
- ents = sizeof(trim->data) / sizeof(struct nvme_dsm_range);
- ents = min(ents, nda_max_trim_entries);
- dsm_range = &trim->dsm;
+ ents = min(nitems(trim->dsm), nda_max_trim_entries);
+ dsm_range = trim->dsm;
dsm_end = dsm_range + ents;
do {
TAILQ_INSERT_TAIL(&trim->bps, bp1, bio_queue);
@@ -977,8 +975,8 @@
/* XXX -- Could limit based on total payload size */
} while (bp1 != NULL);
start_ccb->ccb_trim = trim;
- nda_nvme_trim(softc, &start_ccb->nvmeio, &trim->dsm,
- dsm_range - &trim->dsm);
+ nda_nvme_trim(softc, &start_ccb->nvmeio, trim->dsm,
+ dsm_range - trim->dsm);
start_ccb->ccb_state = NDA_CCB_TRIM;
softc->trim_count++;
softc->trim_ranges += ranges;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 23, 8:58 PM (19 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35415332
Default Alt Text
D21912.id63655.diff (1 KB)
Attached To
Mode
D21912: nda(4): Remove unnecessary union and avoid Clang -Wsizeof-array-div warning
Attached
Detach File
Event Timeline
Log In to Comment