Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-08-06 Thread Tino Reichardt
> > * Dave Kleikamp  wrote:
> > > On 07/28/2012 06:08 AM, Tino Reichardt wrote:
> > > > * Tino Reichardt  wrote:
> > > >> > This patch adds support for the two linux interfaces of the 
> > > >> > discard/TRIM
> > > >> > command for SSD devices and sparse/thinly-provisioned LUNs.
> > > > Fixed a problem when setting minlen in jfs_ioc_trim().
> 
> Oops, setting minlen in jfs_ioc_trim() was again wrong :/
> 
> I changed this
> if (minlen < 0)
>   minlen = 1;
> 
> to this:
> if (minlen <= 0)
>   minlen = 1;
> 
> This is important, since fstrim() sets it to zero.
> 
> 
> Fully working patch is located here:
> http://www.mcmilk.de/projects/jfs-trim/linux-tree/jfs-trim-2012-08-01_v2.diff
> 
> Signed-off-by: Tino Reichardt 


The patch is ready, who will submit it into the mainline?


-- 
regards, TR
--
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/


Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-08-06 Thread Tino Reichardt
  * Dave Kleikamp dave.kleik...@oracle.com wrote:
   On 07/28/2012 06:08 AM, Tino Reichardt wrote:
* Tino Reichardt list-linux-fsde...@mcmilk.de wrote:
 This patch adds support for the two linux interfaces of the 
 discard/TRIM
 command for SSD devices and sparse/thinly-provisioned LUNs.
Fixed a problem when setting minlen in jfs_ioc_trim().
 
 Oops, setting minlen in jfs_ioc_trim() was again wrong :/
 
 I changed this
 if (minlen  0)
   minlen = 1;
 
 to this:
 if (minlen = 0)
   minlen = 1;
 
 This is important, since fstrim() sets it to zero.
 
 
 Fully working patch is located here:
 http://www.mcmilk.de/projects/jfs-trim/linux-tree/jfs-trim-2012-08-01_v2.diff
 
 Signed-off-by: Tino Reichardt list-...@mcmilk.de


The patch is ready, who will submit it into the mainline?


-- 
regards, TR
--
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/


Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-08-01 Thread Tino Reichardt
* Tino Reichardt  wrote:
> * Dave Kleikamp  wrote:
> > On 07/28/2012 06:08 AM, Tino Reichardt wrote:
> > > * Tino Reichardt  wrote:
> > >> > This patch adds support for the two linux interfaces of the 
> > >> > discard/TRIM
> > >> > command for SSD devices and sparse/thinly-provisioned LUNs.
> > > Fixed a problem when setting minlen in jfs_ioc_trim().

Oops, setting minlen in jfs_ioc_trim() was again wrong :/

I changed this
if (minlen < 0)
minlen = 1;

to this:
if (minlen <= 0)
minlen = 1;

This is important, since fstrim() sets it to zero.


Fully working patch is located here:
http://www.mcmilk.de/projects/jfs-trim/linux-tree/jfs-trim-2012-08-01_v2.diff

Signed-off-by: Tino Reichardt 

-- 
regards, TR
--
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/


Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-08-01 Thread Dave Kleikamp


On 08/01/2012 02:29 PM, Tino Reichardt wrote:
> * Dave Kleikamp  wrote:
>> On 07/28/2012 06:08 AM, Tino Reichardt wrote:

>>> +   tt->nblocks = 0; /* mark the current end */
>>> +   for (tt = totrim; tt->nblocks != 0; tt++) {
>>> +   if (!(JFS_SBI(sb)->flag & JFS_DISCARD)) {
>>> +   /* not needed, when online discard is used */
>>
>> Why enter the function at all if JFS_DISCARD is set? But is this really
>> true? Removing files or file fragments that are smaller than
>> minblks_trim will fail to discard them dynamically.
> 
> The other FS can also trim via fstrim(8) when mounted with discard
> option :) It is important, that a user can discard all free blocks, even
> when mounting with discard option. The FS could also be mounted several
> times without discard option, and then there are some ranges, where the
> device isn't informed about these ranges. So the batched discard ioctl()
> is then the only way to change that.
> 
> 
> The comment there was also a bit updated, here is it:
> 
> /* when mounted with online discard, dbFree() will
>  * call jfs_issue_discard() itself */

Ah. This comments makes it clear. I was forgetting that dbFree will
handle this.

Thanks,
Dave
--
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/


Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-08-01 Thread Tino Reichardt
* Dave Kleikamp  wrote:
> On 07/28/2012 06:08 AM, Tino Reichardt wrote:
> > * Tino Reichardt  wrote:
> >> > This patch adds support for the two linux interfaces of the discard/TRIM
> >> > command for SSD devices and sparse/thinly-provisioned LUNs.
> > Fixed a problem when setting minlen in jfs_ioc_trim().
> 
> Overall, I approve of this. checkpatch reports some formatting problems:
> whitespace, long lines, etc. You could probably ignore the warning
> changing printk to pr_err or pr_info, since none of the other JFS code
> does that.

I removed all errors exept the call to simple_strtoull(). Also the
printk() was replaced in super.c with pr_err(). The other files of jfs
could also easily changed to the pr_*() calls... I can make another
patch for it, if wanted :)


> Other comments are inline below. Pending additional input, I can push a
> cleaned-up patch upstream.

That would be nice.

> > 
> > Signed-off-by: Tino Reichardt 
> Acked-by: Dave Kleikamp 

Signed-off-by: Tino Reichardt 


> 
> > 
> >  ...
> > 
> >  
> >  errors=continueKeep going on a filesystem error.
> > -errors=remount-ro  Default. Remount the filesystem read-only on an error.
> > +errors=remount-ro(*)   Default. Remount the filesystem read-only on an 
> > error.
> >  errors=panic   Panic and halt the machine if an error occurs.
> >  
> >  uid=value  Override on-disk uid with specified value
> 
> I don't mind the (*) indicating the defaults. This would be consistent
> with some of the other files in this directory. But we should then
> remove the word "Default", which becomes redundant.

