public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* How to feel the real time feature of XFS from userspace
@ 2013-11-09  5:23 harryxiyou
  2013-11-09  7:59 ` Jeff Liu
  0 siblings, 1 reply; 8+ messages in thread
From: harryxiyou @ 2013-11-09  5:23 UTC (permalink / raw)
  To: xfs; +Cc: zwu.kernel

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.


-- 
Thanks
Weiwei  Jia (Harry Wei)

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to feel the real time feature of XFS from userspace
  2013-11-09  5:23 How to feel the real time feature of XFS from userspace harryxiyou
@ 2013-11-09  7:59 ` Jeff Liu
  2013-11-09  9:24   ` harryxiyou
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jeff Liu @ 2013-11-09  7:59 UTC (permalink / raw)
  To: harryxiyou; +Cc: zwu.kernel, xfs

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to feel the real time feature of XFS from userspace
  2013-11-09  7:59 ` Jeff Liu
@ 2013-11-09  9:24   ` harryxiyou
  2013-11-09 10:13     ` Jeff Liu
  2013-11-09  9:31   ` Stan Hoeppner
  2013-11-09 12:04   ` Martin Steigerwald
  2 siblings, 1 reply; 8+ messages in thread
From: harryxiyou @ 2013-11-09  9:24 UTC (permalink / raw)
  To: Jeff Liu; +Cc: Zhi Yong Wu, xfs

On Sat, Nov 9, 2013 at 3:59 PM, Jeff Liu <jeff.liu@oracle.com> wrote:

Hi Jeff Liu,

Thanks for your reply ;-)

> 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);
> ...

Yeah, it's right. I have mounted as you said and changed my codes as follows.

#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>

#define F_PATH "./rtxfs.txt"
#define EXTSIZE (0x00001000U)

int main(int argc, char **argv) {
int fd;
int ret = 0;
struct fsxattr fsxattr;

fd = open(F_PATH, O_RDWR|O_CREAT, 0666);
if (fd < 0) {
fprintf(stderr, "open error!\n");
return -1;
}
fsxattr.fsx_xflags = XFS_XFLAG_REALTIME;
fsxattr.fsx_extsize = EXTSIZE;
if (xfsctl(F_PATH, fd, XFS_IOC_FSSETXATTR, &fsxattr)) {
fprintf(stderr, "Set XFS attributes error!\n");
ret = -1;
goto out;
}
out:
close(fd);
return ret;
}

>
> I would suggest you take a look at the source of xfs_rctp(8) at xfsprogs to get
> more info.

xfs_rtcp really helps me a lot.

>
> BTW, I remember Dave once mentioned that the realtime feature on Linux is not widely
> tested and not recommended for production use.
>

However, I am wondering, now, I have created a XFS real-time file
named "rtfs.txt" and how I
could do some real-time stuffs on this file, which is different from
other common files.



-- 
Thanks
Weiwei  Jia (Harry Wei)

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to feel the real time feature of XFS from userspace
  2013-11-09  7:59 ` Jeff Liu
  2013-11-09  9:24   ` harryxiyou
@ 2013-11-09  9:31   ` Stan Hoeppner
  2013-11-09 12:04   ` Martin Steigerwald
  2 siblings, 0 replies; 8+ messages in thread
From: Stan Hoeppner @ 2013-11-09  9:31 UTC (permalink / raw)
  To: Jeff Liu, harryxiyou; +Cc: zwu.kernel, xfs

On 11/9/2013 1:59 AM, Jeff Liu wrote:
> On 11/09/2013 01:23 PM, harryxiyou wrote:

> BTW, I remember Dave once mentioned that the realtime feature on Linux is not widely
> tested and not recommended for production use.

He's mentioned this fact many times.  He's also mentioned the fact that
the name "realtime device" is quite misleading.

