From patchwork Mon Nov 19 19:31:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tristan.lelong@blunderer.org X-Patchwork-Id: 200148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9EA482C008E for ; Tue, 20 Nov 2012 06:58:56 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TaXTe-0006Sw-1c; Mon, 19 Nov 2012 19:57:54 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TaX4D-0005FI-C9 for linux-mtd@lists.infradead.org; Mon, 19 Nov 2012 19:31:42 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi1so730216pad.36 for ; Mon, 19 Nov 2012 11:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:reply-to:user-agent:mime-version:to :subject:content-type; bh=edHvFSv9ydqdC4u+kM6hmW1oEDq17L4humcPP58aO70=; b=SSHRFwqPPwI1Jn91RC5i11wgJkCdhq7ZueJqeKJ2IHLcjLFiQ9UZ/K0nPVAtJ4kLMc /YJQS+BnzSGQAt+Bt+sEL5erZ+VgvNecCCBHTp1o4kNbpx8wdtCjbvphby960rtMp72f dVU1j+YZkW5l9cfHfkBmclpQqJqeHdrwnAqqTn7uLq9+KM1oToaTEoQ+H1k2kRGoYVt0 5jT8QDIv0AhqlJOWk7S9fHeGLM6h4HhLUbWulF7w8mdAzPr14EjG00dWGaEH8t9Qdcwo zK2dsvHFRBDkk9ug+Aq7k21NaUobW/XTlaWOhSlHp0njPcdeZFoyXC/rkChfexDMqkTk tMXA== Received: by 10.66.81.97 with SMTP id z1mr650122pax.19.1353353493329; Mon, 19 Nov 2012 11:31:33 -0800 (PST) Received: from [192.168.1.58] (173-10-76-62-BusName-Washington.hfc.comcastbusiness.net. [173.10.76.62]) by mx.google.com with ESMTPS id gv9sm6653901pbc.21.2012.11.19.11.31.32 (version=SSLv3 cipher=OTHER); Mon, 19 Nov 2012 11:31:32 -0800 (PST) Message-ID: <50AA8914.2090009@blunderer.org> Date: Mon, 19 Nov 2012 14:31:32 -0500 From: Tristan Lelong User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: linux-mtd@lists.infradead.org Subject: make offline logfs image and some BUG() X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121119_143139_813394_6BC404D1 X-CRM114-Status: GOOD ( 17.35 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (blunderer[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: tristan.lelong@blunderer.org List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi, I am trying to use logfs for a project I am currently working on. The kernel version I used is 2.6.37 with some patch from TI DM8168. I search on the internet for an offline way to create a logfs image from a directory (like mkfs.jffs2), and the only way seems to be using the block2mtd kernel module. Does anybody confirm that? Also I encountered two BUG(): - The first is already documented on some mailing lists: it is the one that it appears when doing umount -> call to map_invalidatepage. I was able to apply the attached patch1 to fix this, but I still see call to this function. I guess I might miss something. - The other one is when mounting a filesystem that detects a previous incomplete write: it BUG() because it cannot find any free segment. Trying to understand what is happening, I realized that during the mount, the function that adds segment to the free list is called after the function that check the filesystem. I modified this like in the following patch2 and it seems to work fine. Does anybody have any thoughts about that? Thanks a lo --- 618FE3EF Index: super.c =================================================================== --- super.c (revision 24035) +++ super.c (working copy) @@ -308,14 +308,13 @@ if (err) return err; + /* Do one GC pass before any data gets dirtied */ + logfs_gc_pass(sb); + /* Check areas for trailing unaccounted data */ err = logfs_check_areas(sb); if (err) return err; - - /* Do one GC pass before any data gets dirtied */ - logfs_gc_pass(sb); - /* after all initializations are done, replay the journal * for rw-mounts, if necessary */ err = logfs_replay_journal(sb); Index: super.c =================================================================== --- super.c (revision 24035) +++ super.c (working copy) @@ -511,6 +510,7 @@ /* Alias entries slow down mount, so evict as many as possible */ sync_filesystem(sb); logfs_write_anchor(sb); + free_areas(sb); /* * From this point on alias entries are simply dropped - and any Index: segment.c =================================================================== --- segment.c (revision 24035) +++ segment.c (working copy) @@ -841,6 +841,16 @@ kfree(area); } +void free_areas(struct super_block *sb) +{ + struct logfs_super *super = logfs_super(sb); + int i; + + for_each_area(i) + free_area(super->s_area[i]); + free_area(super->s_journal_area); +} + static struct logfs_area *alloc_area(struct super_block *sb) { struct logfs_area *area; @@ -923,10 +933,6 @@ void logfs_cleanup_areas(struct super_block *sb) { struct logfs_super *super = logfs_super(sb); - int i; btree_grim_visitor128(&super->s_object_alias_tree, 0, kill_alias); - for_each_area(i) - free_area(super->s_area[i]); - free_area(super->s_journal_area); } Index: logfs.h =================================================================== --- logfs.h (revision 24035) +++ logfs.h (working copy) @@ -594,6 +594,7 @@ void logfs_sync_area(struct logfs_area *area); void logfs_sync_segments(struct super_block *sb); void freeseg(struct super_block *sb, u32 segno); +void free_areas(struct super_block *sb); /* area handling */ int logfs_init_areas(struct super_block *sb);