Is done.

> 
> > @@ -35,6 +36,18 @@ umask=value  Override on-disk umask with
> > directories, the execute bit will be set if the corresponding
> > read bit is set.
> >  
> > +discard=minlen This enables/disables the use of discard/TRIM commands.
> > +discardThe discard/TRIM commands are sent to the underlying
> > +nodiscard(*)   block device when blocks are freed. This is useful for 
> > SSD
> > +   devices and sparse/thinly-provisioned LUNs.  The FITRIM ioctl
> > +   command is also available together with the nodiscard option.
> > +   The value of minlen specifies the minimum blockcount, when
> > +   a TRIM command to the block device is considered usefull.
> > +   When no value is given to the discard option, it defaults to
> > +   64 blocks, which means 256KiB in JFS.
> > +   The minlen value of discard overrides the minlen value given
> > +   on an FITRIM ioctl().
> > +
> >  Please send bugs, comments, cards and letters to sha...@linux.vnet.ibm.com.
> 
> Oops, not a problem with your patch. I still have my old email address
> here. I need to remove that.

ACK :)

> 
> > diff -X exclude -urpN linux-git/fs/jfs/jfs_discard.c 
> > linux_jfs-trim/fs/jfs/jfs_discard.c
> > --- linux-git/fs/jfs/jfs_discard.c  1970-01-01 01:00:00.0 +0100
> > +++ linux_jfs-trim/fs/jfs/jfs_discard.c 2012-07-26 22:53:48.640979880 
> > +0200
> > @@ -0,0 +1,119 @@
> > +/*
> > + *   Copyright (C) Tino Reichardt, 2012
> > + *
> > + *   This program is free software;  you can redistribute it and/or modify
> > + *   it under the terms of the GNU General Public License as published by
> > + *   the Free Software Foundation; either version 2 of the License, or
> > + *   (at your option) any later version.
> > + *
> > + *   This program is distributed in the hope that it will be useful,
> > + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> > + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> > + *   the GNU General Public License for more details.
> > + *
> > + *   You should have received a copy of the GNU General Public License
> > + *   along with this program;  if not, write to the Free Software
> > + *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 
> > USA
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "jfs_incore.h"
> > +#include "jfs_superblock.h"
> > +#include "jfs_dmap.h"
> > +#include "jfs_lock.h"
> > +#include "jfs_debug.h"
> 
> Should include "jfs_discard.h" to ensure that the declarations and
> definitions of these functions stay in sync. That would also clean up a
> sparse warning.

Done.
> 
> > +
> > +
> > +/*
> > + * NAME:   jfs_issue_discard()
> > + *
> > + * FUNCTION:   TRIM the specified block range on device, if supported
> > + *
> > + * PARAMETERS:
> > + * ip  - pointer to in-core inode
> > + * blkno   - starting block number to be trimmed (0..N)
> > + * nblocks - number of blocks to be trimmed
> > + *
> > + * RETURN VALUES:
> > + * none
> > + *
> > + * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
> > + */
> > +void jfs_issue_discard(struct inode *ip, u64 blkno, u64 nblocks)
> > +{
> > +   struct super_block *sb = ip->i_sb;
> > +   int r = 0;
> > +
> > +   r = sb_issue_discard(sb, blkno, nblocks, GFP_NOFS, 

Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-08-01 Thread Tino Reichardt
* Dave Kleikamp dave.kleik...@oracle.com wrote:
 On 07/28/2012 06:08 AM, Tino Reichardt wrote:
  * Tino Reichardt list-linux-fsde...@mcmilk.de wrote:
   This patch adds support for the two linux interfaces of the discard/TRIM
   command for SSD devices and sparse/thinly-provisioned LUNs.
  Fixed a problem when setting minlen in jfs_ioc_trim().
 
 Overall, I approve of this. checkpatch reports some formatting problems:
 whitespace, long lines, etc. You could probably ignore the warning
 changing printk to pr_err or pr_info, since none of the other JFS code
 does that.

I removed all errors exept the call to simple_strtoull(). Also the
printk() was replaced in super.c with pr_err(). The other files of jfs
could also easily changed to the pr_*() calls... I can make another
patch for it, if wanted :)


 Other comments are inline below. Pending additional input, I can push a
 cleaned-up patch upstream.

That would be nice.

  
  Signed-off-by: Tino Reichardt list-...@mcmilk.de
 Acked-by: Dave Kleikamp dave.kleik...@oracle.com

Signed-off-by: Tino Reichardt list-...@mcmilk.de


 
  
   ...
  
   
   errors=continueKeep going on a filesystem error.
  -errors=remount-ro  Default. Remount the filesystem read-only on an error.
  +errors=remount-ro(*)   Default. Remount the filesystem read-only on an 
  error.
   errors=panic   Panic and halt the machine if an error occurs.
   
   uid=value  Override on-disk uid with specified value
 
 I don't mind the (*) indicating the defaults. This would be consistent
 with some of the other files in this directory. But we should then
 remove the word Default, which becomes redundant.

Is done.

 
  @@ -35,6 +36,18 @@ umask=value  Override on-disk umask with
  directories, the execute bit will be set if the corresponding
  read bit is set.
   
  +discard=minlen This enables/disables the use of discard/TRIM commands.
  +discardThe discard/TRIM commands are sent to the underlying
  +nodiscard(*)   block device when blocks are freed. This is useful for 
  SSD
  +   devices and sparse/thinly-provisioned LUNs.  The FITRIM ioctl
  +   command is also available together with the nodiscard option.
  +   The value of minlen specifies the minimum blockcount, when
  +   a TRIM command to the block device is considered usefull.
  +   When no value is given to the discard option, it defaults to
  +   64 blocks, which means 256KiB in JFS.
  +   The minlen value of discard overrides the minlen value given
  +   on an FITRIM ioctl().
  +
   Please send bugs, comments, cards and letters to sha...@linux.vnet.ibm.com.
 
 Oops, not a problem with your patch. I still have my old email address
 here. I need to remove that.

ACK :)

 
  diff -X exclude -urpN linux-git/fs/jfs/jfs_discard.c 
  linux_jfs-trim/fs/jfs/jfs_discard.c
  --- linux-git/fs/jfs/jfs_discard.c  1970-01-01 01:00:00.0 +0100
  +++ linux_jfs-trim/fs/jfs/jfs_discard.c 2012-07-26 22:53:48.640979880 
  +0200
  @@ -0,0 +1,119 @@
  +/*
  + *   Copyright (C) Tino Reichardt, 2012
  + *
  + *   This program is free software;  you can redistribute it and/or modify
  + *   it under the terms of the GNU General Public License as published by
  + *   the Free Software Foundation; either version 2 of the License, or
  + *   (at your option) any later version.
  + *
  + *   This program is distributed in the hope that it will be useful,
  + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
  + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
  + *   the GNU General Public License for more details.
  + *
  + *   You should have received a copy of the GNU General Public License
  + *   along with this program;  if not, write to the Free Software
  + *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 
  USA
  + */
  +
  +#include linux/fs.h
  +#include linux/slab.h
  +#include linux/blkdev.h
  +
  +#include jfs_incore.h
  +#include jfs_superblock.h
  +#include jfs_dmap.h
  +#include jfs_lock.h
  +#include jfs_debug.h
 
 Should include jfs_discard.h to ensure that the declarations and
 definitions of these functions stay in sync. That would also clean up a
 sparse warning.

