Ocfs2: Add new OCFS2_IOC_INFO ioctl for ocfs2 v8.
authorTristan Ye <tristan.ye@oracle.com>
Sat, 22 May 2010 08:26:33 +0000 (16:26 +0800)
committerJoel Becker <joel.becker@oracle.com>
Fri, 10 Sep 2010 15:35:41 +0000 (08:35 -0700)
commitddee5cdb70e6f87de2fc696b87bd7bd184a51eb8
tree27f182376ae5bc696648cc2696f5e5e7442a11fd
parent152831be91dfe864e06c3b3ff2bf994e04df4cdf
Ocfs2: Add new OCFS2_IOC_INFO ioctl for ocfs2 v8.

The reason why we need this ioctl is to offer the none-privileged
end-user a possibility to get filesys info gathering.

We use OCFS2_IOC_INFO to manipulate the new ioctl, userspace passes a
structure to kernel containing an array of request pointers and request
count, such as,

* From userspace:

struct ocfs2_info_blocksize oib = {
        .ib_req = {
                .ir_magic = OCFS2_INFO_MAGIC,
                .ir_code = OCFS2_INFO_BLOCKSIZE,
                ...
        }
        ...
}

struct ocfs2_info_clustersize oic = {
        ...
}

uint64_t reqs[2] = {(unsigned long)&oib,
                    (unsigned long)&oic};

struct ocfs2_info info = {
        .oi_requests = reqs,
        .oi_count = 2,
}

ret = ioctl(fd, OCFS2_IOC_INFO, &info);

* In kernel:

Get the request pointers from *info*, then handle each request one bye one.

Idea here is to make the spearated request small enough to guarantee
a better backward&forward compatibility since a small piece of request
would be less likely to be broken if filesys on raw disk get changed.

Currently, the following 7 requests are supported per the requirement from
userspace tool o2info, and I believe it will grow over time:-)

        OCFS2_INFO_CLUSTERSIZE
        OCFS2_INFO_BLOCKSIZE
        OCFS2_INFO_MAXSLOTS
        OCFS2_INFO_LABEL
        OCFS2_INFO_UUID
        OCFS2_INFO_FS_FEATURES
        OCFS2_INFO_JOURNAL_SIZE

This ioctl is only specific to OCFS2.

Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
fs/ocfs2/ioctl.c
fs/ocfs2/ocfs2_ioctl.h