Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751465AbdDCG5P (ORCPT ); Mon, 3 Apr 2017 02:57:15 -0400 Received: from mail-he1eur01on0048.outbound.protection.outlook.com ([104.47.0.48]:5945 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751219AbdDCG5N (ORCPT ); Mon, 3 Apr 2017 02:57:13 -0400 Authentication-Results: lge.com; dkim=none (message not signed) header.d=none;lge.com; dmarc=none action=none header.from=nextfour.com; Subject: Re: [PATCH 2/5] zram: partial IO refactoring To: Minchan Kim References: <1491196653-7388-1-git-send-email-minchan@kernel.org> <1491196653-7388-3-git-send-email-minchan@kernel.org> <20170403061227.GA7681@bbox> CC: Andrew Morton , , Sergey Senozhatsky , From: =?UTF-8?Q?Mika_Penttil=c3=a4?= Message-ID: <25360dff-caae-628a-25ce-4e67cc65b94a@nextfour.com> Date: Mon, 3 Apr 2017 09:57:06 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170403061227.GA7681@bbox> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit X-Originating-IP: [194.157.170.61] X-ClientProxiedBy: VI1PR09CA0050.eurprd09.prod.outlook.com (10.174.49.18) To AM4PR0701MB2164.eurprd07.prod.outlook.com (10.167.132.149) X-MS-Office365-Filtering-Correlation-Id: 818073d5-423c-4858-5eaa-08d47a5ea66b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075);SRVR:AM4PR0701MB2164; X-Microsoft-Exchange-Diagnostics: 1;AM4PR0701MB2164;3:pEb0PGoMZfs4RdOvlb6L6sfqZNboeIC3qvUAgsT51iPnbRWCH4k6XKmBS/xXx5CWffM0NjbftRSpqXo3gfseYY+Qso3QT/1XgsprESowUn8UcUnvh8cNr71P/9kNacEqAr8QJLlGrQXZiN1bFwKADNqka9wTMozeCR4JcIh7XZlupYu5Vg4RilKz5PJWI9bYixxcJaQr3K8J9T9f5SzEYOjpKa1vYOQ/ISq4JJtcNpb6pXoLgtHPcrQMF5NBNqU4LxNuk1lBbGZo4p1ma8Pin/GP5DFOQYDVCUfwGgvUk8Y=;25:1rkIKapEHpd1lq3OybyvX4Jyxoku849ffBN5zTOXi/UTyF6hzupB1Kry7At1QFWFQSlL7BQP2jnKoGXxN4YcxIj3HFssiUzAPPnANhXHQqM40g2EndiT52Yek/le2hPBtAsNWAvX1zqQ9u1FyQ8ERyen/ZvzdLmoi1tpOLJeRUPc1cMU+pJXlon+8x2CFx02Sxe0eXRwug2a8MtiLlsqTzvniPKNnJF8ll9v04+xKrVNw3wJSIgc+kJqNXyz3U0XMYb7tuZVl9//tXPiqeG0d3sOD1pPKxPXkUI2CP1HdvIvFES48FM6Z8cO2j3y9pVqjXrYN53rRdNlKns1kc0Mbm9eFzqSbx3SuHrdssuEqw565ueriC30ltaS8WtyQbsVP4sk2T5uC+7btG+CP5LGQwVjW0724i9lEHUIrEleQhMU3RxGL1PJxXE4TL57JMnJ X-Microsoft-Exchange-Diagnostics: 1;AM4PR0701MB2164;31:QzrXpXIBK0cTdV13uAcRTN5zNwGyPsfhbBlx36ElfAQfUCUDHr6rN5AkHxxp3brjKaAPmf2HeBhlDU5QXu8ZuKm/b7CTb//zkQpzmWQgqfHTP4ky+ymADpR3a6ZSW01DGWRxMv1lN8rcakMIxHuflNawMn1wKzIdoifm11KjEPCXHUwiRARGeMI9+vzhMgwdz/ZUpmYEYrT8rLR7NGq3RJiGexLoHwf7cTF127mq03vyVVpbPS1I9ZjnAzguQNPQ1kdfAWhIJLcetoh5Wc6xJg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(6041248)(20161123555025)(2016111802025)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(6072148)(6043046);SRVR:AM4PR0701MB2164;BCL:0;PCL:0;RULEID:;SRVR:AM4PR0701MB2164; X-Microsoft-Exchange-Diagnostics: 1;AM4PR0701MB2164;4:rtbhqhiidljVJCtX/rmhDEYXKCstA6yXxxI3EJUXqD17q94h8obE0g9mg21L/c2PR9QVyIwphrO0X40c1Bttqu7X0FQAsZqxeb6E9ul8qD+rCJSBZu+6KZTI1p9QEM8a/zhm0D3MbTo/olbd6BmQlbdQ+cTIc8xF1XSwEfzMgiH/4FUxI57wdL66okpbbAesQjEnwCydE3n3CyGGqWM3eXxLsTz2HsLdvFR89o2VDyHb1qiQJfMr9QxgwUCknvZtfVonLdDQuQXU9zJ6NtJKwvxsG+n1y+X/xSKCWlanNG7KUe803CtxeIJzXMeVZKgsegX/8kJclkMR3S4BxtudSIKeDH2y7KYdtAMAJuAtDVLdqTDQK2sUvlQgIZBVUObYn1nOjcqb4ZQr2MRtmj4zsUTTdJ3QoowTwTguIRXPpRpS21byrXMRXDnMBXTQrMv0QX1NHtygh46MFWxSaY1NZFi88z24qk4WojxhrY8mIns/FfEnllgzTzBbkpZfCXBao93mBM1q2lZC++HMAamxXBKELxDJY3dJh981cqx5DOYQtImLqc6030x9L2nAIi2TynWVdu9MUMifEPtmOIWsBM2be+Dw51elr/uXn9S1dRkTaMNEjtOmdtjzvRH07LEH94QB2TzfUxduTVUAeSJsw7s+N2q1M5BnjiMnv/Fpjtus29UMMp1AAlVccfQNFwDw/dfPfJh4Tsc3zU/jxZLaWfb4QVRPwxa1Ng7A1oRutUNHbRuUWQyP2Q1sZs5tjPGTnaOwRvSNqiOysRzE1A5kGw== X-Forefront-PRVS: 0266491E90 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(39450400003)(39410400002)(39400400002)(39830400002)(24454002)(377454003)(31696002)(65826007)(229853002)(36756003)(86362001)(81166006)(31686004)(8676002)(6666003)(2950100002)(93886004)(4326008)(38730400002)(110136004)(6916009)(42186005)(5660300001)(90366009)(7736002)(6486002)(77096006)(3846002)(6116002)(50986999)(305945005)(54356999)(53936002)(76176999)(83506001)(2870700001)(25786009)(33646002)(53546009)(189998001)(66066001)(54906002)(4001350100001)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR0701MB2164;H:[10.10.10.110];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;AM4PR0701MB2164;23:cE0iX+vU7CuAEFSuXz7AHVUMk849bR4s4vp?= =?Windows-1252?Q?lkzg1fuYHXrMxDzwdZwM03gjxdoA/jV7WBi9zLwpj0k5tPck9OWnKerv?= =?Windows-1252?Q?g5Hvnh+9U2260Old9V4dagUXZ0/bOiN8qpPHwoQMWHS8ennGFZdb5hED?= =?Windows-1252?Q?8BWLD/eHD+JC/lVYmZ9JA4G6/YIFBe+nEFpWFBn7PMj774mCMGuy0EJG?= =?Windows-1252?Q?rlC4NGS1x9XCnZwiJZAqgQIjpcDp5QNqpvoT45wAOdaONeNsexauWY+O?= =?Windows-1252?Q?aWHyJekruJeDKs2ppqnNk2v2dgsj1lkqfJ/DYox+o6jfzCU1hzutAqIb?= =?Windows-1252?Q?Zp697z99pBcc1bLhrVtPx5cn9GUQy+uUo4i+NrvATGTohMCrYepFAJJ2?= =?Windows-1252?Q?VDlD2BMmH0fOqFN0r68lCLsh9hcm7jK+aTHChk5hIBgjI/Ov0gd+g/hx?= =?Windows-1252?Q?4nNWcaalsH4LGc7iOeUWecFeggVVsqFbASx/KVUjxISk+FTJRknaoAvl?= =?Windows-1252?Q?qxjJx15k2qq0TnG92Ff3PhdA9jklv7+G0eXpO5DwYE+AH05i+gmFsQg+?= =?Windows-1252?Q?+3zRivT3DLUY2ftQpV7KpdEgU0+ZnP6XQmk8c4lGiWMvTVStH5gTE4Xf?= =?Windows-1252?Q?uEXgHjSBkKFadkBpWoe/2RdpZs3T72WgOqmMEPtU0Xn20unAQCumWVwk?= =?Windows-1252?Q?W75NBEv/DOTOal+InLBL2Iouqxvrsh7zosAA5ImPY9wrMJJwJS5jHlB/?= =?Windows-1252?Q?R/loZp07CS3dvm84avUlfM1aaZ9ljkRkSfZ6Ecyq0oESNzFdVaqvugy8?= =?Windows-1252?Q?PUHVZ5qrHay7j21f9fhYeCHvsie45d3qe24XloPLB50Ed456BGVgK/tN?= =?Windows-1252?Q?LIgmqFW1F5iqN908xO6LcvzeKDWnnrwH31btG6RvJ6Rr7A3Uoos60Kzg?= =?Windows-1252?Q?tCXsJBl22aL2uztaVFW+k9ekNk6u/Xj3Igawy65PhCqCV6MarnDo6uNS?= =?Windows-1252?Q?fKFA9ETRc86nPp817nqFnzJ/0vlsz6Em3Hc3hG8nY4byB+29BY6Wc4lH?= =?Windows-1252?Q?+uQhFk9EVdTR5Q5o4aGaAXxkMAJ7SO9cZ5IlK4hUlW/qcZZAjOZmakNL?= =?Windows-1252?Q?Ele4gef/m6xUnhe204U7L2U2Nw31WOS9sodgpduDiL0M02h1y/cWO7si?= =?Windows-1252?Q?3u/dyOTRn4Hvmo7HR2rRoabRfc9iYWbccZmqElSN2o6GsS5klbylhr23?= =?Windows-1252?Q?+HzBXRC6rIdFmDDLT6f4ycV3fDxah3b8+99pQ6Io=3D?= X-Microsoft-Exchange-Diagnostics: 1;AM4PR0701MB2164;6:eFUQgnaAQDhZoZjEkCgrDBKi4rTHZv24YoNLXCVPZVcBSqzfOuvbrub+toTDcQTa83o4W/m57L3xt7NjA1j+A9VQSmIKWtoD0EJkbWKbSDHSDcY0JwLjLTK71ocgakVi8QhBlIH9GMokepk4YIhSzxpsTliRufzL1CRTELleMysQ9E/KpA9QKMam1aYtYpngdPxXLwDwP2/eYeqM/yV59OzksmtW6fbUiL5LeZegZRzPlTgw2I+r6bpGcHqYUJqq8C+NLQdSzk9DPFtfWpTL4zYTGluFMxDz5nmkgnAkMZPMYVpKDBQclxvEWLmTDZq7BER604UOqC5gVktDJ/PM0oL6LwhAnacHq+Wa345/jK0O30TOLNL2nTQ61XWhhuscu6w1GU+LqN6sHMMuI2Webg==;5:krWQ3wkW7VlSsVBpjRMqxwXKIi8H0YPX8dg+NkgeV0hqqGJBaCRzzfS2G7+uNETrZweXGI8YOAIbXRk9PVMQnQm4u4AMhkAxXjztw5afI/XiWSEOUvELv9yIlmOJ+tT/JDpTk9zh6m/ur6eNCkTzlA==;24:2YT7UvFNf9jLRnrU7KixvE+x/WNdVNY5qoTL8CQP0DXQ/fRVb18XVo6pkCC4UMWnzvRWGaE81Uu0yb1ueBO5w0X9qchj7DNRtg14U5GY/+4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM4PR0701MB2164;7:JUbpHZB6ke6C4WVVJKY9dqs6+oLBQXM2xvbopz5l/mQcpzyjiBqApKZa+iI+cXqDDLck7ctQctbPGy/7PmdYjlOfpvsA+cIkgInww1+ABiFfwFaoO1tlZWCPh12J3ple6urokjWaZ8H/yPolLRSBui34MaVQjtMGgkQOxVXJ83UVl5NVk0M0/y0PcSepZFOfseaUwsL4j+dZT1mMuPW2OlhIGaH5tdlnN7Qv8XCkTIa0A5AD4cHQ/EjDAdc3f6L3yOEnsWBDYzoUauVv95dIueQGx4lqW/n8hbcTp4YXGXB5y1OnIOV8mXpJOZXZym5SaGHi08O1g1zfF42dVH00bw== X-OriginatorOrg: nextfour.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2017 06:57:09.9327 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0701MB2164 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2098 Lines: 61 On 04/03/2017 09:12 AM, Minchan Kim wrote: > Hi Mika, > > On Mon, Apr 03, 2017 at 08:52:33AM +0300, Mika Penttil? wrote: >> >> Hi! >> >> On 04/03/2017 08:17 AM, Minchan Kim wrote: >>> For architecture(PAGE_SIZE > 4K), zram have supported partial IO. >>> However, the mixed code for handling normal/partial IO is too mess, >>> error-prone to modify IO handler functions with upcoming feature >>> so this patch aims for cleaning up zram's IO handling functions. >>> >>> Signed-off-by: Minchan Kim >>> --- >>> drivers/block/zram/zram_drv.c | 333 +++++++++++++++++++++++------------------- >>> 1 file changed, 184 insertions(+), 149 deletions(-) >>> >>> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c >>> index 28c2836f8c96..7938f4b98b01 100644 >>> --- a/drivers/block/zram/zram_drv.c >>> +++ b/drivers/block/zram/zram_drv.c >>> @@ -45,6 +45,8 @@ static const char *default_compressor = "lzo"; >>> /* Module params (documentation at end) */ >>> static unsigned int num_devices = 1; >>> >>> +static void zram_free_page(struct zram *zram, size_t index); >>> + >>> static inline bool init_done(struct zram *zram) >>> { >>> return zram->disksize; >>> @@ -98,10 +100,17 @@ static void zram_set_obj_size(struct zram_meta *meta, >>> meta->table[index].value = (flags << ZRAM_FLAG_SHIFT) | size; >>> } >>> >>> +#if PAGE_SIZE != 4096 >>> static inline bool is_partial_io(struct bio_vec *bvec) >>> { >>> return bvec->bv_len != PAGE_SIZE; >>> } >>> +#else >> >> For page size of 4096 bv_len can still be < 4096 and partial pages should be supported >> (uncompress before write etc). ? > > zram declares this. > > #define ZRAM_LOGICAL_BLOCK_SIZE (1<<12) > > blk_queue_physical_block_size(zram->disk->queue, PAGE_SIZE); > blk_queue_logical_block_size(zram->disk->queue, > ZRAM_LOGICAL_BLOCK_SIZE); > > So, I thought there is no such partial IO in 4096 page architecture. > Am I missing something? Could you tell the scenario if it happens? I think you're right. At least swap operates with min 4096 sizes. > > Thanks! >