Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757331Ab0HJDiX (ORCPT ); Mon, 9 Aug 2010 23:38:23 -0400 Received: from mail-qy0-f174.google.com ([209.85.216.174]:43907 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756410Ab0HJDiT (ORCPT ); Mon, 9 Aug 2010 23:38:19 -0400 Message-ID: <4C60C9C4.4000902@vflare.org> Date: Tue, 10 Aug 2010 09:08:44 +0530 From: Nitin Gupta Reply-To: ngupta@vflare.org User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2 Thunderbird/3.1.1 MIME-Version: 1.0 To: Pekka Enberg CC: Pekka Enberg , Minchan Kim , Andrew Morton , Greg KH , Linux Driver Project , linux-mm , linux-kernel Subject: Re: [PATCH 02/10] Remove need for explicit device initialization References: <1281374816-904-1-git-send-email-ngupta@vflare.org> <1281374816-904-3-git-send-email-ngupta@vflare.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1476 Lines: 35 On 08/10/2010 12:06 AM, Pekka Enberg wrote: > On Mon, Aug 9, 2010 at 8:26 PM, Nitin Gupta wrote: >> Currently, the user has to explicitly write a positive value to >> initstate sysfs node before the device can be used. This event >> triggers allocation of per-device metadata like memory pool, >> table array and so on. >> >> We do not pre-initialize all zram devices since the 'table' array, >> mapping disk blocks to compressed chunks, takes considerable amount >> of memory (8 bytes per page). So, pre-initializing all devices will >> be quite wasteful if only few or none of the devices are actually >> used. >> >> This explicit device initialization from user is an odd requirement and >> can be easily avoided. We now initialize the device when first write is >> done to the device. >> >> Signed-off-by: Nitin Gupta > > AFAICT, most hardware block device drivers do things like this in the > probe function. Why can't we do that for zram as well and drop the > ->init_done and ->init_lock parts? > I think probe is only for PCI devices? Maybe should hook into open function in struct block_device_operations. That way, we can also drop init_done and init_lock parts. Thanks, Nitin -- 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/