aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 12:41:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 12:41:18 -0400
commitc4eb1b07303ad9e00aba842aa90d5521293ac857 (patch)
tree114afde9e414e8bc1e069ea1e5226103c53ac305 /fs/gfs2/dir.c
parent9e239bb93914e1c832d54161c7f8f398d0c914ab (diff)
parenta01aedfe21637c965a7046271fedfdd681eba646 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw
Pull GFS2 updates from Steven Whitehouse: "There are a few bug fixes for various, mostly very minor corner cases, plus some interesting new features. The new features include atomic_open whose main benefit will be the reduction in locking overhead in case of combined lookup/create and open operations, sorting the log buffer lists by block number to improve the efficiency of AIL writeback, and aggressively issuing revokes in gfs2_log_flush to reduce overhead when dropping glocks." * git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw: GFS2: Reserve journal space for quota change in do_grow GFS2: Fix fstrim boundary conditions GFS2: fix warning message GFS2: aggressively issue revokes in gfs2_log_flush GFS2: fix regression in dir_double_exhash GFS2: Add atomic_open support GFS2: Only do one directory search on create GFS2: fix error propagation in init_threads() GFS2: Remove no-op wrapper function GFS2: Cocci spatch "ptr_ret.spatch" GFS2: Eliminate gfs2_rg_lops GFS2: Sort buffer lists by inplace block number
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index e0449c10286a..0cb4c1557f20 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1125,13 +1125,14 @@ static int dir_double_exhash(struct gfs2_inode *dip)
1125 if (IS_ERR(hc)) 1125 if (IS_ERR(hc))
1126 return PTR_ERR(hc); 1126 return PTR_ERR(hc);
1127 1127
1128 h = hc2 = kmalloc(hsize_bytes * 2, GFP_NOFS | __GFP_NOWARN); 1128 hc2 = kmalloc(hsize_bytes * 2, GFP_NOFS | __GFP_NOWARN);
1129 if (hc2 == NULL) 1129 if (hc2 == NULL)
1130 hc2 = __vmalloc(hsize_bytes * 2, GFP_NOFS, PAGE_KERNEL); 1130 hc2 = __vmalloc(hsize_bytes * 2, GFP_NOFS, PAGE_KERNEL);
1131 1131
1132 if (!hc2) 1132 if (!hc2)
1133 return -ENOMEM; 1133 return -ENOMEM;
1134 1134
1135 h = hc2;
1135 error = gfs2_meta_inode_buffer(dip, &dibh); 1136 error = gfs2_meta_inode_buffer(dip, &dibh);
1136 if (error) 1137 if (error)
1137 goto out_kfree; 1138 goto out_kfree;
@@ -1547,9 +1548,9 @@ out:
1547 1548
1548/** 1549/**
1549 * gfs2_dir_search - Search a directory 1550 * gfs2_dir_search - Search a directory
1550 * @dip: The GFS2 inode 1551 * @dip: The GFS2 dir inode
1551 * @filename: 1552 * @name: The name we are looking up
1552 * @inode: 1553 * @fail_on_exist: Fail if the name exists rather than looking it up
1553 * 1554 *
1554 * This routine searches a directory for a file or another directory. 1555 * This routine searches a directory for a file or another directory.
1555 * Assumes a glock is held on dip. 1556 * Assumes a glock is held on dip.
@@ -1557,22 +1558,25 @@ out:
1557 * Returns: errno 1558 * Returns: errno
1558 */ 1559 */
1559 1560
1560struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name) 1561struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name,
1562 bool fail_on_exist)
1561{ 1563{
1562 struct buffer_head *bh; 1564 struct buffer_head *bh;
1563 struct gfs2_dirent *dent; 1565 struct gfs2_dirent *dent;
1564 struct inode *inode; 1566 u64 addr, formal_ino;
1567 u16 dtype;
1565 1568
1566 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); 1569 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh);
1567 if (dent) { 1570 if (dent) {
1568 if (IS_ERR(dent)) 1571 if (IS_ERR(dent))
1569 return ERR_CAST(dent); 1572 return ERR_CAST(dent);
1570 inode = gfs2_inode_lookup(dir->i_sb, 1573 dtype = be16_to_cpu(dent->de_type);
1571 be16_to_cpu(dent->de_type), 1574 addr = be64_to_cpu(dent->de_inum.no_addr);
1572 be64_to_cpu(dent->de_inum.no_addr), 1575 formal_ino = be64_to_cpu(dent->de_inum.no_formal_ino);
1573 be64_to_cpu(dent->de_inum.no_formal_ino), 0);
1574 brelse(bh); 1576 brelse(bh);
1575 return inode; 1577 if (fail_on_exist)
1578 return ERR_PTR(-EEXIST);
1579 return gfs2_inode_lookup(dir->i_sb, dtype, addr, formal_ino, 0);
1576 } 1580 }
1577 return ERR_PTR(-ENOENT); 1581 return ERR_PTR(-ENOENT);
1578} 1582}