[PATCH] Useless inode semaphore locking in 2.4.0-test8

From: Eric PAIRE (eric.paire@ri.silicomp.fr)
Date: Fri Sep 15 2000 - 07:00:38 EST


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/



This archive was generated by hypermail 2b29 : Fri Sep 15 2000 - 21:00:25 EST