Re: [PATCH 00/21] drop vmtruncate

From: Marco Stornelli
Date: Fri Sep 07 2012 - 02:29:23 EST


2012/9/6 LukÃÅ Czerner <lczerner@xxxxxxxxxx>:
> On Fri, 31 Aug 2012, Marco Stornelli wrote:
>
>> Date: Fri, 31 Aug 2012 15:50:20 +0200
>> From: Marco Stornelli <marco.stornelli@xxxxxxxxx>
>> To: Linux FS Devel <linux-fsdevel@xxxxxxxxxxxxxxx>, linux-mm@xxxxxxxxx
>> Cc: Linux Kernel <linux-kernel@xxxxxxxxxxxxxxx>
>> Subject: [PATCH 00/21] drop vmtruncate
>>
>> Hi all,
>>
>> with this patch series I try to clean the vmtruncate code. The theory of
>> operation:
>>
>> old new
>> vmtruncate() => inode_newsize_ok+truncate_setsize+fs truncate
>>
>> Where vmtruncate was used without any error check, the code now is:
>>
>> if (inode_newsize_ok() == 0) {
>> truncate_setsize();
>> fs truncate();
>> }
>>
>> So, performance and semantic nothing change at all. I think that maybe in some
>> point we can skip inode_newsize_ok (where the error check of vmtruncate wasn't
>> used) but since there is a swap check in case of no-extension, maybe it's
>> better to avoid regressions. After this clean, of course, each fs can clean in
>> a deeply way.
>>
>> With these patches even the inode truncate callback is deleted.
>>
>> Any comments/feedback/bugs are welcome.
>
> Could you explain the reason behind this change a little bit more ?
> This does not make any sense to me since you're replacing
> vmtruncate() which does basically
>
> if (inode_newsize_ok() == 0) {
> truncate_setsize();
> fs truncate();
> }
>
> as you mentioned above by exactly the same thing but doing it within
> the file system. It does not seem like an improvement to me ... how
> is this a clean up ?
>
> Thanks!
> -Lukas
>

First of all we have one function less in our stack :) Vmtruncate (see
comments) is deprecated, so it's better to remove it completly. In
this way we can remove even the truncate call back in inode operations
(so save 4byte/8byte per struct for the pointer). The first goal of
this cleaning activity, however, is remove a "deprecated" function to
have a code much more readable. As I said, this patch series is only a
*first* cleanup, each fs can of course clean its code in a deeply way.
As you can see, the patch span over several fs, to be *safe* I
preferred to use a conservative approach. Where vmtruncate was called
without error check, as I said, maybe we can remove
inode_newsize_ok(), but since in this way we skip a check, I preferred
that approach. It seems that for NTFS and Raiserfs it's ok.

Marco

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