From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757011AbbDWCco (ORCPT ); Wed, 22 Apr 2015 22:32:44 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34184 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756951AbbDWCcl (ORCPT ); Wed, 22 Apr 2015 22:32:41 -0400 Date: Thu, 23 Apr 2015 11:32:35 +0900 From: Minchan Kim To: Sergey Senozhatsky Cc: Andrew Morton , Nitin Gupta , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCHv2 05/10] zram: reorganize code layout Message-ID: <20150423023235.GD24928@blaptop> References: <1429185356-11096-1-git-send-email-sergey.senozhatsky@gmail.com> <1429185356-11096-6-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429185356-11096-6-git-send-email-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 16, 2015 at 08:55:51PM +0900, Sergey Senozhatsky wrote: > This patch looks big, but basically it just moves code blocks. > No functional changes. > > Our current code layout looks like a sandwitch. > > For example, > a) between read/write handlers, we have update_used_max() helper function: > > static int zram_decompress_page > static int zram_bvec_read > static inline void update_used_max > static int zram_bvec_write > static int zram_bvec_rw > > b) RW request handlers __zram_make_request/zram_bio_discard are divided by > sysfs attr reset_store() function and corresponding zram_reset_device() > handler: > > static void zram_bio_discard > static void zram_reset_device > static ssize_t disksize_store > static ssize_t reset_store > static void __zram_make_request > > c) we first a bunch of sysfs read/store functions. then a number of > one-liners, then helper functions, RW functions, sysfs functions, helper > functions again, and so on. > > Reorganize layout to be more logically grouped (a brief description, > `cat zram_drv.c | grep static` gives a bigger picture): > > -- one-liners: zram_test_flag/etc. > > -- helpers: is_partial_io/update_position/etc > > -- sysfs attr show/store functions + ZRAM_ATTR_RO() generated stats > show() functions > exception: reset and disksize store functions are required to be after meta() > functions. because we do device create/destroy actions in these sysfs > handlers. > > -- "mm" functions: meta get/put, meta alloc/free, page free > static inline bool zram_meta_get > static inline void zram_meta_put > static void zram_meta_free > static struct zram_meta *zram_meta_alloc > static void zram_free_page > > -- a block of I/O functions > static int zram_decompress_page > static int zram_bvec_read > static int zram_bvec_write > static void zram_bio_discard > static int zram_bvec_rw > static void __zram_make_request > static void zram_make_request > static void zram_slot_free_notify > static int zram_rw_page > > -- device contol: add/remove/init/reset functions (+zram-control class > will sit here) > static void zram_reset_device_internal > static int zram_reset_device > static ssize_t reset_store > static ssize_t disksize_store > static int zram_add > static void zram_remove > static int __init zram_init > static void __exit zram_exit > > Signed-off-by: Sergey Senozhatsky Acked-by: Minchan Kim Thanks for the clean up! -- Kind regards, Minchan Kim