From: Jeff Liu <jeff.liu@oracle.com>
To: harryxiyou <harryxiyou@gmail.com>
Cc: zwu.kernel@gmail.com, xfs@oss.sgi.com
Subject: Re: How to feel the real time feature of XFS from userspace
Date: Sat, 09 Nov 2013 15:59:37 +0800 [thread overview]
Message-ID: <527DEB69.8050502@oracle.com> (raw)
In-Reply-To: <CAD+1EGPf=ddMP4vdDxkkWnJH2q9fCSa5uTT-eRAxYLAEtPrLwg@mail.gmail.com>
On 11/09/2013 01:23 PM, harryxiyou wrote:
> Hi all,
>
> I have format block device with XFS as follows.
>
> root@node2:~# mkfs.xfs -f -r rtdev=/dev/sda3 /dev/sda4
>
> meta-data=/dev/sda4 isize=256 agcount=4, agsize=56122440 blks
>
> = sectsz=512 attr=2, projid32bit=0
>
> data = bsize=4096 blocks=224489757, imaxpct=25
>
> = sunit=0 swidth=0 blks
>
> naming =version 2 bsize=4096 ascii-ci=0
>
> log =internal log bsize=4096 blocks=109614, version=2
>
> = sectsz=512 sunit=0 blks, lazy-count=1
>
> realtime =/dev/sda3 extsz=4096 blocks=14865657,
> rtextents=14865657
>
>
> And I also write user-space codes as follows.
>
> root@node2:~/test# cat xfs.c
> #include <stdio.h>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <xfs/xfs.h>
> #include <xfs/xfs_fs.h>
>
> int main(int argc, char **argv) {
> int fd;
> int xfs_ret = 0;
>
> fd = open("./1", O_RDWR);
> if (fd < 0) {
> fprintf(stderr, "open error!\n");
> return -1;
> }
> xfs_ret = xfsctl("./1", fd, XFS_IOC_FSGETXATTR, NULL);
>
> return 0;
> }
>
>
> Now, I am wondering how to feel the real time feature of XFS from userspace?
> Could anyone please give me some suggestions? Thanks in advance.
Mount your realtime device at first:
mount -o rtdev=/dev/sda3 /dev/sda4 /mount_point
Then you need to mark the attribute bit set with XFS_XFLAG_REALTIME via xfsctl(3)
after file creation before writing any data to the file, hence your demo code
would looks like:
struct fsxattr attr;
attr.fsx_xflags |= XFS_XFLAG_REALTIME;
xfs_ret = xfsctl(target_file_path, fd, XFS_IOC_FSSETXATTR, &attr);
...
I would suggest you take a look at the source of xfs_rctp(8) at xfsprogs to get
more info.
BTW, I remember Dave once mentioned that the realtime feature on Linux is not widely
tested and not recommended for production use.
Thanks,
-Jeff
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-11-09 7:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-09 5:23 How to feel the real time feature of XFS from userspace harryxiyou
2013-11-09 7:59 ` Jeff Liu [this message]
2013-11-09 9:24 ` harryxiyou
2013-11-09 10:13 ` Jeff Liu
2013-11-09 11:44 ` harryxiyou
2013-11-09 9:31 ` Stan Hoeppner
2013-11-09 12:04 ` Martin Steigerwald
2013-11-09 18:24 ` Emmanuel Florac
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=527DEB69.8050502@oracle.com \
--to=jeff.liu@oracle.com \
--cc=harryxiyou@gmail.com \
--cc=xfs@oss.sgi.com \
--cc=zwu.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox