Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161070AbbEVN02 (ORCPT ); Fri, 22 May 2015 09:26:28 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:12172 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161009AbbEVN0Y (ORCPT ); Fri, 22 May 2015 09:26:24 -0400 X-AuditID: cbfec7f5-f794b6d000001495-b8-555f2e7e5c86 Message-id: <555F2E7C.4090707@samsung.com> Date: Fri, 22 May 2015 15:26:20 +0200 From: Marcin Jabrzyk Organization: Samsung R&D Institute Poland User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-version: 1.0 To: Sergey Senozhatsky Cc: minchan@kernel.org, ngupta@vflare.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kyungmin.park@samsung.com Subject: Re: [PATCH] zram: check compressor name before setting it References: <1432283515-2005-1-git-send-email-m.jabrzyk@samsung.com> <20150522085523.GA709@swordfish> <555EF30C.60108@samsung.com> <20150522124411.GA3793@swordfish> In-reply-to: <20150522124411.GA3793@swordfish> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOLMWRmVeSWpSXmKPExsVy+t/xq7p1evGhBrNP8lmcbXrDbnF51xw2 i3tr/rNaLPv6nt1iQ8ssdotHEyYxObB57Jx1l91j06pONo9Nnyaxe/RtWcXosfPTZlaPz5vk AtiiuGxSUnMyy1KL9O0SuDIe9R9mKVjHV7Hk/mvGBsYt3F2MnBwSAiYSD750s0LYYhIX7q1n 62Lk4hASWMoo8fTuelYI5xmjxPtnc8CqeAW0JHZtus8CYrMIqEp8WPAcqIODg01AR+L8ag2Q MD9QyZqm6ywgYVGBCInuE5UQnYISPybfA+sUEbCSuLPqGpjNLFAh8XTbVbDpwgJOEr9uNzFB rF3BKDFzzkN2kASngJ7E3O0foBpsJRa8Xwdly0tsXvOWeQKj4CwkO2YhKZuFpGwBI/MqRtHU 0uSC4qT0XCO94sTc4tK8dL3k/NxNjJDg/7qDcekxq0OMAhyMSjy8BgfjQoVYE8uKK3MPMUpw MCuJ8C4Ujg8V4k1JrKxKLcqPLyrNSS0+xCjNwaIkzjtz1/sQIYH0xJLU7NTUgtQimCwTB6dU AyPfvAVmXX77ptR9+fnW631Itori/PuHHEwOeK/TtDud9PLvOnbm24bvCh4suiwszntgqrbW RMmLmzyZy86Ybnf+v9lLYIfHzSKBl48Z/0fPTNz5XfDRgw6bz3M3LJBdYJGe+kWmWd87bMml vbE7mzPNDDVXJ/X/uWw/JeC03Sc9W6Gso993FskqsRRnJBpqMRcVJwIAoqr++HoCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2031 Lines: 61 On 22/05/15 14:44, Sergey Senozhatsky wrote: > On (05/22/15 11:12), Marcin Jabrzyk wrote: >>> >>> no. >>> >>> zram already complains about failed comp backend creation. >>> it's in dmesg (or syslog, etc.): >>> >>> "zram: Cannot initialise %s compressing backend" >>> >> OK, now I see that. Sorry for the noise. >> >>> second, there is not much value in exposing zcomp internals, >>> especially when the result is just another line in dmesg output. >> >> From the other hand, the only valid values that can be written are >> in 'comp_algorithm'. >> So when writing other one, returning -EINVAL seems to be reasonable. >> The user would get immediately information that he can't do that, >> now the information can be very deferred in time. > > it's not. > the error message appears in syslog right before we return -EINVAL > back to user. Yes I've read up the code more detailed and I saw that error message just before returning to user with error value. But this happens when 'disksize' is wirtten, not when 'comp_algorithm'. I understood, the error message in dmesg is clear there is no such algorithm. But this is not an immediate error, when setting the 'comp_algorithm', where we already know that it's wrong, not existing etc. Anything after that moment would be wrong and would not work at all. From what I saw 'comp_algorithm_store' is the only *_store in zram that believes user that he writes proper value and just makes strlcpy. So what I've ing mind is to provide direct feedback, you have written wrong name of compressor, you got -EINVAL, please write correct value. This would be very useful when scripting. Sorry for being so confusing. Best regards, Marcin Jabrzyk > > -ss > >> I'm not for exposing more internals, but getting -EINVAL would be nice I > -- 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/