aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2014-02-07 06:23:22 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2014-02-07 06:23:22 -0500
commit44aaada9d144a46d3de48ad81093f69d17fae96f (patch)
treec3dbb51279c93ec2fad3464d1d93e115d9882599 /fs/gfs2/dir.c
parenta0846a534c5fbc40a08e2960a24bd0b8d647a840 (diff)
GFS2: Add meta readahead field in directory entries
The intent of this new field in the directory entry is to allow a subsequent lookup to know how many blocks, which are contiguous with the inode, contain metadata which relates to the inode. This will then allow the issuing of a single read to read these blocks, rather than reading the inode first, and then issuing a second read for the metadata. This only works under some fairly strict conditions, since we do not have back pointers from inodes to directory entries we must ensure that the blocks referenced in this way will always belong to the inode. This rules out being able to use this system for indirect blocks, as these can change as a result of truncate/rewrite. So the idea here is to restrict this to xattr blocks only for the time being. For most inodes, that means only a single block. Also, when using ACLs and/or SELinux or other LSMs, these will be added at inode creation time so that they will be contiguous with the inode on disk and also will almost always be needed when we read the inode in for permissions checks. Once an xattr block for an inode is allocated, it will never change until the inode is deallocated. This patch adds the new field, a further patch will add the readahead in due course. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index fa32655449c8..ffcfdd18d485 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1684,6 +1684,14 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name)
1684 return 0; 1684 return 0;
1685} 1685}
1686 1686
1687static u16 gfs2_inode_ra_len(const struct gfs2_inode *ip)
1688{
1689 u64 where = ip->i_no_addr + 1;
1690 if (ip->i_eattr == where)
1691 return 1;
1692 return 0;
1693}
1694
1687/** 1695/**
1688 * gfs2_dir_add - Add new filename into directory 1696 * gfs2_dir_add - Add new filename into directory
1689 * @inode: The directory inode 1697 * @inode: The directory inode
@@ -1721,6 +1729,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
1721 dent = gfs2_init_dirent(inode, dent, name, bh); 1729 dent = gfs2_init_dirent(inode, dent, name, bh);
1722 gfs2_inum_out(nip, dent); 1730 gfs2_inum_out(nip, dent);
1723 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode)); 1731 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode));
1732 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip));
1724 tv = CURRENT_TIME; 1733 tv = CURRENT_TIME;
1725 if (ip->i_diskflags & GFS2_DIF_EXHASH) { 1734 if (ip->i_diskflags & GFS2_DIF_EXHASH) {
1726 leaf = (struct gfs2_leaf *)bh->b_data; 1735 leaf = (struct gfs2_leaf *)bh->b_data;