public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: performance of filesystem xattrs with Samba4
@ 2004-12-03 17:49 Steve French
  0 siblings, 0 replies; 39+ messages in thread
From: Steve French @ 2004-12-03 17:49 UTC (permalink / raw)
  To: aia21; +Cc: linux-kernel

Anton wrote
> I have been mulling over in my head for quite a while what 
> to do about an interface for "advanced ntfs features" but so far I have 
> always pushed this to the back of my mind.  After all no point in 
> providing advanced features considering we don't even provide full 
> read-write access yet.  I just thought I would mentione NTFS when I saw 
>
>But to answer your question I definitely would envisage an interface to 
>the kernel driver

The same issue has been on my mind for other filesystems too - since I 
can return similar information to NTFS.  The "easy" things
to return that could be useful to apps (including Samba4, but also 
backup apps etc.) include:

1) file creation time
2) "dos" attribute bits
3) perhaps ACL mapping into "POSIX ACL" (getfacl/setfacl's Linux xattr) 
format from the CIFS/NTFS style.
4) streams (which could be mapped in a few cases to xattrs, but are getting
increasingly used and therefore important for certain types of apps - like
network backup e.g. to be able to get access to)

The first two are in the on disk format already of various filesytems (NTFS, VFAT, even JFS, and would be trivial 
for me to export in the cifs vfs.  I suspect NFSv4 which is similar to CIFS in many ways would also have
an easy time of exporting a few of those.   The first two of these could of course be simply special casings
the reserved xattr name "User.DosAttribute" or equivalent used by Samba4.  This has a few advantages - local apps work 
and migrations to Linux from Windows are easier (as more data is preserved)  :)

Note that NTFS now has a form of symlink stored in "OS/2 EAs" on disk (I see them show up on test systems 
when the Unix Services are loaded) as well as Unix like devices - very strange but potentially could 
be mapped into something that made sense to Linux.



^ permalink raw reply	[flat|nested] 39+ messages in thread
* [PATCH] Re: idr in Samba4
@ 2004-10-21 18:32 Jim Houston
  2004-11-19  7:38 ` performance of filesystem xattrs with Samba4 tridge
  0 siblings, 1 reply; 39+ messages in thread
From: Jim Houston @ 2004-10-21 18:32 UTC (permalink / raw)
  To: tridge, Andrew Morton; +Cc: linux-kernel

On Thu, 2004-10-21 at 00:54, tridge@samba.org wrote:

> Apart from converting idr to use our pool allocator, and some other
> minor user-space tweaks, the only significant change I've made is to
> add a idr_find() call at the top of idr_remove() to catch possible
> errors where idr_remove() is called multiple times. Obviously this is
> programmer error if it happens, but I didn't like the default
> behaviour (I saw corruption in the tree without this check).


Hi Tridge, Andrew,

Tridge, thanks for your note.  I'm glad to hear you are using idr.c.

I agree with your concerns about idr_remove().  It really should
fail gracefully and warn if the id being removed is not valid.

The attached patch against linux-2.6.9 should do the job without
additional overhead.  Andrew, I hope you will add this patch to
your tree.

With the existing code, removing an id which was not allocated
could remove a valid id which shares the same lowest layer of the 
radix tree.

I ran a kernel with this patch but have not done any tests to force
a failure.

Jim Houston - Concurrent Computer Corp.


--- linux-2.6.9/lib/idr.c.orig	2004-10-21 12:57:24.547106092 -0400
+++ linux-2.6.9/lib/idr.c	2004-10-21 13:09:28.984974796 -0400
@@ -277,24 +277,31 @@
 }
 EXPORT_SYMBOL(idr_get_new);
 
+static void idr_remove_warning(int id)
+{
+	printk("idr_remove called for id=%d which is not allocated.\n", id);
+	dump_stack();
+}
+
 static void sub_remove(struct idr *idp, int shift, int id)
 {
 	struct idr_layer *p = idp->top;
 	struct idr_layer **pa[MAX_LEVEL];
 	struct idr_layer ***paa = &pa[0];
+	int n;
 
 	*paa = NULL;
 	*++paa = &idp->top;
 
 	while ((shift > 0) && p) {
-		int n = (id >> shift) & IDR_MASK;
+		n = (id >> shift) & IDR_MASK;
 		__clear_bit(n, &p->bitmap);
 		*++paa = &p->ary[n];
 		p = p->ary[n];
 		shift -= IDR_BITS;
 	}
-	if (likely(p != NULL)){
-		int n = id & IDR_MASK;
+	n = id & IDR_MASK;
+	if (likely(p != NULL && test_bit(n, &p->bitmap))){
 		__clear_bit(n, &p->bitmap);
 		p->ary[n] = NULL;
 		while(*paa && ! --((**paa)->count)){
@@ -303,6 +310,8 @@
 		}
 		if ( ! *paa )
 			idp->layers = 0;
+	} else {
+		idr_remove_warning(id);
 	}
 }
 





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

end of thread, other threads:[~2004-12-03 17:50 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-03 17:49 performance of filesystem xattrs with Samba4 Steve French
  -- strict thread matches above, loose matches on Subject: below --
2004-10-21 18:32 [PATCH] Re: idr in Samba4 Jim Houston
2004-11-19  7:38 ` performance of filesystem xattrs with Samba4 tridge
2004-11-19  8:08   ` James Morris
2004-11-19 10:16   ` Andreas Dilger
2004-11-19 11:43     ` tridge
2004-11-19 22:28       ` Andreas Dilger
2004-11-22 13:02     ` tridge
2004-11-22 21:40       ` Andreas Dilger
2004-11-19 12:03   ` Anton Altaparmakov
2004-11-19 12:43     ` tridge
2004-11-19 14:11       ` Anton Altaparmakov
2004-11-20 10:44         ` tridge
2004-11-20 16:20           ` Hans Reiser
2004-11-20 23:29             ` tridge
2004-11-19 15:34   ` Hans Reiser
2004-11-19 15:58     ` Jan Engelhardt
2004-11-19 22:03     ` tridge
2004-11-20  4:51       ` Hans Reiser
2004-11-19 23:01     ` tridge
2004-11-20  0:26       ` Andrew Morton
2004-11-21  1:14         ` tridge
2004-11-21  2:12         ` tridge
2004-11-21 23:53         ` tridge
2004-11-23  9:37         ` tridge
2004-11-23 17:55           ` Andreas Dilger
2004-11-24  7:53         ` tridge
2004-11-20  4:40       ` Hans Reiser
2004-11-20  6:47         ` tridge
2004-11-20 16:13           ` Hans Reiser
2004-11-20 23:16             ` tridge
2004-11-21  2:36               ` Hans Reiser
2004-11-21  0:21             ` tridge
2004-11-21  2:41               ` Hans Reiser
2004-11-21  1:53             ` tridge
2004-11-21  2:48               ` Hans Reiser
2004-11-21  3:19                 ` tridge
2004-11-21  6:11                   ` Hans Reiser
2004-11-21 22:21   ` Nathan Scott
2004-11-21 23:43     ` tridge

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