aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2015-11-11 16:00:35 -0500
committerBob Peterson <rpeterso@redhat.com>2015-11-16 13:00:29 -0500
commitc8d577038449a718ad0027d1790b6ef4441715d4 (patch)
tree7ba2dd87040f008328b528e96ac99b88736188f7 /fs/gfs2/dir.c
parent3dd1dd8c696bdb7c8dcc9456cb23558ad1b336b8 (diff)
gfs2: Extended attribute readahead
When gfs2 allocates an inode and its extended attribute block next to each other at inode create time, the inode's directory entry indicates that in de_rahead. In that case, we can readahead the extended attribute block when we read in the inode. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index ad8a5b757cc7..c2486598fb87 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -108,7 +108,7 @@ static int gfs2_dir_get_existing_buffer(struct gfs2_inode *ip, u64 block,
108 struct buffer_head *bh; 108 struct buffer_head *bh;
109 int error; 109 int error;
110 110
111 error = gfs2_meta_read(ip->i_gl, block, DIO_WAIT, &bh); 111 error = gfs2_meta_read(ip->i_gl, block, DIO_WAIT, 0, &bh);
112 if (error) 112 if (error)
113 return error; 113 return error;
114 if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), bh, GFS2_METATYPE_JD)) { 114 if (gfs2_metatype_check(GFS2_SB(&ip->i_inode), bh, GFS2_METATYPE_JD)) {
@@ -305,7 +305,7 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, __be64 *buf,
305 BUG_ON(extlen < 1); 305 BUG_ON(extlen < 1);
306 bh = gfs2_meta_ra(ip->i_gl, dblock, extlen); 306 bh = gfs2_meta_ra(ip->i_gl, dblock, extlen);
307 } else { 307 } else {
308 error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, &bh); 308 error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, 0, &bh);
309 if (error) 309 if (error)
310 goto fail; 310 goto fail;
311 } 311 }
@@ -723,7 +723,7 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
723{ 723{
724 int error; 724 int error;
725 725
726 error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, bhp); 726 error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, 0, bhp);
727 if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) { 727 if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) {
728 /* pr_info("block num=%llu\n", leaf_no); */ 728 /* pr_info("block num=%llu\n", leaf_no); */
729 error = -EIO; 729 error = -EIO;
@@ -1560,15 +1560,22 @@ struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name,
1560 1560
1561 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); 1561 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh);
1562 if (dent) { 1562 if (dent) {
1563 struct inode *inode;
1564 u16 rahead;
1565
1563 if (IS_ERR(dent)) 1566 if (IS_ERR(dent))
1564 return ERR_CAST(dent); 1567 return ERR_CAST(dent);
1565 dtype = be16_to_cpu(dent->de_type); 1568 dtype = be16_to_cpu(dent->de_type);
1569 rahead = be16_to_cpu(dent->de_rahead);
1566 addr = be64_to_cpu(dent->de_inum.no_addr); 1570 addr = be64_to_cpu(dent->de_inum.no_addr);
1567 formal_ino = be64_to_cpu(dent->de_inum.no_formal_ino); 1571 formal_ino = be64_to_cpu(dent->de_inum.no_formal_ino);
1568 brelse(bh); 1572 brelse(bh);
1569 if (fail_on_exist) 1573 if (fail_on_exist)
1570 return ERR_PTR(-EEXIST); 1574 return ERR_PTR(-EEXIST);
1571 return gfs2_inode_lookup(dir->i_sb, dtype, addr, formal_ino, 0); 1575 inode = gfs2_inode_lookup(dir->i_sb, dtype, addr, formal_ino, 0);
1576 if (!IS_ERR(inode))
1577 GFS2_I(inode)->i_rahead = rahead;
1578 return inode;
1572 } 1579 }
1573 return ERR_PTR(-ENOENT); 1580 return ERR_PTR(-ENOENT);
1574} 1581}