cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 05/29] GFS2: Add meta readahead field in directory entries
Date: Tue,  1 Apr 2014 10:15:17 +0100	[thread overview]
Message-ID: <1396343741-1524-6-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1396343741-1524-1-git-send-email-swhiteho@redhat.com>

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>

diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index fa32655..ffcfdd1 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)
 	return 0;
 }
 
+static u16 gfs2_inode_ra_len(const struct gfs2_inode *ip)
+{
+	u64 where = ip->i_no_addr + 1;
+	if (ip->i_eattr == where)
+		return 1;
+	return 0;
+}
+
 /**
  * gfs2_dir_add - Add new filename into directory
  * @inode: The directory inode
@@ -1721,6 +1729,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
 			dent = gfs2_init_dirent(inode, dent, name, bh);
 			gfs2_inum_out(nip, dent);
 			dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode));
+			dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip));
 			tv = CURRENT_TIME;
 			if (ip->i_diskflags & GFS2_DIF_EXHASH) {
 				leaf = (struct gfs2_leaf *)bh->b_data;
diff --git a/include/uapi/linux/gfs2_ondisk.h b/include/uapi/linux/gfs2_ondisk.h
index 3100208..db3fdd0 100644
--- a/include/uapi/linux/gfs2_ondisk.h
+++ b/include/uapi/linux/gfs2_ondisk.h
@@ -304,7 +304,13 @@ struct gfs2_dirent {
 	__be16 de_rec_len;
 	__be16 de_name_len;
 	__be16 de_type;
-	__u8 __pad[14];
+	union {
+		__u8 __pad[14];
+		struct {
+			__be16 de_rahead;
+			__u8 pad2[12];
+		};
+	};
 };
 
 /*
-- 
1.8.3.1



  parent reply	other threads:[~2014-04-01  9:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01  9:15 [Cluster-devel] GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 01/29] GFS2: Plug on AIL flush Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 02/29] GFS2: Allocate block for xattr at inode alloc time, if required Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 03/29] GFS2: journal data writepages update Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 04/29] GFS2: Lock i_mutex and use a local gfs2_holder for fallocate Steven Whitehouse
2014-04-01  9:15 ` Steven Whitehouse [this message]
2014-04-01  9:15 ` [Cluster-devel] [PATCH 06/29] GFS2: Mark functions as static in gfs2/rgrp.c Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 07/29] GFS2: add missing newline Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 08/29] GFS2: Reduce struct gfs2_trans in size Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 09/29] GFS2: Move log buffer lists into transaction Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 10/29] GFS2: Move log buffer accounting to transaction Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 11/29] fs: NULL dereference in posix_acl_to_xattr() Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 12/29] GFS2: Remove extra "if" in gfs2_log_flush() Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 13/29] GFS2: replace kmalloc - __vmalloc / memset 0 Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 14/29] GFS2: Clean up journal extent mapping Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 15/29] GFS2: return -E2BIG if hit the maximum limits of ACLs Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 16/29] GFS2: global conversion to pr_foo() Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 17/29] GFS2: Move recovery variables to journal structure in memory Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 18/29] GFS2: Use pr_<level> more consistently Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 19/29] GFS2: Use fs_<level> more often Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 20/29] GFS2: Convert gfs2_lm_withdraw to use fs_err Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 21/29] GFS2: check NULL return value in gfs2_ok_to_move Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 22/29] GFS2: Ensure workqueue is scheduled after noexp request Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 23/29] GFS2: Re-add a call to log_flush_wait when flushing the journal Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 24/29] GFS2: Increase the max number of ACLs Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 25/29] GFS2: Remove extraneous function gfs2_security_init Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 26/29] GFS2: inline function gfs2_set_mode Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 27/29] GFS2: Fix return value in slot_get() Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 28/29] GFS2: Fix uninitialized VFS inode in gfs2_create_inode Steven Whitehouse
2014-04-01  9:15 ` [Cluster-devel] [PATCH 29/29] GFS2: Fix address space from page function Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396343741-1524-6-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).