[patch-2.3.41-pre4] small optimization of access(2)

Tigran Aivazian tigran en sco.COM
Vie Ene 28 08:19:59 CST 2000


Hi,

This patch reduces the length of holding kernel lock and removes one extra
initialization and a goto label from sys_access() and uses if(mode &
~mask) instead of if(mode != (mode&mask)).

A copy on:
  
  http://www.ocston.org/~tigran/patches/access-2.3.41-p4.patch

Regards,
------
Tigran A. Aivazian           | http://www.sco.com
Escalations Research Group   | tel: +44-(0)1923-813796
Santa Cruz Operation Ltd     | http://www.ocston.org/~tigran

--- open.c.0	Thu Jan 27 16:53:25 2000
+++ open.c	Fri Jan 28 07:38:30 2000
@@ -306,11 +306,12 @@
 	struct dentry * dentry;
 	int old_fsuid, old_fsgid;
 	kernel_cap_t old_cap;
-	int res = -EINVAL;
+	int res;
+
+	if (mode & ~S_IRWXO)	/* where's F_OK, X_OK, W_OK, R_OK? */
+		return -EINVAL;
 
 	lock_kernel();
-	if (mode != (mode & S_IRWXO))	/* where's F_OK, X_OK, W_OK, R_OK? */
-		goto out;
 	old_fsuid = current->fsuid;
 	old_fsgid = current->fsgid;
 	old_cap = current->cap_effective;
@@ -337,7 +338,7 @@
 	current->fsuid = old_fsuid;
 	current->fsgid = old_fsgid;
 	current->cap_effective = old_cap;
-out:
+
 	unlock_kernel();
 	return res;
 }


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda