VirtualBox

Changeset 38876 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Sep 27, 2011 9:03:15 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74198
Message:

Storage: Add async discard API

Location:
trunk/include/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vd-plugin.h

    r38621 r38876  
    601601                                           unsigned fDiscard));
    602602
     603    /**
     604     * Discards the given amount of bytes decreasing the size of the image if possible
     605     * callback version for asynchronous I/O.
     606     *
     607     * @returns VBox status code.
     608     * @retval  VERR_VD_DISCARD_ALIGNMENT_NOT_MET if the range doesn't meet the required alignment
     609     *          for the discard.
     610     * @param   pBackendData         Opaque state data for this image.
     611     * @param   pIoCtx               I/O context associated with this request.
     612     * @param   uOffset              The offset of the first byte to discard.
     613     * @param   cbDiscard            How many bytes to discard.
     614     * @param   pcbPreAllocated      Pointer to the returned amount of bytes that must
     615     *                               be discarded before the range to perform a full
     616     *                               block discard.
     617     * @param   pcbPostAllocated     Pointer to the returned amount of bytes that must
     618     *                               be discarded after the range to perform a full
     619     *                               block discard.
     620     * @param   pcbActuallyDiscarded Pointer to the returned amount of bytes which
     621     *                               could be actually discarded.
     622     * @param   ppbmAllocationBitmap Where to store the pointer to the allocation bitmap
     623     *                               if VERR_VD_DISCARD_ALIGNMENT_NOT_MET is returned or NULL
     624     *                               if the allocation bitmap should be returned.
     625     * @param   fDiscard             Flags which affect discard behavior. Combination
     626     *                               of the VD_DISCARD_* flags.
     627     */
     628    DECLR3CALLBACKMEMBER(int, pfnAsyncDiscard, (void *pBackendData, PVDIOCTX pIoCtx,
     629                                                uint64_t uOffset, size_t cbDiscard,
     630                                                size_t *pcbPreAllocated,
     631                                                size_t *pcbPostAllocated,
     632                                                size_t *pcbActuallyDiscarded,
     633                                                void   **ppbmAllocationBitmap,
     634                                                unsigned fDiscard));
     635
    603636} VBOXHDDBACKEND;
    604637
  • trunk/include/VBox/vd.h

    r38621 r38876  
    398398
    399399/**
    400  * VD range descriptor.
    401  */
    402 typedef struct VDRANGE
    403 {
    404     /** Start offset in bytes, multiple of 512. */
    405     uint64_t    offStart;
    406     /** Amount of bytes described by this range, multiple of 512. */
    407     size_t      cbRange;
    408 } VDRANGE;
    409 
    410 /** Pointer to a range descriptor. */
    411 typedef VDRANGE *PVDRANGE;
    412 /** Pointer to a constant range descriptor. */
    413 typedef const VDRANGE *PCVDRANGE;
    414 
    415 /**
    416400 * VBox HDD Container main structure.
    417401 */
     
    11221106 *       appear to contain data. This method is mainly used to implement TRIM support.
    11231107 */
    1124 VBOXDDU_DECL(int) VDDiscardRanges(PVBOXHDD pDisk, PCVDRANGE paRanges, unsigned cRanges);
     1108VBOXDDU_DECL(int) VDDiscardRanges(PVBOXHDD pDisk, PCRTRANGE paRanges, unsigned cRanges);
    11251109
    11261110
     
    11701154                               PFNVDASYNCTRANSFERCOMPLETE pfnComplete,
    11711155                               void *pvUser1, void *pvUser2);
     1156
     1157/**
     1158 * Start an asynchronous discard request.
     1159 *
     1160 * @return  VBox status code.
     1161 * @param   pDisk           Pointer to HDD container.
     1162 * @param   paRanges        The array of ranges to discard.
     1163 * @param   cRanges         Number of entries in the array.
     1164 * @param   pfnComplete     Completion callback.
     1165 * @param   pvUser1         User data which is passed on completion.
     1166 * @param   pvUser2         User data which is passed on completion.
     1167 */
     1168VBOXDDU_DECL(int) VDAsyncDiscardRanges(PVBOXHDD pDisk, PCRTRANGE paRanges, unsigned cRanges,
     1169                                       PFNVDASYNCTRANSFERCOMPLETE pfnComplete,
     1170                                       void *pvUser1, void *pvUser);
     1171
    11721172RT_C_DECLS_END
    11731173
  • trunk/include/VBox/vddbg.h

    r38632 r38876  
    175175 * @param   phIoLogEntry Where to store the I/O log entry handle on success.
    176176 */
    177 VBOXDDU_DECL(int) VDDbgIoLogStartDiscard(VDIOLOGGER hIoLogger, bool fAsync, PVDRANGE paRanges, unsigned cRanges,
     177VBOXDDU_DECL(int) VDDbgIoLogStartDiscard(VDIOLOGGER hIoLogger, bool fAsync, PCRTRANGE paRanges, unsigned cRanges,
    178178                                         PVDIOLOGENT phIoLogEntry);
    179179
     
    239239 */
    240240VBOXDDU_DECL(int) VDDbgIoLogEventGetStartDiscard(VDIOLOGGER hIoLogger, uint64_t *pidEvent, bool *pfAsync,
    241                                                  PVDRANGE *ppaRanges, unsigned *pcRanges);
     241                                                 PRTRANGE *ppaRanges, unsigned *pcRanges);
    242242
    243243/**
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette