All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Nitin Gupta <ngupta@vflare.org>,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [PATCHv2 05/10] zram: reorganize code layout
Date: Thu, 23 Apr 2015 11:32:35 +0900	[thread overview]
Message-ID: <20150423023235.GD24928@blaptop> (raw)
In-Reply-To: <1429185356-11096-6-git-send-email-sergey.senozhatsky@gmail.com>

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 <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>

Thanks for the clean up!

-- 
Kind regards,
Minchan Kim

  reply	other threads:[~2015-04-23  2:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 11:55 [PATCHv2 00/10] cleaned up on-demand device creation Sergey Senozhatsky
2015-04-16 11:55 ` [PATCHv2 01/10] zram: enable compaction support in zram Sergey Senozhatsky
2015-04-16 11:55 ` [PATCHv2 02/10] zram: cosmetic ZRAM_ATTR_RO code formatting tweak Sergey Senozhatsky
2015-04-23  2:16   ` Minchan Kim
2015-04-16 11:55 ` [PATCHv2 03/10] zram: use idr instead of `zram_devices' array Sergey Senozhatsky
2015-04-23  2:23   ` Minchan Kim
2015-04-23  4:30     ` Sergey Senozhatsky
2015-04-16 11:55 ` [PATCHv2 04/10] zram: factor out device reset from reset_store() Sergey Senozhatsky
2015-04-23  2:29   ` Minchan Kim
2015-04-23  4:26     ` Sergey Senozhatsky
2015-04-16 11:55 ` [PATCHv2 05/10] zram: reorganize code layout Sergey Senozhatsky
2015-04-23  2:32   ` Minchan Kim [this message]
2015-04-16 11:55 ` [PATCHv2 06/10] zram: remove max_num_devices limitation Sergey Senozhatsky
2015-04-23  2:36   ` Minchan Kim
2015-04-23  4:24     ` Sergey Senozhatsky
2015-04-16 11:55 ` [PATCHv2 07/10] zram: report every added and removed device Sergey Senozhatsky
2015-04-23  2:38   ` Minchan Kim
2015-04-23  4:23     ` Sergey Senozhatsky
2015-04-16 11:55 ` [PATCHv2 08/10] zram: trivial: correct flag operations comment Sergey Senozhatsky
2015-04-23  2:40   ` Minchan Kim
2015-04-16 11:55 ` [PATCHv2 09/10] zram: return zram device_id value from zram_add() Sergey Senozhatsky
2015-04-23  2:41   ` Minchan Kim
2015-04-16 11:55 ` [PATCHv2 10/10] zram: add dynamic device add/remove functionality Sergey Senozhatsky
2015-04-23  3:06   ` Minchan Kim
2015-04-23  3:12     ` Minchan Kim
2015-04-23  4:23     ` Sergey Senozhatsky
2015-04-23  6:20       ` Minchan Kim
2015-04-16 23:23 ` [PATCHv2 00/10] cleaned up on-demand device creation Minchan Kim
2015-04-17  0:27   ` Sergey Senozhatsky
2015-04-17  0:39   ` Sergey Senozhatsky
2015-04-17  1:00 ` Sergey Senozhatsky
2015-04-17  1:32   ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150423023235.GD24928@blaptop \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.