Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933204Ab3CGSqx (ORCPT ); Thu, 7 Mar 2013 13:46:53 -0500 Received: from cantor2.suse.de ([195.135.220.15]:48801 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759653Ab3CGSqw (ORCPT ); Thu, 7 Mar 2013 13:46:52 -0500 Date: Thu, 07 Mar 2013 19:46:50 +0100 Message-ID: From: Takashi Iwai To: =?UTF-8?B?SsO2cm4=?= Engel Cc: linux-kernel@vger.kernel.org, Andrew Morton , Borislav Petkov , Jeff Moyer Subject: Re: [PATCH 0/9] Add blockconsole version 1.1 (try 2) In-Reply-To: <20130306194950.GA19938@logfs.org> References: <1362087602-8979-1-git-send-email-joern@logfs.org> <20130301162239.GC16393@logfs.org> <20130306194950.GA19938@logfs.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.2 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2561 Lines: 83 At Wed, 6 Mar 2013 14:49:50 -0500, Jörn Engel wrote: > > On Tue, 5 March 2013 18:36:41 +0100, Takashi Iwai wrote: > > > > Another thing I noticed is that the panic handler calls bcon_write(), > > and it doesn't write to the device by itself. Is it really supposed > > to work? > > Clearly it is supposed to work. In reality it sometimes does and > sometimes does not. Patches to improve the success rate are welcome. What I thought is to driver submit_bio in the panic handler itself so that no scheduling is involved, like the patch below. But I'm not sure whether it would actually work... > > > Meanwhile I hacked the code to allow it being built as a module. > > If anyone is interested, I'll send a patch series. It's pretty > > hackish, so likely need more brush up, though. > > I am interested. OK, I'll send a patch series. It'll be built on top of my previous patches. And I wrote it after merging to 3.9-rc1, so might be slightly fuzzy to your tree. thanks, Takashi --- diff --git a/drivers/block/blockconsole.c b/drivers/block/blockconsole.c index 5fc192a..5042a5a 100644 --- a/drivers/block/blockconsole.c +++ b/drivers/block/blockconsole.c @@ -361,6 +361,16 @@ static void bcon_writesector(struct blockconsole *bc, int index) submit_bio(WRITE, bio); } +static void bcon_do_writeback(struct blockconsole *bc) +{ + while (bcon_write_sector(bc) != bcon_console_sector(bc)) { + bcon_writesector(bc, bcon_write_sector(bc)); + bcon_advance_write_bytes(bc, SECTOR_SIZE); + if (bcon_write_sector(bc) == 0) + bcon_erase_segment(bc); + } +} + static int bcon_writeback(void *_bc) { struct blockconsole *bc = _bc; @@ -373,12 +383,7 @@ static int bcon_writeback(void *_bc) schedule(); if (kthread_should_stop()) break; - while (bcon_write_sector(bc) != bcon_console_sector(bc)) { - bcon_writesector(bc, bcon_write_sector(bc)); - bcon_advance_write_bytes(bc, SECTOR_SIZE); - if (bcon_write_sector(bc) == 0) - bcon_erase_segment(bc); - } + bcon_do_writeback(bc); } return 0; } @@ -476,7 +481,7 @@ static int blockconsole_panic(struct notifier_block *this, unsigned long event, n = SECTOR_SIZE - bcon_console_ofs(bc); if (n != SECTOR_SIZE) bcon_advance_console_bytes(bc, n); - bcon_writeback(bc); + bcon_do_writeback(bc); return NOTIFY_DONE; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/