Motr  M0
Layout DB Functional Specification

Layout DB Module is used by the Layout module to make persistent records for the layout entries created and used.

This section describes the data structures exposed and the external interfaces of the Layout DB module and it briefly identifies the users of these interfaces so as to explain how to use this module.

Data Structures

Subroutines

Accessors and Invariants

Recipes

A file layout is used by the client to perform IO against that file. For example, layout for a file may contain COB identifiers for all the COBs associated with that file. For example, the COB identifiers may be stored by the layout either in the form of a list or as a linear formula.

Example use case of reading a file:

  • Reading a file involves reading basic file attributes from the basic file attributes table).
  • The layout id is obtained from the basic file attributes.
  • A query is sent to the Layout module to obtain layout for this layout id using the API m0_layout_lookup()
    • m0_layout_lookup() returns the layout object if it is cached.
    • If the layout is not cached, m0_layout_lookup() return it by reading it from the layout DB and by keeping it in the cache.
  • Reading a layout record from the layout DB involves the following for example:

    • If the layout record is with the LINEAR enumeration, then the linear formula is obtained from the DB. Once the formula is available, the user can substitute the required parameters into the formula so as to obtain the list of COB identifiers to operate upon.
    • If the layout record is with the LIST enumeration, then the the list of COB identifiers is obtained from the layout DB itself.
    • If the layout record is of the COMPOSITE layout type, it means it constitutes of multiple sub-layouts. In this case, the sub-layouts are read from the layout DB. Those sub-layout records in turn could be of other layout types and with LINEAR or LIST enumeration for example. The sub-layout records are then read accordingly until the time the final list of all the COB identifiers is obtained.
    See also
    Layout DB Detailed Functional Specification