XFS and trim

Steven Haigh netwiz at crc.id.au
Tue Apr 2 14:26:17 UTC 2013


On 03/04/13 01:08, Eric Sandeen wrote:
> On 4/1/13 5:26 PM, Steven Haigh wrote:
>> On 04/02/2013 12:19 AM, Josef Bacik wrote:
>>> On Sat, Mar 30, 2013 at 9:38 PM, Steven Haigh <netwiz at crc.id.au> wrote:
>>>> Hi all,
>>>>
>>>> Firstly, Please CC me into replies as I'm not subscribed to this list.
>>>>
>>>> I'm trying to confirm that Fedora 18 has enabled trim for XFS filesystems. I
>>>> have added discard to the mount options in /etc/fstab - however I do not see
>>>> it when looking at the output of 'mount':
>
> ...
>
>>>> Can anyone share some insight into this?
>>>>
>>>
>>> IIRC you have to rebuild your initrd so it picks up the new fstab
>>> mount options for /, the other options is you should be able to do
>>> mount -o remount,discard /.  Thanks,
>>
>> Hi Josef,
>>
>> This was the basis of my query - even after a remount with the
>> discard option, 'discard' still wasn't present in the options - as
>> seen by the mount line quoted above.
>
> Sorry I didn't see this earlier.  Josef is right; discard is not a remountable
> option on xfs, unfortunately (only inode64 and barrier options are remountable
> today).  So you could either put the option in the rootflags= kernel
> commandline parameter, or rebuild the initrd after adding it to fstab
> as Josef suggested so that it's initially mounted with the option.

Thanks for the reply Eric. I believe it would be helpful if this was 
documented. I was expecting it to work the same way as ext4 - being a 
simple remount would enable the discard option. Once that didn't work - 
and especially as I didn't get an error in either the syslog or returned 
from the command, I was starting to think it was a bug in the 
implementation of TRIM in XFS.

> I wonder if we should add something to the remount path to printk when
> a non-remountable option is encountered; I might look into that, otherwise
> it's a little surprising (although semi-obvious when the problem doesn't
> show up in /prcoc/mounts...).

I think this is probably the best way to handle things. The first thing 
I did was to look at the return code from mount (which returned 0 - ie 
success), then dmesg, then /var/log/messages. As I found nothing, I had 
no hints on where to look.

The wiki page[1] for XFS does state that XFS supports TRIM - and it 
mentions the changes to /etc/fstab to enable it. It doesn't however 
mention that it needs to be on the initial mount - or that a remount 
will not enable it.

The best of both worlds would be to have it output to the dmesg - or 
even fail the mount command (if that is an option?) just like ext4 would 
if you supply a bogus option set.

1: http://xfs.org/index.php/FITRIM/discard

-- 
Steven Haigh

Email: netwiz at crc.id.au
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897
Fax: (03) 8338 0299


More information about the devel mailing list