Skip to main content

SEF FTL Public API

SEFBlockIOType

Type of i/o in a SEFMultiContext.

Members of SEFBlockIOType

MemberDescription
kSEFReadPerforms a read operation
kSEFWritePerforms a write operation

SEFBlockIOFlags

I/O flags in a SEFMultiContext.

Members of SEFBlockIOFlags

MemberDescription
kSEFBlockIOFlagNotifyBufferReleaseBuffer lifetime is controlled by caller

SEFBlockNotifyType

Event types for SEFBlockNotify.

Members of SEFBlockNotifyType

MemberDescription
kSefBlockNotifyGCDownGC can no longer make progress, write I/O will fail
kSefBlockNotifyBufferReleaseA portion of an I/O buffer can be released

SEFBlockConfig

struct SEFStatus SEFBlockConfig(uint16_t SEFUnitIndex, struct SEFQoSDomainID QoSDomainID, struct SEFBlockConfig *config)

This function is used to configure the SEF Block Module.

It configures freshly created QoS domains so they can used as a SEF Block Module domain. It sets the number of QoS domains and the amount of over provisioning to use. Once these values are set, they cannot be changed without erasing or recreating the QoS domains.

A QoS domain must be configured as a SEF Block Module domain before calling SEFBlockModuleInit().

See Also: SEFBlockInit()

Parameters of SEFBlockConfig

TypeNameDirectionDescription
uint16_tSEFUnitIndexInThe index of the SEF Unit; the index is zero-based
struct SEFQoSDomainIDQoSDomainIDInQoS Domain ID
struct SEFBlockConfig*configInA pointer to an instance of SEFBlockConfig, for config settings

Return value of SEFBlockConfig

TypeDescription
struct SEFStatusStatus and info summarizing result.

Return values of SEFBlockConfig

Error ValueDescription
-EINVALInvalid over provisioning percentage
-EEXISTThe device is already configured, can not reconfigure a pre-configured device
-EBADFThe block module was not shutdown cleanly; Consider running Check Disk

SEFBlockInit

struct SEFStatus SEFBlockInit(uint16_t SEFUnitIndex, struct SEFQoSDomainID QoSDomainID, struct SEFBlockOption *options, SEFBlockHandle *blockHandle)

This function is used to get a SEFBlockModuleHandle for issuing I/O.

The QoS domain must be configured as a SEF Block Module domain using SEFBlockConfig() before calling SEFBlockInit(). Configuration only needs to be done once.

See Also: SEFBlockConfig()

Parameters of SEFBlockInit

TypeNameDirectionDescription
uint16_tSEFUnitIndexInThe index of the SEF Unit; the index is zero-based
struct SEFQoSDomainIDQoSDomainIDInQoS Domain ID
struct SEFBlockOption*optionsInA pointer to an instance of SEFBlockOption, for runtime options
SEFBlockHandle *blockHandleInA pointer to the SEF Block handle to be used for access to the block instance

Return value of SEFBlockInit

TypeDescription
struct SEFStatusStatus and info summarizing result.

Return values of SEFBlockInit

Error ValueDescription
-EINVALInvalid log level
-EBADFThe block module was not shutdown cleanly; Consider running Check Disk
-ENOENTBlock layer has not been configured with SEFBlockConfig()

SEFBlockMount

struct SEFStatus SEFBlockMount(SEFBlockHandle blockHandle)

This function mounts the FTL configured domain if not already mounted.

It's required to be called before calling SEFBlockIO() when SEFBlockInit() was called with the option delayMount set to true. Calling it when it's not required has no effect.

See Also: SEFBlockInit(), SEFBlockIO()

Parameters of SEFBlockMount

TypeNameDirectionDescription
SEFBlockHandleblockHandleInSEF Block handle to be used for access to the block instance

Return value of SEFBlockMount

TypeDescription
struct SEFStatusStatus and info summarizing result.

SEFBlockGetInfo

void SEFBlockGetInfo(SEFBlockHandle blockHandle, struct SEFBlockInfo *info)

This function returns size information about a block device.

The function requires the block layer to be initialized before it is called.

Parameters of SEFBlockGetInfo

TypeNameDirectionDescription
SEFBlockHandleblockHandleInSEF Block handle to be used for access to the block instance
struct SEFBlockInfo*infoOutSEFBlockInfo struct to fill with data

SEFBlockIO

struct SEFStatus SEFBlockIO(struct SEFMultiContext *context)

This function is used to perform I/O commands.

Parameters of SEFBlockIO

TypeNameDirectionDescription
struct SEFMultiContext*contextInA pointer to an instance of SEFMultiContext

Return value of SEFBlockIO

TypeDescription
struct SEFStatusStatus and info summarizing result.

Return values of SEFBlockIO

Error ValueDescription
-EINVALThe input parameters are invalid; either Scatter gather list is too small or I/O exceeds the device capacity
-ENOPROTOOPTFTL is either not initialized or shutting down, failing I/O
-EBUSYI/o context p appears to be in use
-ECANCELEDGC shutdown, inflight writes canceled

SEFBlockTrim

struct SEFStatus SEFBlockTrim(SEFBlockHandle blockHandle, int64_t lba, int32_t lbc)

This function is used to discard or TRIM LBAs that are no longer needed by the application.

Parameters of SEFBlockTrim

TypeNameDirectionDescription
SEFBlockHandleblockHandleInSEF Block handle to be used for access to the block instance
int64_tlbaInLogical block address
int32_tlbcInLogical block count

Return value of SEFBlockTrim

TypeDescription
struct SEFStatusStatus and info summarizing result.

Return values of SEFBlockTrim