-- 
Stan

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to feel the real time feature of XFS from userspace
  2013-11-09  9:24   ` harryxiyou
@ 2013-11-09 10:13     ` Jeff Liu
  2013-11-09 11:44       ` harryxiyou
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Liu @ 2013-11-09 10:13 UTC (permalink / raw)
  To: harryxiyou; +Cc: Zhi Yong Wu, xfs

Hi Harry,

On Sat, Nov 9, 2013 at 17: 24 PM, harryxiyou wrote:
> On Sat, Nov 9, 2013 at 3:59 PM, Jeff Liu <jeff.liu@oracle.com> wrote:
>
> Hi Jeff Liu,
>
> Thanks for your reply ;-)
>
>> 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);
>> ...
> Yeah, it's right. I have mounted as you said and changed my codes as follows.
>
> #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>
>
> #define F_PATH "./rtxfs.txt"
> #define EXTSIZE (0x00001000U)
>
> int main(int argc, char **argv) {
> int fd;
> int ret = 0;
> struct fsxattr fsxattr;
>
> fd = open(F_PATH, O_RDWR|O_CREAT, 0666);
> if (fd < 0) {
> fprintf(stderr, "open error!\n");
> return -1;
> }
> fsxattr.fsx_xflags = XFS_XFLAG_REALTIME;
> fsxattr.fsx_extsize = EXTSIZE;
> if (xfsctl(F_PATH, fd, XFS_IOC_FSSETXATTR, &fsxattr)) {
> fprintf(stderr, "Set XFS attributes error!\n");
> ret = -1;
> goto out;
> }
> out:
> close(fd);
> return ret;
> }
>
>> I would suggest you take a look at the source of xfs_rctp(8) at xfsprogs to get
>> more info.
> xfs_rtcp really helps me a lot.
>
>> BTW, I remember Dave once mentioned that the realtime feature on Linux is not widely
>> tested and not recommended for production use.
>>
> However, I am wondering, now, I have created a XFS real-time file
> named "rtfs.txt" and how I
> could do some real-time stuffs on this file, which is different from
> other common files.
As this inode has been marked to realtime, the subsequent write via
directIO will allocate
extents via it's specific allocation algorithm rather than the general
approach, and the
extent length is specified with fsx_extsize.
AFAICS, the realtime file data will be allocated on realtime volume
while the metadata will
still be allocated from the data volume.


Thanks,
-Jeff

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to feel the real time feature of XFS from userspace
  2013-11-09 10:13     ` Jeff Liu
@ 2013-11-09 11:44       ` harryxiyou
  0 siblings, 0 replies; 8+ messages in thread
From: harryxiyou @ 2013-11-09 11:44 UTC (permalink / raw)
  To: Jeff Liu; +Cc: Zhi Yong Wu, xfs

On Sat, Nov 9, 2013 at 6:13 PM, Jeff Liu <jeff.liu@oracle.com> wrote:
> Hi Harry,

Hi Jeff,

> As this inode has been marked to realtime, the subsequent write via
> directIO will allocate
> extents via it's specific allocation algorithm rather than the general
> approach, and the
> extent length is specified with fsx_extsize.
> AFAICS, the realtime file data will be allocated on realtime volume
> while the metadata will
> still be allocated from the data volume.
>

I see. However, I think current real-time feature of XFS should be enhanced
and could write/read specific data during specific time interval. I have no
exact ideas about this. I would do if I could. Anyway, thanks for your replies.

-- 
Thanks
Weiwei  Jia (Harry Wei)

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to feel the real time feature of XFS from userspace
  2013-11-09  7:59 ` Jeff Liu
  2013-11-09  9:24   ` harryxiyou
  2013-11-09  9:31   ` Stan Hoeppner
@ 2013-11-09 12:04   ` Martin Steigerwald
  2013-11-09 18:24     ` Emmanuel Florac
  2 siblings, 1 reply; 8+ messages in thread
From: Martin Steigerwald @ 2013-11-09 12:04 UTC (permalink / raw)
  To: xfs

Am Samstag, 9. November 2013, 15:59:37 schrieb Jeff Liu:
> 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.

Well, this sounds scary, except from xfs_rtcp(8):

CAVEATS
       Currently,  realtime  partitions  are not supported
       under the Linux version of XFS, and use of a  real‐
       time  partition  WILL  CAUSE CORRUPTION on the data
       partition. As such, this command is made  available
       for curious DEVELOPERS ONLY at this point in time.

Especially the corruption part of it.

Whats the current state? Would be interested to know it due to the Linux 
Performance Analysis & Tuning courses I hold.

Ciao,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to feel the real time feature of XFS from userspace
  2013-11-09 12:04   ` Martin Steigerwald
@ 2013-11-09 18:24     ` Emmanuel Florac
  0 siblings, 0 replies; 8+ messages in thread
From: Emmanuel Florac @ 2013-11-09 18:24 UTC (permalink / raw)
  To: Martin Steigerwald; +Cc: xfs

Le Sat, 09 Nov 2013 13:04:54 +0100 vous écriviez:

> Especially the corruption part of it.
> 
> Whats the current state? Would be interested to know it due to the
> Linux Performance Analysis & Tuning courses I hold.

My general feeling is  that the RT part is there to ensure
back-compatibility with RT devices coming from Irix, and that's about
it: mount your old Irix drive and get the data off it.

-- 
------------------------------------------------------------------------
Emmanuel Florac     |   Direction technique
                    |   Intellique
                    |	<eflorac@intellique.com>
                    |   +33 1 78 94 84 02
------------------------------------------------------------------------

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-11-09 18:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-09  5:23 How to feel the real time feature of XFS from userspace harryxiyou
2013-11-09  7:59 ` Jeff Liu
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox