lkml.org 
[lkml]   [2000]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH] Useless inode semaphore locking in 2.4.0-test8
Date
Hi,

In open.c:do_truncate(), the call to notify_change() is protected by
the inode->i_sem, which seems to me useless, and thus can be removed.
BTW, I also removed the useless inode pointer and error local variables.

Comments ?
-Eric
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ Eric PAIRE
Web : http://www.ri.silicomp.com/~paire | Groupe SILICOMP - Research Institute
Email: eric.paire@ri.silicomp.com | 2, avenue de Vignate
Phone: +33 (0) 476 63 48 71 | F-38610 Gieres
Fax : +33 (0) 476 51 05 32 | FRANCE

*** linux-2.4.0-test8/fs/open.c Sat Aug 12 00:16:21 2000
--- /tmp/open.c Fri Sep 15 13:34:21 2000
***************
*** 68,87 ****

int do_truncate(struct dentry *dentry, loff_t length)
{
- struct inode *inode = dentry->d_inode;
- int error;
struct iattr newattrs;

/* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
if (length < 0)
return -EINVAL;

- down(&inode->i_sem);
newattrs.ia_size = length;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
! error = notify_change(dentry, &newattrs);
! up(&inode->i_sem);
! return error;
}

static inline long do_sys_truncate(const char * path, loff_t length)
--- 68,82 ----

int do_truncate(struct dentry *dentry, loff_t length)
{
struct iattr newattrs;

/* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
if (length < 0)
return -EINVAL;

newattrs.ia_size = length;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
! return notify_change(dentry, &newattrs);
}

static inline long do_sys_truncate(const char * path, loff_t length)

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

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.098 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site