From mboxrd@z Thu Jan 1 00:00:00 1970 From: Valerie Aurora Subject: [PATCH 27/74] union-mount: Add two superblock fields for union mounts Date: Tue, 22 Mar 2011 18:59:03 -0700 Message-ID: <1300845590-14184-28-git-send-email-valerie.aurora@gmail.com> References: <1300845590-14184-1-git-send-email-valerie.aurora@gmail.com> Cc: viro@zeniv.linux.org.uk, Valerie Aurora , Valerie Aurora To: linux-fsdevel@vger.kernel.org, linux@vger.kernel.org Return-path: Received: from mail-iy0-f174.google.com ([209.85.210.174]:59956 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756427Ab1CWCBe (ORCPT ); Tue, 22 Mar 2011 22:01:34 -0400 In-Reply-To: <1300845590-14184-1-git-send-email-valerie.aurora@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Valerie Aurora Add two fields to struct super_block to support union mounts. s_union_lower_mnts is a pointer to a cloned vfsmount tree of all the lower (read-only) mounts unioned with the topmost (read-write) vfsmount. These mounts may have submounts which will also be unioned; hence we copy the entire vfsmount tree, not just the root vfsmounts. s_union_count is the number of lower mounts unioned at the root of the file system. This count is the maximum number of directories that will ever be unioned with a single directory. We use it to allocate a union stack of the correct size for each directory. Signed-off-by: Valerie Aurora --- include/linux/fs.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index dad9903..258f99b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1396,6 +1396,18 @@ struct super_block { * Decremented by free_vfsmnt() if MNT_HARD_READONLY is set. */ int s_hard_readonly_users; + + /* + * Root of the private cloned vfsmount tree of the read-only + * mounts in this union (set in topmost vfsmount only) + */ + struct vfsmount *s_union_lower_mnts; + + /* + * Number of layers in this union, not counting the topmost or + * submounts. + */ + unsigned int s_union_count; }; extern struct timespec current_fs_time(struct super_block *sb); -- 1.7.0.4