Operations with AFM modes

Following are the operations with AFM modes - Read only (RO), Single writer (SW), Local updates (LU), and Independent writer (IW).

  1. Read only (RO)

    The following figure illustrates the Read Only mode.

    Figure 1. Read only mode
    Read only mode
    In this mode, data in the cache is read-only. Creating or modifying files in the cache fileset is not allowed. If a file is renamed at the home for an RO fileset, the file is re-created in cache and is assigned a new inode number in the cache. If the file is in use by an application while it is re-created (deleted and re-created with the same name) at home, it gets re-created in cache.
  2. Single writer (SW)

    The following figure illustrates the Single writer mode.

    Figure 2. Single writer mode
    Single writer mode
    In this mode, only the cache fileset does all the writing and the cache does not check home for file or directory updates. The administrator needs to guarantee no writes are done in the home cluster. AFM does not enforce this check.

    An SW home can have some pre-existing data. An SW cache can cache and update this data. Update of an uncached file from SW home caches the file. However, the truncate or append operations on an uncached file does not fetch the contents of the file into the cache, but queues the truncate or append operation to the home.

  3. Local updates (LU)

    Local update is similar to read-only mode although you can create and modify files in the cache fileset. Updates in the cache are considered local to the cache and get decoupled from the corresponding file at home. Local updates are never pushed back to home. After modifications in a file, the file is no longer compared to the version at home during revalidation to verify that it is up to date. Changes of this file on home do not have an impact on the cached copy of the file and vice versa.

    Behaviors with local files: In AFM, LU mode files have one of the following states:
    • Uncached: Files on the home for which metadata but no data is copied into the cache are shown in the cache as uncached. The file is not resident on cache, but only on the home. Changes on the home are reflected in the cache.
    • Cached: If an uncached file is read in the cache or pre-fetched, the state of the file changes to cached. In the cached state, all changes to the file on the home are reflected in the cache. The file is resident on the cache.
    • Local: File data or metadata that is modified at cache becomes local to the cache. The cached files relationship to the file in the home is broken. Changes on the home are not reflected in the cache anymore and file changes are not copied to the home.
    Operations in the cache that trigger the transitions between these states are shown below:
    Figure 3. Behaviors with local files
    Behaviors with local files
    The following tables summarize AFM LU mode behavior with local files:
    File operation at home Uncached file Cached file Local file
    New Create Reflects Reflects Reflects
    Change data or attributes/Rename/Delete Reflects Reflects Does not reflect
    File operation at home Uncached file Cached file Local file
    File lookup revalidation Pulls the metadata Pulls the latest metadata Does not pull the latest metadata
    Read Pulls the data Pulls the latest data Shows data in the local file – does not pull the latest data from the home
    Prefetch Prefetches the data Prefetches the latest data Does not prefetch the latest data from home
    Change data Pulls the data into cache and updates the changes Pulls the latest to cache and updates the changes Updates the local copy of the file and does not pull the latest data from the home before the update
    Change attributes/metadata except delete EA Updates the file and marks file as local Updates the file and marks file as local Updates the file – does not pull the latest metadata from the home before the update

    Directories in a local-update cache:

    Directories can become local in the LU mode with the following directory operations from the cache:
    • Deleting files or sub-directories in the cache directory
    • Creating new files or sub-directories in the cache directory
    • Renaming files or sub-directories in the cache directory
    The following file operations on cache do not cause directories on the cache to become local:
    • update the uncached or cached file
    • add attributes to the file
    • migrate the cached or local files to tape
    • recall of the cached or local files from tape
    A local directory in a LU cache can contain local, cached and uncached files and directories. A local directory is not revalidated with home. Therefore, operations on the directory at home do not show up on the cache.
    The following tables summarize AFM LU mode behavior with local directories:
    Operation at home Cache behavior - Normal directory Cache behavior - Local directory
    Create a file or subdirectory Reflects in cache after next directory lookup Does not show in cache after next directory lookup. Contents can be read or prefetched if the file name is known in the cache. After read or prefetch, the new file or directory shows up in the cache for future file lookup
    Update data or attributes of an existing file or subdirectory Reflects in cache after next file lookup Reflects in cache after next file lookup
    Rename an existing file or subdirectory Reflects in cache after next file lookup Does not show in cache after next directory lookup. On reading the file, contents from renamed file that is fetched into the cache into the old file name, old file name always prevails in the cache. New file name can arrive at the cache with prefetch, in which case both names will co-exist and point to the same inode at home.
    Delete an existing file or subdirectory Reflects in the cache after next directory lookup Deleted upon the next file lookup
    Directory operation from cache Cache behavior - Normal directory Cache behavior - Local directory
    Directory revalidation Pulls the latest metadata Does not pull the latest metadata
    Read a non-local file in the directory Pulls the latest data Pulls the latest data
    Prefetch a non-local file Prefetches the latest data Prefetches the latest data
    Create a file or directory Updates and marks the directory local Updates the local directory
    Change data of a non-local file Pulls the data into the cache, updates the file and marks file as local Pulls the data into the cache, updates the file and marks the file as local
    Change metadata of a non-local file except delete of EA Updates the file and marks the file as local Updates the file and marks the file as local
    Appending to, truncating, or writing to an uncached file in LU mode fetches the entire file to the cache before making the change locally.

    If you expect revalidation, change the LU fileset root directory with caution as this might cause the fileset to be marked as local, and context with the home is lost. For example, running chmod or chown of the LU fileset root directory causes all sub directories from fileset root to be out of synchronization with the home.

  4. Independent writer (IW)

    The following figure illustrates the Independent writer mode.

    Figure 4. Independent writer mode
    Independent writer mode
    This mode allows multiple cache filesets to point to the same home. There is no synchronous locking between clusters while updating home. Each cache reads from home and makes updates to the home independently of each other, based on the revalidation intervals and asynchronous delay.

    This mode is used to access different files from each IW cache site, such as, the unique users at each site updating files in their home directory. While this mode allows multiple cache clusters to modify the same set of files, this should be only done by advanced users. This is because there is no locking or ordering between updates. Updates are propagated to the home in an asynchronous manner and can be delayed due to network disconnections. Therefore, conflicting updates from multiple cache sites can cause the data at the home site to be undetermined.

    Writing in-place on a pre-existing uncached file at the home pulls the complete contents of the file into cache. However, truncate and append operations on an uncached file do not fetch the contents of the file into cache, but queues the truncate and append operations to home.

    When many IW cache filesets point to the same NFS home, the number of NFS threads at home can be tuned for better efficiency. Increasing the revalidation intervals for the IW cache filesets might reduce the frequency of periodic refreshes from home and improve cache performance.

    Note: Do not create hard links at home or in the cache when IW is used, as IW failback does not preserve hard links.

The following file attributes are maintained locally in cache: Control attributes, direct I/O, replication factors, fileset quotas, storage pool flags, special file types such as FIFO, socket, block, character device. Hard links can be created at cache. Hard links at home are displayed as individual files in cache.