namei.c (6124a4e430b64d1577438c8648c59e996d02e73e) namei.c (60ad4466821a96913a9b567115e194ed1087c2d7)
1/*
2 * linux/fs/ext4/namei.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *

--- 275 unchanged lines hidden (view full) ---

284 {
285 if (show_names)
286 {
287 int len = de->name_len;
288 char *name = de->name;
289 while (len--) printk("%c", *name++);
290 ext4fs_dirhash(de->name, de->name_len, &h);
291 printk(":%x.%u ", h.hash,
1/*
2 * linux/fs/ext4/namei.c
3 *
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
8 *

--- 275 unchanged lines hidden (view full) ---

284 {
285 if (show_names)
286 {
287 int len = de->name_len;
288 char *name = de->name;
289 while (len--) printk("%c", *name++);
290 ext4fs_dirhash(de->name, de->name_len, &h);
291 printk(":%x.%u ", h.hash,
292 ((char *) de - base));
292 (unsigned) ((char *) de - base));
293 }
294 space += EXT4_DIR_REC_LEN(de->name_len);
295 names++;
296 }
297 de = ext4_next_entry(de, size);
298 }
299 printk("(%i)\n", names);
300 return (struct stats) { names, space, 1 };

--- 707 unchanged lines hidden (view full) ---

1008 dir->i_ino);
1009 *err = retval;
1010 goto errout;
1011 }
1012 } while (retval == 1);
1013
1014 *err = -ENOENT;
1015errout:
293 }
294 space += EXT4_DIR_REC_LEN(de->name_len);
295 names++;
296 }
297 de = ext4_next_entry(de, size);
298 }
299 printk("(%i)\n", names);
300 return (struct stats) { names, space, 1 };

--- 707 unchanged lines hidden (view full) ---

1008 dir->i_ino);
1009 *err = retval;
1010 goto errout;
1011 }
1012 } while (retval == 1);
1013
1014 *err = -ENOENT;
1015errout:
1016 dxtrace(printk(KERN_DEBUG "%s not found\n", name));
1016 dxtrace(printk(KERN_DEBUG "%s not found\n", d_name->name));
1017 dx_release (frames);
1018 return NULL;
1019}
1020
1021static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1022{
1023 struct inode *inode;
1024 struct ext4_dir_entry_2 *de;

--- 955 unchanged lines hidden (view full) ---

1980
1981 if (!ext4_handle_valid(handle))
1982 return 0;
1983
1984 mutex_lock(&EXT4_SB(sb)->s_orphan_lock);
1985 if (!list_empty(&EXT4_I(inode)->i_orphan))
1986 goto out_unlock;
1987
1017 dx_release (frames);
1018 return NULL;
1019}
1020
1021static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1022{
1023 struct inode *inode;
1024 struct ext4_dir_entry_2 *de;

--- 955 unchanged lines hidden (view full) ---

1980
1981 if (!ext4_handle_valid(handle))
1982 return 0;
1983
1984 mutex_lock(&EXT4_SB(sb)->s_orphan_lock);
1985 if (!list_empty(&EXT4_I(inode)->i_orphan))
1986 goto out_unlock;
1987
1988 /* Orphan handling is only valid for files with data blocks
1989 * being truncated, or files being unlinked. */
1990
1991 /* @@@ FIXME: Observation from aviro:
1992 * I think I can trigger J_ASSERT in ext4_orphan_add(). We block
1993 * here (on s_orphan_lock), so race with ext4_link() which might bump
1994 * ->i_nlink. For, say it, character device. Not a regular file,
1995 * not a directory, not a symlink and ->i_nlink > 0.
1996 *
1997 * tytso, 4/25/2009: I'm not sure how that could happen;
1998 * shouldn't the fs core protect us from these sort of
1999 * unlink()/link() races?
1988 /*
1989 * Orphan handling is only valid for files with data blocks
1990 * being truncated, or files being unlinked. Note that we either
1991 * hold i_mutex, or the inode can not be referenced from outside,
1992 * so i_nlink should not be bumped due to race
2000 */
2001 J_ASSERT((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
2002 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
2003
2004 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access");
2005 err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh);
2006 if (err)
2007 goto out_unlock;

--- 599 unchanged lines hidden ---
1993 */
1994 J_ASSERT((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1995 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
1996
1997 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access");
1998 err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh);
1999 if (err)
2000 goto out_unlock;

--- 599 unchanged lines hidden ---