LLAPI_HSM_DATA_VERSION_SET(3)

NAME
llapi_hsm_data_version_set - set OST data version to HSM xattr

SYNOPSIS
#include <lustre/lustreapi.h>

int llapi_hsm_data_version_set(int fd, __u64 data_version);

DESCRIPTION
Update the file's data version and store it in the trusted.hsm xattr on the file after doing some file data migration operation that does not affect the data contents.

The data version is typically fetched via llapi_get_data_version(3), which should be referenced for details about data version.

fd  open file descriptor

data_version
    64-bit integer that contains the file data version.

RETURN VALUES
llapi_hsm_data_version_set() returns:

0   on success

<0  a negative errno value on failure

EXAMPLES
    	int fd_src;
    	__u64 dv1, dv2;

    	fd_src = open(filename, O_RDONLY);
    	rc = llapi_get_data_version(fd_src, &dv1, 0);
    	/* manage the file data - migrate, mirror, etc. */
    	rc = llapi_get_data_version(fd_src, &dv2, LL_DV_RD_FLUSH);
            close(fd_src);
    	if (dv1 == dv2)
    		llapi_hsm_data_version_set(fd_src, dv2);

AVAILABILITY
The llapi_hsm_data_version_set() API is part of the lustre(7) user application interface library since release 2.16.0.

SEE ALSO
lfs-data_version(1), lfs-migrate(1), llapi_fswap_layouts(3), llapi_fsync(3), llapi_hsm_data_version_set(3), lustre(7), lustreapi(7)