Chinaunix首页 | 论坛 | 博客
  • 博客访问: 804777
  • 博文数量: 127
  • 博客积分: 2669
  • 博客等级: 少校
  • 技术积分: 1680
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-23 11:39
文章分类

全部博文(127)

文章存档

2014年(5)

2013年(19)

2012年(25)

2011年(9)

2010年(25)

2009年(44)

分类: LINUX

2012-08-27 10:33:52



    Real-time sub-volume

    Real-time sub-volumes are generally used for data applications such as video where guaranteed response time is paramount.

    Sub-volumes facilitate separation of different data types. For example, user data could be prevented from overwriting filesystem log data. Sub-volumes also enable filesystem data and user data to be configured to meet goals for performance and reliability by putting sub-volumes on different disk drives - particularly useful for separating out real-time data for guaranteed rate I/O operations. Each sub-volume can also be optimally sized and organized independently. For example, the log sub-volume can be plexed (mirrored) for fault tolerance and the real-time sub-volume can be striped across a large number of disks to give maximum throughput for video playback.

    Each sub-volume is made of partitions (real, physical regions of disk blocks) composed by concatenation, plexing (mirroring), and striping. The volume manager is responsible for translating logical addresses in the linear address spaces into real disk addresses from the partitions. Where there are multiple copies of a logical block (plexing), the volume manager writes simultaneously to all copies, and reads from any copy (since all copies are identical). The volume manager maintains the equality of plexes across crashes and both temporary and permanent disk failures. Single block failures in the plexed volumes are masked by the volume manager performing retries and rewrites.


代码示例

#include
#include
#include

#include

#define DIE(X)  do { perror(X); goto EXIT_FAIL; } while(0)

int main(void)
{
        struct fsxattr attrib;
        const char *xfs_filename="/opt/public/Read Me.txt";
        int fd=open(xfs_filename, O_RDONLY);

        if(fd < 0)
                DIE("Couldn't open file");
        // Get extended attributes for file
        if(xfsctl(xfs_filename, fd, XFS_IOC_FSGETXATTR, &attrib) != 0)
                DIE("Couldn't read attributes");

        // Set the realtime status bit
        attrib.fsx_xflags |= XFS_XFLAG_REALTIME;

        // Attempt to set these attributes on the file
        if(xfsctl(xfs_filename, fd, XFS_IOC_FSSETXATTR, &attrib) != 0)
                DIE("Couldn't set attributes");

        close(fd);
        return(0);
EXIT_FAIL:
        if(fd >= 0) close(fd);
        return(1);
}
阅读(2268) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~