Skip to content

Commit 6e1b9e1

Browse files
committed
bd: Added trim function to let filesystems give erase hints to FTLs
1 parent e798c53 commit 6e1b9e1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

features/filesystem/bd/BlockDevice.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@ class BlockDevice
9696
return 0;
9797
}
9898

99+
/** Mark blocks as no longer in use
100+
*
101+
* This function provides a hint to the underlying block device that a region of blocks
102+
* is no longer in use and may be erased without side effects. Erase must still be called
103+
* before programming, but trimming allows flash-translation-layers to schedule erases when
104+
* the device is not busy.
105+
*
106+
* @param addr Address of block to mark as unused
107+
* @param size Size to mark as unused in bytes, must be a multiple of erase block size
108+
* @return 0 on success, negative error code on failure
109+
*/
110+
virtual int trim(bd_addr_t addr, bd_size_t size)
111+
{
112+
return 0;
113+
}
114+
99115
/** Get the size of a readable block
100116
*
101117
* @return Size of a readable block in bytes

0 commit comments

Comments
 (0)