Skip to contentSkip to conversation

xattr namespace question

DISCUSSION Steven Whitehouse 5 participants 8 messages Mar 21, 2006 – Mar 23, 2006 VFS

lore
Share & tools
lore
#0 lore raw

Hi,

In order to remove the final ioctl() call in the GFS2 filesystem its been suggested that we use xattrs as a replacement interface. Mostly this is self-explanatory however there is one question that I've not been able to resolve 100% satisfactorily, which is what the namespace should look like.

We have a bunch of boolean flags, so (using the example of the journaled data flag) should our xattrs be called something along the lines of system.gfs2.jdata (this seems to be most popular suggestion amoung those I've asked privately), or perhaps system.fs.gfs2.jdata or indeed is the system namespace reserved for something special so that we should use a special gfs2 namespace instead?

I've googled around and read all I can find, but I've not been able to find a definitive answer to this question. Any pointers that you can give would be very helpful,

Thanks,

Steve.

#1 lore raw
Quoted 6 lines · Steven Whitehouse

In order to remove the final ioctl() call in the GFS2 filesystem its been suggested that we use xattrs as a replacement interface. Mostly this is self-explanatory however there is one question that I've not been able to resolve 100% satisfactorily, which is what the namespace should look like.

Quoted 6 lines

We have a bunch of boolean flags, so (using the example of the journaled data flag) should our xattrs be called something along the lines of system.gfs2.jdata (this seems to be most popular suggestion amoung those I've asked privately), or perhaps system.fs.gfs2.jdata or indeed is the system namespace reserved for something special so that we should use a special gfs2 namespace instead?

If your extra flags can be mapped onto the EXT2_IOC_GETFLAGS equivalent, then you may want to (also) consider that. This allows the flags to be got/set by lsattr and chattr, respectively, and have been in linux for ages. It also happens that ext2/ext3/reiserfs all share this same API.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

#2 lore raw
Quoted 9 lines · Andreas Dilger
Quoted 8 lines · Steven Whitehouse

In order to remove the final ioctl() call in the GFS2 filesystem its been suggested that we use xattrs as a replacement interface. Mostly this is self-explanatory however there is one question that I've not been able to resolve 100% satisfactorily, which is what the namespace should look like.

We have a bunch of boolean flags, so (using the example of the journaled data flag) should our xattrs be called something along the lines of

"boolean flags" sounds alot more like the lsattr/chattr inode flags as Andreas points out. There is already a data journalling (j) flag there too.

Quoted 4 lines
Quoted 4 lines

system.gfs2.jdata (this seems to be most popular suggestion amoung those I've asked privately), or perhaps system.fs.gfs2.jdata or indeed is the system namespace reserved for something special so that we should use a special gfs2 namespace instead?

The choice typically depends on what the permissions model for access to the attribute needs to be. See attr(5).

Quoted 4 lines

If your extra flags can be mapped onto the EXT2_IOC_GETFLAGS equivalent, then you may want to (also) consider that. This allows the flags to be got/set by lsattr and chattr, respectively, and have been in linux for ages. It also happens that ext2/ext3/reiserfs all share this same API.

And XFS, and hfsplus too from the look of it.

cheers.

Signature · 1 line
Nathan
#3 lore raw

Hi,

Quoted 8 lines · Nathan Scott
Quoted 7 lines · Andreas Dilger
Quoted 6 lines · Steven Whitehouse

In order to remove the final ioctl() call in the GFS2 filesystem its been suggested that we use xattrs as a replacement interface. Mostly this is self-explanatory however there is one question that I've not been able to resolve 100% satisfactorily, which is what the namespace should look like.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

We have a bunch of boolean flags, so (using the example of the journaled data flag) should our xattrs be called something along the lines of

"boolean flags" sounds alot more like the lsattr/chattr inode flags as Andreas points out. There is already a data journalling (j) flag there too.

Yes, and for flags which are supported by ext2/3 this seems a sensible route to take and I've already made a start to supporting that ioctl(). However there are still some other flags which don't fit in with the existing ext2 flags, so for those we'll have to look for a different method for those.

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

system.gfs2.jdata (this seems to be most popular suggestion amoung those I've asked privately), or perhaps system.fs.gfs2.jdata or indeed is the system namespace reserved for something special so that we should use a special gfs2 namespace instead?

The choice typically depends on what the permissions model for access to the attribute needs to be. See attr(5).

Well from that it would appear that system is the right namespace to choose. So the current plan is to make all the flags available via xattrs and those compatible with ext2, via the ext2 compatible ioctl() interface as well.

Thanks for the pointing me in the right direction,

Steve.

#4 lore raw
Quoted 5 lines · Steven Whitehouse

Yes, and for flags which are supported by ext2/3 this seems a sensible route to take and I've already made a start to supporting that ioctl(). However there are still some other flags which don't fit in with the existing ext2 flags, so for those we'll have to look for a different method for those.

there's flags only supported on xfs or jfs aswell, so adding new ones for gfs is fine. we'll need to make sure they don't overlap, though. I have long planned to have a common header for all flags and some shared utility code but never got to it.

#5 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 5 lines · Steven Whitehouse

Yes, and for flags which are supported by ext2/3 this seems a sensible route to take and I've already made a start to supporting that ioctl(). However there are still some other flags which don't fit in with the existing ext2 flags, so for those we'll have to look for a different method for those.

there's flags only supported on xfs or jfs aswell, so adding new ones for

re: JFS - yeah I thought that too, but yesterday looking at mainline there doesn't seem to be an ioctl handler in their file_operations struct...?

cheers.

Signature · 1 line
Nathan
#6 lore raw
Quoted 3 lines · Nathan Scott

re: JFS - yeah I thought that too, but yesterday looking at mainline there doesn't seem to be an ioctl handler in their file_operations struct...?

the patches are very recent, looks like they're not in mainline yet.

#7 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines · Nathan Scott

re: JFS - yeah I thought that too, but yesterday looking at mainline there doesn't seem to be an ioctl handler in their file_operations struct...?

the patches are very recent, looks like they're not in mainline yet.

Right. Very recent. They are in the mainline post-2.6.16, and have been in the last few -mm kernels (since 2.6.16-rc4-mm2)

Shagy

Signature · 2 lines
David Kleikamp
IBM Linux Technology Center