[lkml]   [2004]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: performance of filesystem xattrs with Samba4
On Nov 19, 2004  22:43 +1100, wrote:
> > This patch also provides the infrastructure on disk for storing e.g.
> > nsecond and create timestamps in the ext3 large inodes, but the actual
> > implementation to save/load these isn't there yet. If that were
> > available, would you use it instead of explicitly storing the NTTIME in
> > an EA?
> certainly!

I can describe the "infrastructure" here, but there needs to be some
smallish coding work in order to get this working and I don't really
have much time to do that myself. The basic premise is that for ext3
filesystems formatted with large on-disk inodes we have reserved the first
word in the extra space to describe the "extra size" of the fixed fields
in struct ext3_inode stored in each inode on disk. This allows us to
add permanent fields to the end of struct ext3_inode, and any remaining
space is used for the fast EAs before falling back to an external block.

This space was always intended to store extra timestamp fields ala:

struct ext3_inode {
} osd2;
__u16 i_extra_isize;
__u16 i_pad1;
__u32 i_ctime_hilow; /* do we need nsecond atimes? */
__u32 i_mtime_hilow;
__u32 i_crtime;
__u32 i_crtime_hilow;

Since the i_[mac]time fields are in seconds, I would like to store:

_hilow = nseconds >> 6 | (([mac]time64 >> 32) << 26)

[mac]time64 = [mac]time | (__u64)((_hilow & 0xfc000000) << 6);
nseconds = _hilow << 6;

so we get about 60ns resolution but also increase our dynamic range
by a factor of 64 (year 8704 problem here we come ;-). Since crtime
is new we _could_ store it in the 100ns 64-bit format that NT uses.
Consistency is good on the one hand and we only need to do shift and OR,
while with straight 100ns times we also get a 6x larger dynamic range
(y58000) but also have to do a 64-bit divide by 10^7 for each access.

As we read an inode from disk we check i_extra_isize to determine
which fields, if any, are valid and when writing the inode we fill in
the fields and update i_extra_isize (taking care to push any existing
EAs out a bit, though that should be a rare case). This avoids the EA
speed/size overhead to parse/read/write these fields, and allows us to
add new "fixed" fields into the large inode as necessary.

We don't touch any fields that we don't understand (normal ext3 compat
flags will tell us if there are incompatible features there).

So, in summary, the "i_extra_isize" handling is already there for inodes
(currently always set to '4') but we don't do anything with that space

> - store create_time and change_time in the user.DosAttrib xattr, as
> 64 bit 100ns resolution times (same format as NT uses and Samba
> uses internally). I store change_time there as its definition is a
> little different from the posix ctime field (plus its settable).
> If we had a settable create_time field in the inode then I'd certainly
> want to use it in Samba4. A non-settable one wouldn't be nearly as
> useful. Some win32 applications care about being able to set all the
> time fields (such as excel 2003).

Hmm, seems kind of counter-productive to allow a crtime that is settable...

> I think it would make more sense to have a new varient of utime() for
> setting all available timestamps, and expose all timestamps in stat. A
> separate API for create time seems a bit hackish.

By all means go for it ;-). I'm not particularly fond of the proposed
pseudo-EA interface. You are probably more likely than anyone to get
support for it.

> > I would just configure out the xattr sharing code entirely since it will
> > likely do nothing but increase overhead if any of the EAs on an inode
> > are unique (this is the most common case, except for POSIX-ACL-only setups).
> I didn't know it was configurable. I can't see any CONFIG option for
> it - is there some trick I've missed?

original 2.4 xattr patches, not sure if they've disappeared in 2.6 kernels.

Hmm, seems that the CONFIG_FS_MBCACHE option doesn't allow you to turn it
off completely, which is a shame since both are completely useless for any
EAs which are different for each inode and just introduce overhead. The
CONFIG_EXT[23]_FS_XATTR_SHARING options don't exist at all anymore.

Cheers, Andreas
Andreas Dilger

[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2005-03-22 14:08    [W:0.101 / U:5.192 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site