Error ValueDescription
-ENOTBLKThe Block context is not valid
-EINVALThe LBA or LBC is not valid
-EIOWas unable to trim; the Info would indicate LBC that wasn't completed

SEFBlockCancel

struct SEFStatus SEFBlockCancel(struct SEFMultiContext *context)

Requests the passed in I/O be canceled.

It's the caller's responsibility to ensure that the context is valid for the duration of the call. Because of internal race conditions, the call may fail and yet still cancel the I/O. Also possible is the function returns success, yet the I/O completes without error instead of a canceled I/O error.

Parameters of SEFBlockCancel

TypeNameDirectionDescription
struct SEFMultiContext*contextIna pointer to an instance of SEFMultiContext

Return value of SEFBlockCancel

TypeDescription
struct SEFStatusStatus and info summarizing result.

Return values of SEFBlockCancel

Error ValueDescription
-ENOENTThe I/O was not found in the any queues

SEFBlockCheck

struct SEFStatus SEFBlockCheck(SEFBlockHandle blockHandle, int shouldRepair)

This function is used to check if the stored data and metadata match.

Moreover, it is capable of repairing the device. To create a blockHandle for a device that won't mount, call SEFBlockInit() with the delayMount option set to true.

Parameters of SEFBlockCheck

TypeNameDirectionDescription
SEFBlockHandleblockHandleInA pointer to the SEF Block handle to be used for access to the block instance.
intshouldRepairInShould the block module be repaired if it is faulty? 1 denotes true

Return value of SEFBlockCheck

TypeDescription
struct SEFStatusStatus and info summarizing result. An error is returned if the device is faulty.

SEFBlockCleanup

struct SEFStatus SEFBlockCleanup(SEFBlockHandle *blockHandle)

This function is used to clean up the SEF Block Module by freeing up memory and stopping all related functionality.

Parameters of SEFBlockCleanup

TypeNameDirectionDescription
SEFBlockHandle *blockHandleInA pointer to the SEF Block handle to be used for access to the block instance

Return value of SEFBlockCleanup

TypeDescription
struct SEFStatusStatus and info summarizing result.

Return values of SEFBlockCleanup

Error ValueDescription
-ENODATAThe input block handle is not valid

SEFMultiContext

I/O request for SEFBlockIO()

Members of SEFMultiContext

TypeNameDescription
SEFBlockHandleblockHandleSEF Block handle to be used for access to the block instance
struct SEFMultiContext*parentA pointer to an instance of SEFMultiContext used for compound operations
void(*)(struct SEFMultiContext *)completionThe function that is called when the transaction is completed
void *argA pointer that can be used by caller for any reason
uint64_tlbaLogical block address
uint32_tlbcLogical block count
uint8_tioTypeenum SEFBlockIOType that needs to be performed
uint8_tflagsI/O flags enum SEFBlockIOFlags
uint8_treadQueuekSEFRead queue override when valid
uint16_tioWeightI/O weight to override when non-zero
struct iovec*iovA pointer to the scatter/gather list
size_tiovOffsetStarting byte offset into iov array
intiovcntThe number of elements in the scatter/gather list
uint16_tqosIndex0 based, used for multi-domain FTL
struct SEFPlacementIDplacementIDPlacement ID for writes
uint32_tnumLblNum logical blocks left in the super block
atomic_inttransferredCounter denoting number of bytes transferred for the transaction
atomic_intcountReference count, I/O is completed -> 0
atomic_interrorFirst error for the transaction
intcancelSet to indicate cancel in progress

SEFBlockNotify

Event data sent to a client's notification function.

The notification function is set when SEFBlockInit() is called.

Members of SEFBlockNotify

TypeNameDescription
enum SEFBlockNotifyTypetypeType of notification
const struct iovec*iovVector of buffers to release
int16_tiovcntCount of buffers in iov

SEFBlockOption

Init time options.

Initialization time options supplied to SEFBlockInit()

Members of SEFBlockOption

TypeNameDescription
intlogLevelInitial log level (Trace = 0 , Debug = 1, Info = 2, Error = 3, Fatal = 4)
LogHandlelogHandleUse an external logger
const char *instrumentationPathThe location for the Unix Domain Socket. Will replace the first two format specifier with UnitIndex and QoSDomainId. Defaults to /tmp/SEFFTLDomain.[UnitIndex].[QoSDomainId]
void *notifyContextUser context passed to notifyFunc()
void(*)(struct SEFBlockNotify event, void *notifyContext)notifyFuncSet to receive notifications
booldelayMountWhen true, SEFBlockInit() delays mounting until SEFBlockMount() is called

SEFBlockConfig

Configuration when calling SEFBlockConfig()

Members of SEFBlockConfig

TypeNameDescription
intoverprovisioningPercentage of over-provisioning (e.g., 20 for 20 percent)
intunused0Unused member
intnumDomainsNumber of domains to use for a block-device. 0 indicates all defined domains
struct SEFBlockOptionblockOptionRun time options while configuring

SEFBlockInfo

Information about a block-module device.

Members of SEFBlockInfo

TypeNameDescription
struct SEFADUsizeaduSizeSize of ADU and Meta
int16_tnumPlacementIDsNumber of Placement IDs
intsuperBlockSizeMaximum number of ADUs in a super block
intsuperPageSizeNumber of ADUs in a super page
intflashWriteSizeNumber of ADUs to write to avoid padding (e.g., sync write)
uint64_tcapacityCapacity in ADUs
intoverprovisioningPercentage of over-provisioning (e.g., 20 for 20 percent)
intnumDomainsNumber of domains the FTL covers