Done.
 
  +
  +
  +/*
  + * NAME:   jfs_issue_discard()
  + *
  + * FUNCTION:   TRIM the specified block range on device, if supported
  + *
  + * PARAMETERS:
  + * ip  - pointer to in-core inode
  + * blkno   - starting block number to be trimmed (0..N)
  + * nblocks - number of blocks to be trimmed
  + *
  + * RETURN VALUES:
  + * none
  + *
  + * serialization: IREAD_LOCK(ipbmap) held on entry/exit;
  + */
  +void jfs_issue_discard(struct inode *ip, u64 blkno, u64 nblocks)
  +{
  +   struct super_block *sb = ip-i_sb;
  +   int r = 0;
  +
  +   r = sb_issue_discard(sb, blkno, nblocks, GFP_NOFS, 0);
  +   if (unlikely(r != 0)) {
  +   printk(KERN_ERR JFS: 

Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-08-01 Thread Dave Kleikamp


On 08/01/2012 02:29 PM, Tino Reichardt wrote:
 * Dave Kleikamp dave.kleik...@oracle.com wrote:
 On 07/28/2012 06:08 AM, Tino Reichardt wrote:

 +   tt-nblocks = 0; /* mark the current end */
 +   for (tt = totrim; tt-nblocks != 0; tt++) {
 +   if (!(JFS_SBI(sb)-flag  JFS_DISCARD)) {
 +   /* not needed, when online discard is used */

 Why enter the function at all if JFS_DISCARD is set? But is this really
 true? Removing files or file fragments that are smaller than
 minblks_trim will fail to discard them dynamically.
 
 The other FS can also trim via fstrim(8) when mounted with discard
 option :) It is important, that a user can discard all free blocks, even
 when mounting with discard option. The FS could also be mounted several
 times without discard option, and then there are some ranges, where the
 device isn't informed about these ranges. So the batched discard ioctl()
 is then the only way to change that.
 
 
 The comment there was also a bit updated, here is it:
 
 /* when mounted with online discard, dbFree() will
  * call jfs_issue_discard() itself */

Ah. This comments makes it clear. I was forgetting that dbFree will
handle this.

Thanks,
Dave
--
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/


Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-08-01 Thread Tino Reichardt
* Tino Reichardt list-linux-fsde...@mcmilk.de wrote:
 * Dave Kleikamp dave.kleik...@oracle.com wrote:
  On 07/28/2012 06:08 AM, Tino Reichardt wrote:
   * Tino Reichardt list-linux-fsde...@mcmilk.de wrote:
This patch adds support for the two linux interfaces of the 
discard/TRIM
command for SSD devices and sparse/thinly-provisioned LUNs.
   Fixed a problem when setting minlen in jfs_ioc_trim().

Oops, setting minlen in jfs_ioc_trim() was again wrong :/

I changed this
if (minlen  0)
minlen = 1;

to this:
if (minlen = 0)
minlen = 1;

This is important, since fstrim() sets it to zero.


Fully working patch is located here:
http://www.mcmilk.de/projects/jfs-trim/linux-tree/jfs-trim-2012-08-01_v2.diff

Signed-off-by: Tino Reichardt list-...@mcmilk.de

-- 
regards, TR
--
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/


Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-07-31 Thread Dave Kleikamp
On 07/28/2012 06:08 AM, Tino Reichardt wrote:
> * Tino Reichardt  wrote:
>> > This patch adds support for the two linux interfaces of the discard/TRIM
>> > command for SSD devices and sparse/thinly-provisioned LUNs.
> Fixed a problem when setting minlen in jfs_ioc_trim().

Overall, I approve of this. checkpatch reports some formatting problems:
whitespace, long lines, etc. You could probably ignore the warning
changing printk to pr_err or pr_info, since none of the other JFS code
does that.

Other comments are inline below. Pending additional input, I can push a
cleaned-up patch upstream.

> 
> Signed-off-by: Tino Reichardt 
Acked-by: Dave Kleikamp 

> 
> 
> -- regards, TR
> 
> 
> jfs-trim-2012-07-28.diff
> 
> 
> diff -X exclude -urpN linux-git/Documentation/filesystems/jfs.txt 
> linux_jfs-trim/Documentation/filesystems/jfs.txt
> --- linux-git/Documentation/filesystems/jfs.txt   2011-03-01 
> 10:22:59.0 +0100
> +++ linux_jfs-trim/Documentation/filesystems/jfs.txt  2012-07-26 
> 22:52:33.244721671 +0200
> @@ -3,6 +3,7 @@ IBM's Journaled File System (JFS) for Li
>  JFS Homepage:  http://jfs.sourceforge.net/
>  
>  The following mount options are supported:
> +(*) == default
>  
>  iocharset=name   Character set to use for converting from Unicode to
>   ASCII.  The default is to do no conversion.  Use
> @@ -21,12 +22,12 @@ nointegrity   Do not write to the journal.
>   from backup media.  The integrity of the volume is not
>   guaranteed if the system abnormally abends.
>  
> -integrityDefault.  Commit metadata changes to the journal.  Use this
> +integrity(*) Default.  Commit metadata changes to the journal.  Use this
>   option to remount a volume where the nointegrity option was
>   previously specified in order to restore normal behavior.
>  
>  errors=continue  Keep going on a filesystem error.
> -errors=remount-roDefault. Remount the filesystem read-only on an error.
> +errors=remount-ro(*) Default. Remount the filesystem read-only on an error.
>  errors=panic Panic and halt the machine if an error occurs.
>  
>  uid=valueOverride on-disk uid with specified value

I don't mind the (*) indicating the defaults. This would be consistent
with some of the other files in this directory. But we should then
remove the word "Default", which becomes redundant.

> @@ -35,6 +36,18 @@ umask=valueOverride on-disk umask with
>   directories, the execute bit will be set if the corresponding
>   read bit is set.
>  
> +discard=minlen   This enables/disables the use of discard/TRIM commands.
> +discard  The discard/TRIM commands are sent to the underlying
> +nodiscard(*) block device when blocks are freed. This is useful for SSD
> + devices and sparse/thinly-provisioned LUNs.  The FITRIM ioctl
> + command is also available together with the nodiscard option.
> + The value of minlen specifies the minimum blockcount, when
> + a TRIM command to the block device is considered usefull.
> + When no value is given to the discard option, it defaults to
> + 64 blocks, which means 256KiB in JFS.
> + The minlen value of discard overrides the minlen value given
> + on an FITRIM ioctl().
> +
>  Please send bugs, comments, cards and letters to sha...@linux.vnet.ibm.com.

Oops, not a problem with your patch. I still have my old email address
here. I need to remove that.

>  The JFS mailing list can be subscribed to by using the link labeled
> diff -X exclude -urpN linux-git/fs/jfs/Makefile linux_jfs-trim/fs/jfs/Makefile
> --- linux-git/fs/jfs/Makefile 2011-08-17 07:31:10.0 +0200
> +++ linux_jfs-trim/fs/jfs/Makefile2012-07-26 22:53:48.640979880 +0200
> @@ -6,7 +6,7 @@ obj-$(CONFIG_JFS_FS) += jfs.o
>  
>  jfs-y:= super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
>   jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
> - jfs_unicode.o jfs_dtree.o jfs_inode.o \
> + jfs_unicode.o jfs_dtree.o jfs_inode.o jfs_discard.o \
>   jfs_extent.o symlink.o jfs_metapage.o \
>   jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
>   resize.o xattr.o ioctl.o
> diff -X exclude -urpN linux-git/fs/jfs/ioctl.c linux_jfs-trim/fs/jfs/ioctl.c
> --- linux-git/fs/jfs/ioctl.c  2012-01-10 19:31:59.0 +0100
> +++ linux_jfs-trim/fs/jfs/ioctl.c 2012-07-26 22:53:48.640979880 +0200
> @@ -11,13 +11,17 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> +#include "jfs_filsys.h"
> +#include "jfs_debug.h"
>  #include "jfs_incore.h"
>  #include "jfs_dinode.h"
>  #include "jfs_inode.h"
> -
> +#include "jfs_dmap.h"
> +#include "jfs_discard.h"
>  
>  static struct {
>   long jfs_flag;
> @@ -123,6 +127,40 @@ setflags_out:
>   mnt_drop_write_file(filp);
>   return err;
>   }
> +
> + case 

Re: [Jfs-discussion] [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-07-31 Thread Dave Kleikamp
On 07/28/2012 06:08 AM, Tino Reichardt wrote:
 * Tino Reichardt list-linux-fsde...@mcmilk.de wrote:
  This patch adds support for the two linux interfaces of the discard/TRIM
  command for SSD devices and sparse/thinly-provisioned LUNs.
 Fixed a problem when setting minlen in jfs_ioc_trim().

Overall, I approve of this. checkpatch reports some formatting problems:
whitespace, long lines, etc. You could probably ignore the warning
changing printk to pr_err or pr_info, since none of the other JFS code
does that.

Other comments are inline below. Pending additional input, I can push a
cleaned-up patch upstream.

 
 Signed-off-by: Tino Reichardt list-...@mcmilk.de
Acked-by: Dave Kleikamp dave.kleik...@oracle.com

 
 
 -- regards, TR
 
 
 jfs-trim-2012-07-28.diff
 
 
 diff -X exclude -urpN linux-git/Documentation/filesystems/jfs.txt 
 linux_jfs-trim/Documentation/filesystems/jfs.txt
 --- linux-git/Documentation/filesystems/jfs.txt   2011-03-01 
 10:22:59.0 +0100
 +++ linux_jfs-trim/Documentation/filesystems/jfs.txt  2012-07-26 
 22:52:33.244721671 +0200
 @@ -3,6 +3,7 @@ IBM's Journaled File System (JFS) for Li
  JFS Homepage:  http://jfs.sourceforge.net/
  
  The following mount options are supported:
 +(*) == default
  
  iocharset=name   Character set to use for converting from Unicode to
   ASCII.  The default is to do no conversion.  Use
 @@ -21,12 +22,12 @@ nointegrity   Do not write to the journal.
   from backup media.  The integrity of the volume is not
   guaranteed if the system abnormally abends.
  
 -integrityDefault.  Commit metadata changes to the journal.  Use this
 +integrity(*) Default.  Commit metadata changes to the journal.  Use this
   option to remount a volume where the nointegrity option was
   previously specified in order to restore normal behavior.
  
  errors=continue  Keep going on a filesystem error.
 -errors=remount-roDefault. Remount the filesystem read-only on an error.
 +errors=remount-ro(*) Default. Remount the filesystem read-only on an error.
  errors=panic Panic and halt the machine if an error occurs.
  
  uid=valueOverride on-disk uid with specified value

I don't mind the (*) indicating the defaults. This would be consistent
with some of the other files in this directory. But we should then
remove the word Default, which becomes redundant.

 @@ -35,6 +36,18 @@ umask=valueOverride on-disk umask with
   directories, the execute bit will be set if the corresponding
   read bit is set.
  
 +discard=minlen   This enables/disables the use of discard/TRIM commands.
 +discard  The discard/TRIM commands are sent to the underlying
 +nodiscard(*) block device when blocks are freed. This is useful for SSD
 + devices and sparse/thinly-provisioned LUNs.  The FITRIM ioctl
 + command is also available together with the nodiscard option.
 + The value of minlen specifies the minimum blockcount, when
 + a TRIM command to the block device is considered usefull.
 + When no value is given to the discard option, it defaults to
 + 64 blocks, which means 256KiB in JFS.
 + The minlen value of discard overrides the minlen value given
 + on an FITRIM ioctl().
 +
  Please send bugs, comments, cards and letters to sha...@linux.vnet.ibm.com.

Oops, not a problem with your patch. I still have my old email address
here. I need to remove that.

  The JFS mailing list can be subscribed to by using the link labeled
 diff -X exclude -urpN linux-git/fs/jfs/Makefile linux_jfs-trim/fs/jfs/Makefile
 --- linux-git/fs/jfs/Makefile 2011-08-17 07:31:10.0 +0200
 +++ linux_jfs-trim/fs/jfs/Makefile2012-07-26 22:53:48.640979880 +0200
 @@ -6,7 +6,7 @@ obj-$(CONFIG_JFS_FS) += jfs.o
  
  jfs-y:= super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
   jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
 - jfs_unicode.o jfs_dtree.o jfs_inode.o \
 + jfs_unicode.o jfs_dtree.o jfs_inode.o jfs_discard.o \
   jfs_extent.o symlink.o jfs_metapage.o \
   jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
   resize.o xattr.o ioctl.o
 diff -X exclude -urpN linux-git/fs/jfs/ioctl.c linux_jfs-trim/fs/jfs/ioctl.c
 --- linux-git/fs/jfs/ioctl.c  2012-01-10 19:31:59.0 +0100
 +++ linux_jfs-trim/fs/jfs/ioctl.c 2012-07-26 22:53:48.640979880 +0200
 @@ -11,13 +11,17 @@
  #include linux/mount.h
  #include linux/time.h
  #include linux/sched.h
 +#include linux/blkdev.h
  #include asm/current.h
  #include asm/uaccess.h
  
 +#include jfs_filsys.h
 +#include jfs_debug.h
  #include jfs_incore.h
  #include jfs_dinode.h
  #include jfs_inode.h
 -
 +#include jfs_dmap.h
 +#include jfs_discard.h
  
  static struct {
   long jfs_flag;
 @@ -123,6 +127,40 @@ setflags_out:
   mnt_drop_write_file(filp);
   return 

Re: [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-07-28 Thread Tino Reichardt
* Tino Reichardt  wrote:
> This patch adds support for the two linux interfaces of the discard/TRIM
> command for SSD devices and sparse/thinly-provisioned LUNs.

Fixed a problem when setting minlen in jfs_ioc_trim().

Signed-off-by: Tino Reichardt 


-- 
regards, TR
diff -X exclude -urpN linux-git/Documentation/filesystems/jfs.txt 
linux_jfs-trim/Documentation/filesystems/jfs.txt
--- linux-git/Documentation/filesystems/jfs.txt 2011-03-01 10:22:59.0 
+0100
+++ linux_jfs-trim/Documentation/filesystems/jfs.txt2012-07-26 
22:52:33.244721671 +0200
@@ -3,6 +3,7 @@ IBM's Journaled File System (JFS) for Li
 JFS Homepage:  http://jfs.sourceforge.net/
 
 The following mount options are supported:
+(*) == default
 
 iocharset=name Character set to use for converting from Unicode to
ASCII.  The default is to do no conversion.  Use
@@ -21,12 +22,12 @@ nointegrity Do not write to the journal.
from backup media.  The integrity of the volume is not
guaranteed if the system abnormally abends.
 
-integrity  Default.  Commit metadata changes to the journal.  Use this
+integrity(*)   Default.  Commit metadata changes to the journal.  Use this
option to remount a volume where the nointegrity option was
previously specified in order to restore normal behavior.
 
 errors=continueKeep going on a filesystem error.
-errors=remount-ro  Default. Remount the filesystem read-only on an error.
+errors=remount-ro(*)   Default. Remount the filesystem read-only on an error.
 errors=panic   Panic and halt the machine if an error occurs.
 
 uid=value  Override on-disk uid with specified value
@@ -35,6 +36,18 @@ umask=value  Override on-disk umask with
directories, the execute bit will be set if the corresponding
read bit is set.
 
+discard=minlen This enables/disables the use of discard/TRIM commands.
+discardThe discard/TRIM commands are sent to the underlying
+nodiscard(*)   block device when blocks are freed. This is useful for SSD
+   devices and sparse/thinly-provisioned LUNs.  The FITRIM ioctl
+   command is also available together with the nodiscard option.
+   The value of minlen specifies the minimum blockcount, when
+   a TRIM command to the block device is considered usefull.
+   When no value is given to the discard option, it defaults to
+   64 blocks, which means 256KiB in JFS.
+   The minlen value of discard overrides the minlen value given
+   on an FITRIM ioctl().
+
 Please send bugs, comments, cards and letters to sha...@linux.vnet.ibm.com.
 
 The JFS mailing list can be subscribed to by using the link labeled
diff -X exclude -urpN linux-git/fs/jfs/Makefile linux_jfs-trim/fs/jfs/Makefile
--- linux-git/fs/jfs/Makefile   2011-08-17 07:31:10.0 +0200
+++ linux_jfs-trim/fs/jfs/Makefile  2012-07-26 22:53:48.640979880 +0200
@@ -6,7 +6,7 @@ obj-$(CONFIG_JFS_FS) += jfs.o
 
 jfs-y:= super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
-   jfs_unicode.o jfs_dtree.o jfs_inode.o \
+   jfs_unicode.o jfs_dtree.o jfs_inode.o jfs_discard.o \
jfs_extent.o symlink.o jfs_metapage.o \
jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
resize.o xattr.o ioctl.o
diff -X exclude -urpN linux-git/fs/jfs/ioctl.c linux_jfs-trim/fs/jfs/ioctl.c
--- linux-git/fs/jfs/ioctl.c2012-01-10 19:31:59.0 +0100
+++ linux_jfs-trim/fs/jfs/ioctl.c   2012-07-26 22:53:48.640979880 +0200
@@ -11,13 +11,17 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+#include "jfs_filsys.h"
+#include "jfs_debug.h"
 #include "jfs_incore.h"
 #include "jfs_dinode.h"
 #include "jfs_inode.h"
-
+#include "jfs_dmap.h"
+#include "jfs_discard.h"
 
 static struct {
long jfs_flag;
@@ -123,6 +127,40 @@ setflags_out:
mnt_drop_write_file(filp);
return err;
}
+
+   case FITRIM:
+   {
+   struct super_block *sb = inode->i_sb;
+   struct request_queue *q = bdev_get_queue(sb->s_bdev);
+   struct fstrim_range range;
+   s64 ret = 0;
+
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
+
+   if (!blk_queue_discard(q)) {
+   jfs_warn("FITRIM not supported on device");
+   return -EOPNOTSUPP;
+   }
+
+   if (copy_from_user(, (struct fstrim_range __user *)arg,
+   sizeof(range)))
+   return -EFAULT;
+
+   range.minlen = max((unsigned int)range.minlen,
+  q->limits.discard_granularity);
+
+   ret = jfs_ioc_trim(inode, );
+   if (ret < 0)
+   return 

Re: [PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-07-28 Thread Tino Reichardt
* Tino Reichardt list-linux-fsde...@mcmilk.de wrote:
 This patch adds support for the two linux interfaces of the discard/TRIM
 command for SSD devices and sparse/thinly-provisioned LUNs.

Fixed a problem when setting minlen in jfs_ioc_trim().

Signed-off-by: Tino Reichardt list-...@mcmilk.de


-- 
regards, TR
diff -X exclude -urpN linux-git/Documentation/filesystems/jfs.txt 
linux_jfs-trim/Documentation/filesystems/jfs.txt
--- linux-git/Documentation/filesystems/jfs.txt 2011-03-01 10:22:59.0 
+0100
+++ linux_jfs-trim/Documentation/filesystems/jfs.txt2012-07-26 
22:52:33.244721671 +0200
@@ -3,6 +3,7 @@ IBM's Journaled File System (JFS) for Li
 JFS Homepage:  http://jfs.sourceforge.net/
 
 The following mount options are supported:
+(*) == default
 
 iocharset=name Character set to use for converting from Unicode to
ASCII.  The default is to do no conversion.  Use
@@ -21,12 +22,12 @@ nointegrity Do not write to the journal.
from backup media.  The integrity of the volume is not
guaranteed if the system abnormally abends.
 
-integrity  Default.  Commit metadata changes to the journal.  Use this
+integrity(*)   Default.  Commit metadata changes to the journal.  Use this
option to remount a volume where the nointegrity option was
previously specified in order to restore normal behavior.
 
 errors=continueKeep going on a filesystem error.
-errors=remount-ro  Default. Remount the filesystem read-only on an error.
+errors=remount-ro(*)   Default. Remount the filesystem read-only on an error.
 errors=panic   Panic and halt the machine if an error occurs.
 
 uid=value  Override on-disk uid with specified value
@@ -35,6 +36,18 @@ umask=value  Override on-disk umask with
directories, the execute bit will be set if the corresponding
read bit is set.
 
+discard=minlen This enables/disables the use of discard/TRIM commands.
+discardThe discard/TRIM commands are sent to the underlying
+nodiscard(*)   block device when blocks are freed. This is useful for SSD
+   devices and sparse/thinly-provisioned LUNs.  The FITRIM ioctl
+   command is also available together with the nodiscard option.
+   The value of minlen specifies the minimum blockcount, when
+   a TRIM command to the block device is considered usefull.
+   When no value is given to the discard option, it defaults to
+   64 blocks, which means 256KiB in JFS.
+   The minlen value of discard overrides the minlen value given
+   on an FITRIM ioctl().
+
 Please send bugs, comments, cards and letters to sha...@linux.vnet.ibm.com.
 
 The JFS mailing list can be subscribed to by using the link labeled
diff -X exclude -urpN linux-git/fs/jfs/Makefile linux_jfs-trim/fs/jfs/Makefile
--- linux-git/fs/jfs/Makefile   2011-08-17 07:31:10.0 +0200
+++ linux_jfs-trim/fs/jfs/Makefile  2012-07-26 22:53:48.640979880 +0200
@@ -6,7 +6,7 @@ obj-$(CONFIG_JFS_FS) += jfs.o
 
 jfs-y:= super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
-   jfs_unicode.o jfs_dtree.o jfs_inode.o \
+   jfs_unicode.o jfs_dtree.o jfs_inode.o jfs_discard.o \
jfs_extent.o symlink.o jfs_metapage.o \
jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
resize.o xattr.o ioctl.o
diff -X exclude -urpN linux-git/fs/jfs/ioctl.c linux_jfs-trim/fs/jfs/ioctl.c
--- linux-git/fs/jfs/ioctl.c2012-01-10 19:31:59.0 +0100
+++ linux_jfs-trim/fs/jfs/ioctl.c   2012-07-26 22:53:48.640979880 +0200
@@ -11,13 +11,17 @@
 #include linux/mount.h
 #include linux/time.h
 #include linux/sched.h
+#include linux/blkdev.h
 #include asm/current.h
 #include asm/uaccess.h
 
+#include jfs_filsys.h
+#include jfs_debug.h
 #include jfs_incore.h
 #include jfs_dinode.h
 #include jfs_inode.h
-
+#include jfs_dmap.h
+#include jfs_discard.h
 
 static struct {
long jfs_flag;
@@ -123,6 +127,40 @@ setflags_out:
mnt_drop_write_file(filp);
return err;
}
+
+   case FITRIM:
+   {
+   struct super_block *sb = inode-i_sb;
+   struct request_queue *q = bdev_get_queue(sb-s_bdev);
+   struct fstrim_range range;
+   s64 ret = 0;
+
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
+
+   if (!blk_queue_discard(q)) {
+   jfs_warn(FITRIM not supported on device);
+   return -EOPNOTSUPP;
+   }
+
+   if (copy_from_user(range, (struct fstrim_range __user *)arg,
+   sizeof(range)))
+   return -EFAULT;
+
+   range.minlen = max((unsigned int)range.minlen,
+  q-limits.discard_granularity);
+

[PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-07-26 Thread Tino Reichardt
This patch adds support for the two linux interfaces of the discard/TRIM
command for SSD devices and sparse/thinly-provisioned LUNs.

JFS will support batched discard via FITRIM ioctl and online discard
with the discard mount option.

I also think that a short description of the FITRIM ioctl should it made
into Documetation/ioctl/fitrim.txt - but that would be part of some
other patch. Maybe from Lukas Czerner?

For the online discard, you can also specify the minimum number of
blocks. Everything of it is described in
Documentation/filesystems/jfs.txt... so I am not writing it again in
that mail.

So than, maybe some other can stress-test JFS on some SSD as well?


Signed-off-by: Tino Reichardt 

PS: Sorry for my bad english ;)

-- 
regards, TR
diff -X exclude -urpN linux-git/Documentation/filesystems/jfs.txt 
linux_jfs-trim/Documentation/filesystems/jfs.txt
--- linux-git/Documentation/filesystems/jfs.txt 2011-03-01 10:22:59.0 
+0100
+++ linux_jfs-trim/Documentation/filesystems/jfs.txt2012-07-26 
22:52:33.244721671 +0200
@@ -3,6 +3,7 @@ IBM's Journaled File System (JFS) for Li
 JFS Homepage:  http://jfs.sourceforge.net/
 
 The following mount options are supported:
+(*) == default
 
 iocharset=name Character set to use for converting from Unicode to
ASCII.  The default is to do no conversion.  Use
@@ -21,12 +22,12 @@ nointegrity Do not write to the journal.
from backup media.  The integrity of the volume is not
guaranteed if the system abnormally abends.
 
-integrity  Default.  Commit metadata changes to the journal.  Use this
+integrity(*)   Default.  Commit metadata changes to the journal.  Use this
option to remount a volume where the nointegrity option was
previously specified in order to restore normal behavior.
 
 errors=continueKeep going on a filesystem error.
-errors=remount-ro  Default. Remount the filesystem read-only on an error.
+errors=remount-ro(*)   Default. Remount the filesystem read-only on an error.
 errors=panic   Panic and halt the machine if an error occurs.
 
 uid=value  Override on-disk uid with specified value
@@ -35,6 +36,18 @@ umask=value  Override on-disk umask with
directories, the execute bit will be set if the corresponding
read bit is set.
 
+discard=minlen This enables/disables the use of discard/TRIM commands.
+discardThe discard/TRIM commands are sent to the underlying
+nodiscard(*)   block device when blocks are freed. This is useful for SSD
+   devices and sparse/thinly-provisioned LUNs.  The FITRIM ioctl
+   command is also available together with the nodiscard option.
+   The value of minlen specifies the minimum blockcount, when
+   a TRIM command to the block device is considered usefull.
+   When no value is given to the discard option, it defaults to
+   64 blocks, which means 256KiB in JFS.
+   The minlen value of discard overrides the minlen value given
+   on an FITRIM ioctl().
+
 Please send bugs, comments, cards and letters to sha...@linux.vnet.ibm.com.
 
 The JFS mailing list can be subscribed to by using the link labeled
diff -X exclude -urpN linux-git/fs/jfs/Makefile linux_jfs-trim/fs/jfs/Makefile
--- linux-git/fs/jfs/Makefile   2011-08-17 07:31:10.0 +0200
+++ linux_jfs-trim/fs/jfs/Makefile  2012-07-26 22:53:48.640979880 +0200
@@ -6,7 +6,7 @@ obj-$(CONFIG_JFS_FS) += jfs.o
 
 jfs-y:= super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
-   jfs_unicode.o jfs_dtree.o jfs_inode.o \
+   jfs_unicode.o jfs_dtree.o jfs_inode.o jfs_discard.o \
jfs_extent.o symlink.o jfs_metapage.o \
jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
resize.o xattr.o ioctl.o
diff -X exclude -urpN linux-git/fs/jfs/ioctl.c linux_jfs-trim/fs/jfs/ioctl.c
--- linux-git/fs/jfs/ioctl.c2012-01-10 19:31:59.0 +0100
+++ linux_jfs-trim/fs/jfs/ioctl.c   2012-07-26 22:53:48.640979880 +0200
@@ -11,13 +11,17 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+#include "jfs_filsys.h"
+#include "jfs_debug.h"
 #include "jfs_incore.h"
 #include "jfs_dinode.h"
 #include "jfs_inode.h"
-
+#include "jfs_dmap.h"
+#include "jfs_discard.h"
 
 static struct {
long jfs_flag;
@@ -123,6 +127,40 @@ setflags_out:
mnt_drop_write_file(filp);
return err;
}
+
+   case FITRIM:
+   {
+   struct super_block *sb = inode->i_sb;
+   struct request_queue *q = bdev_get_queue(sb->s_bdev);
+   struct fstrim_range range;
+   s64 ret = 0;
+
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
+
+   if (!blk_queue_discard(q)) {
+   

[PATCH] fs/jfs: TRIM support for JFS Filesystem

2012-07-26 Thread Tino Reichardt
This patch adds support for the two linux interfaces of the discard/TRIM
command for SSD devices and sparse/thinly-provisioned LUNs.

JFS will support batched discard via FITRIM ioctl and online discard
with the discard mount option.

I also think that a short description of the FITRIM ioctl should it made
into Documetation/ioctl/fitrim.txt - but that would be part of some
other patch. Maybe from Lukas Czerner?

For the online discard, you can also specify the minimum number of
blocks. Everything of it is described in
Documentation/filesystems/jfs.txt... so I am not writing it again in
that mail.

So than, maybe some other can stress-test JFS on some SSD as well?


Signed-off-by: Tino Reichardt list-...@mcmilk.de

PS: Sorry for my bad english ;)

-- 
regards, TR
diff -X exclude -urpN linux-git/Documentation/filesystems/jfs.txt 
linux_jfs-trim/Documentation/filesystems/jfs.txt
--- linux-git/Documentation/filesystems/jfs.txt 2011-03-01 10:22:59.0 
+0100
+++ linux_jfs-trim/Documentation/filesystems/jfs.txt2012-07-26 
22:52:33.244721671 +0200
@@ -3,6 +3,7 @@ IBM's Journaled File System (JFS) for Li
 JFS Homepage:  http://jfs.sourceforge.net/
 
 The following mount options are supported:
+(*) == default
 
 iocharset=name Character set to use for converting from Unicode to
ASCII.  The default is to do no conversion.  Use
@@ -21,12 +22,12 @@ nointegrity Do not write to the journal.
from backup media.  The integrity of the volume is not
guaranteed if the system abnormally abends.
 
-integrity  Default.  Commit metadata changes to the journal.  Use this
+integrity(*)   Default.  Commit metadata changes to the journal.  Use this
option to remount a volume where the nointegrity option was
previously specified in order to restore normal behavior.
 
 errors=continueKeep going on a filesystem error.
-errors=remount-ro  Default. Remount the filesystem read-only on an error.
+errors=remount-ro(*)   Default. Remount the filesystem read-only on an error.
 errors=panic   Panic and halt the machine if an error occurs.
 
 uid=value  Override on-disk uid with specified value
@@ -35,6 +36,18 @@ umask=value  Override on-disk umask with
directories, the execute bit will be set if the corresponding
read bit is set.
 
+discard=minlen This enables/disables the use of discard/TRIM commands.
+discardThe discard/TRIM commands are sent to the underlying
+nodiscard(*)   block device when blocks are freed. This is useful for SSD
+   devices and sparse/thinly-provisioned LUNs.  The FITRIM ioctl
+   command is also available together with the nodiscard option.
+   The value of minlen specifies the minimum blockcount, when
+   a TRIM command to the block device is considered usefull.
+   When no value is given to the discard option, it defaults to
+   64 blocks, which means 256KiB in JFS.
+   The minlen value of discard overrides the minlen value given
+   on an FITRIM ioctl().
+
 Please send bugs, comments, cards and letters to sha...@linux.vnet.ibm.com.
 
 The JFS mailing list can be subscribed to by using the link labeled
diff -X exclude -urpN linux-git/fs/jfs/Makefile linux_jfs-trim/fs/jfs/Makefile
--- linux-git/fs/jfs/Makefile   2011-08-17 07:31:10.0 +0200
+++ linux_jfs-trim/fs/jfs/Makefile  2012-07-26 22:53:48.640979880 +0200
@@ -6,7 +6,7 @@ obj-$(CONFIG_JFS_FS) += jfs.o
 
 jfs-y:= super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
-   jfs_unicode.o jfs_dtree.o jfs_inode.o \
+   jfs_unicode.o jfs_dtree.o jfs_inode.o jfs_discard.o \
jfs_extent.o symlink.o jfs_metapage.o \
jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
resize.o xattr.o ioctl.o
diff -X exclude -urpN linux-git/fs/jfs/ioctl.c linux_jfs-trim/fs/jfs/ioctl.c
--- linux-git/fs/jfs/ioctl.c2012-01-10 19:31:59.0 +0100
+++ linux_jfs-trim/fs/jfs/ioctl.c   2012-07-26 22:53:48.640979880 +0200
@@ -11,13 +11,17 @@
 #include linux/mount.h
 #include linux/time.h
 #include linux/sched.h
+#include linux/blkdev.h
 #include asm/current.h
 #include asm/uaccess.h
 
+#include jfs_filsys.h
+#include jfs_debug.h
 #include jfs_incore.h
 #include jfs_dinode.h
 #include jfs_inode.h
-
+#include jfs_dmap.h
+#include jfs_discard.h
 
 static struct {
long jfs_flag;
@@ -123,6 +127,40 @@ setflags_out:
mnt_drop_write_file(filp);
return err;
}
+
+   case FITRIM:
+   {
+   struct super_block *sb = inode-i_sb;
+   struct request_queue *q = bdev_get_queue(sb-s_bdev);
+   struct fstrim_range range;
+   s64 ret = 0;
+
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
+