From patchwork Wed Oct 21 19:19:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valerie Aurora Henson X-Patchwork-Id: 36621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 32098B7BA0 for ; Thu, 22 Oct 2009 06:25:14 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N0glI-0005lC-GY; Wed, 21 Oct 2009 19:22:21 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N0gkE-0005Y0-Bs; Wed, 21 Oct 2009 19:21:24 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9LJL6Nd029824; Wed, 21 Oct 2009 15:21:06 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9LJL5Ww004381; Wed, 21 Oct 2009 15:21:05 -0400 Received: from localhost.localdomain (vpn-227-23.phx2.redhat.com [10.3.227.23]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n9LJJdrO028452; Wed, 21 Oct 2009 15:21:03 -0400 From: Valerie Aurora To: Jan Blunck , Alexander Viro , Christoph Hellwig , Andy Whitcroft , Scott James Remnant , Sandu Popa Marius , Jan Rekorajski , "J. R. Okajima" , Arnd Bergmann , Vladimir Dronnikov , Felix Fietkau Subject: [PATCH 33/41] fallthru: jffs2 fallthru support Date: Wed, 21 Oct 2009 12:19:31 -0700 Message-Id: <1256152779-10054-34-git-send-email-vaurora@redhat.com> In-Reply-To: <1256152779-10054-33-git-send-email-vaurora@redhat.com> References: <1256152779-10054-1-git-send-email-vaurora@redhat.com> <1256152779-10054-2-git-send-email-vaurora@redhat.com> <1256152779-10054-3-git-send-email-vaurora@redhat.com> <1256152779-10054-4-git-send-email-vaurora@redhat.com> <1256152779-10054-5-git-send-email-vaurora@redhat.com> <1256152779-10054-6-git-send-email-vaurora@redhat.com> <1256152779-10054-7-git-send-email-vaurora@redhat.com> <1256152779-10054-8-git-send-email-vaurora@redhat.com> <1256152779-10054-9-git-send-email-vaurora@redhat.com> <1256152779-10054-10-git-send-email-vaurora@redhat.com> <1256152779-10054-11-git-send-email-vaurora@redhat.com> <1256152779-10054-12-git-send-email-vaurora@redhat.com> <1256152779-10054-13-git-send-email-vaurora@redhat.com> <1256152779-10054-14-git-send-email-vaurora@redhat.com> <1256152779-10054-15-git-send-email-vaurora@redhat.com> <1256152779-10054-16-git-send-email-vaurora@redhat.com> <1256152779-10054-17-git-send-email-vaurora@redhat.com> <1256152779-10054-18-git-send-email-vaurora@redhat.com> <1256152779-10054-19-git-send-email-vaurora@redhat.com> <1256152779-10054-20-git-send-email-vaurora@redhat.com> <1256152779-10054-21-git-send-email-vaurora@redhat.com> <1256152779-10054-22-git-send-email-vaurora@redhat.com> <1256152779-10054-23-git-send-email-vaurora@redhat.com> <1256152779-10054-24-git-send-email-vaurora@redhat.com> <1256152779-10054-25-git-send-email-vaurora@redhat.com> <1256152779-10054-26-git-send-email-vaurora@redhat.com> <1256152779-10054-27-git-send-email-vaurora@redhat.com> <1256152779-10054-28-git-send-email-vaurora@redhat.com> <1256152779-10054-29-git-send-email-vaurora@redhat.com> <1256152779-10054-30-git-send-email-vaurora@redhat.com> <1256152779-10054-31-git-send-email-vaurora@redhat.com> <1256152779-10054-32-git-send-email-vaurora@redhat.com> <1256152779-10054-33-git-send-email-vaurora@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20091021_152120_063693_EC705441 X-CRM114-Status: GOOD ( 19.17 ) X-Spam-Score: -4.0 (----) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (-4.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [209.132.183.28 listed in list.dnswl.org] Cc: linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, Felix Fietkau , David Woodhouse , linux-kernel@vger.kernel.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Felix Fietkau Add support for fallthru dentries to jffs2. Cc: David Woodhouse Cc: linux-mtd@lists.infradead.org Signed-off-by: Felix Fietkau Signed-off-by: Valerie Aurora --- fs/jffs2/dir.c | 31 ++++++++++++++++++++++++++++++- include/linux/jffs2.h | 6 ++++++ 2 files changed, 36 insertions(+), 1 deletions(-) diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 46a2e1b..544d6c5 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c @@ -35,6 +35,7 @@ static int jffs2_rename (struct inode *, struct dentry *, struct inode *, struct dentry *); static int jffs2_whiteout (struct inode *, struct dentry *, struct dentry *); +static int jffs2_fallthru (struct inode *, struct dentry *); const struct file_operations jffs2_dir_operations = { @@ -57,6 +58,7 @@ const struct inode_operations jffs2_dir_inode_operations = .rmdir = jffs2_rmdir, .mknod = jffs2_mknod, .rename = jffs2_rename, + .fallthru = jffs2_fallthru, .whiteout = jffs2_whiteout, .permission = jffs2_permission, .setattr = jffs2_setattr, @@ -107,6 +109,9 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, case DT_WHT: target->d_flags |= DCACHE_WHITEOUT; break; + case JFFS2_DT_FALLTHRU: + target->d_flags |= DCACHE_FALLTHRU; + break; default: ino = fd->ino; break; @@ -168,7 +173,10 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) fd->name, fd->ino, fd->type, curofs, offset)); continue; } - if (!fd->ino) { + if (fd->type == JFFS2_DT_FALLTHRU) + /* XXX Should really do a lookup for the real inode number here */ + fd->ino = 100; + else if (!fd->ino && (fd->type != DT_WHT)) { D2(printk(KERN_DEBUG "Skipping deletion dirent \"%s\"\n", fd->name)); offset++; continue; @@ -797,6 +805,26 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de return 0; } +static int jffs2_fallthru (struct inode *dir, struct dentry *dentry) +{ + struct jffs2_sb_info *c = JFFS2_SB_INFO(dir->i_sb); + uint32_t now; + int ret; + + now = get_seconds(); + ret = jffs2_do_link(c, JFFS2_INODE_INFO(dir), 0, DT_UNKNOWN, + dentry->d_name.name, dentry->d_name.len, now); + if (ret) + return ret; + + d_instantiate(dentry, NULL); + spin_lock(&dentry->d_lock); + dentry->d_flags |= DCACHE_FALLTHRU; + spin_unlock(&dentry->d_lock); + + return 0; +} + static int jffs2_whiteout (struct inode *dir, struct dentry *old_dentry, struct dentry *new_dentry) { @@ -830,6 +858,7 @@ static int jffs2_whiteout (struct inode *dir, struct dentry *old_dentry, return ret; spin_lock(&new_dentry->d_lock); + new_dentry->d_flags &= ~DCACHE_FALLTHRU; new_dentry->d_flags |= DCACHE_WHITEOUT; spin_unlock(&new_dentry->d_lock); d_add(new_dentry, NULL); diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h index 65533bb..dbe8c93 100644 --- a/include/linux/jffs2.h +++ b/include/linux/jffs2.h @@ -114,6 +114,12 @@ struct jffs2_unknown_node jint32_t hdr_crc; }; +/* + * Non-standard directory entry type(s), for on-disk use + */ + +#define JFFS2_DT_FALLTHRU (DT_WHT + 1) + struct jffs2_raw_dirent { jint16_t magic;