[OracleOSS] [TitleIndex] [WordIndex]

OCFS2/DesignDocs/StaticFile

OCFS2 static file support

Tiger Yang <tiger.yang@oracle.com>

October 2010

Introduction

A static file is a regular file with a frozen metadata/mapping. It does not allow any updates to its metadata. So do not allow link, unlink, rename, append, truncates, splice, xattr, mmap, reflink operations to this file. All these operations will fail with an EPERM. We can only read or write it with O_DIRECT. We do not need cluster lock when we read or write it, so we can get good performance.

Goals

Support two types static file, fixed metadata file and fixed mapping file. But by now, we only support fixed metadata file. For fixed metadata file, we can create or convert it by tunefs.ocfs2. For fixed mapping file, we can change attributes by char(1).

User interaction

fixed metadata file:

tunefs.ocfs2 --create-fixedmeta <name:size> <device>

tunefs.ocfs2 --toggle-fixedmeta <name> <device>

Implementation

1. ocfs2-tools part

Add two operations for creating or converting fixed metadata file. In create operation, create a new file with specified size and set the file attribute OCFS2_FIXEDMETA_FL. In convert operation, try to set or clear this flag of the specified file.

2. kernel module part

Checking attribute OCFS2_FIXEDMETA_FL at ocfs2_link, ocfs2_unlink, ocfs2_rename, ocfs2_setattr, ocfs2_mmap, if found this flag, return EPERM. Checking this flag when read or write file with O_DIRECT, if found OCFS2_FIXEDMETA_FL flag, skip to get the cluster lock.


2011-12-23 01:01