bd: Added trim function to let filesystems give erase hints to FTLs

pull/4983/head
Christopher Haster 2017-08-28 14:06:18 -05:00
parent e798c5359e
commit 6e1b9e153c
1 changed files with 16 additions and 0 deletions

View File

@ -96,6 +96,22 @@ public:
return 0;
}
/** Mark blocks as no longer in use
*
* This function provides a hint to the underlying block device that a region of blocks
* is no longer in use and may be erased without side effects. Erase must still be called
* before programming, but trimming allows flash-translation-layers to schedule erases when
* the device is not busy.
*
* @param addr Address of block to mark as unused
* @param size Size to mark as unused in bytes, must be a multiple of erase block size
* @return 0 on success, negative error code on failure
*/
virtual int trim(bd_addr_t addr, bd_size_t size)
{
return 0;
}
/** Get the size of a readable block
*
* @return Size of a readable block in bytes