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.senozhat...@gmail.com>
Acked-by: Minchan Kim <minc...@kernel.org>

Thanks for the clean up!

-- 
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to