Re: [PATCH 2/5] [FAT] Let the block device know when sectors can be discarded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Woodhouse <dwmw2@xxxxxxxxxxxxx> writes:

> @@ -540,6 +541,11 @@ int fat_free_clusters(struct inode *inode, int cluster)
>  	fatent_init(&fatent);
>  	lock_fat(sbi);
>  	do {
> +		/* Issue discard for the sectors we no longer care about */
> +		blkdev_issue_discard(sb->s_bdev,
> +				     fat_clus_to_blknr(sbi, cluster),
> +				     sbi->sec_per_clus, NULL);
> +
>  		cluster = fat_ent_read(inode, &fatent, cluster);
>  		if (cluster < 0) {
>  			err = cluster;

Perhaps, after checking cluster-chain corruption is better. Thanks.

Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>
[just tweak]
Signed-off-by: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
---

 fs/fat/fatent.c |    5 +++++
 1 file changed, 5 insertions(+)

diff -puN fs/fat/fatent.c~test fs/fat/fatent.c
--- linux-2.6/fs/fat/fatent.c~test	2008-08-07 01:24:23.000000000 +0900
+++ linux-2.6-hirofumi/fs/fat/fatent.c	2008-08-07 01:33:07.000000000 +0900
@@ -551,6 +551,11 @@ int fat_free_clusters(struct inode *inod
 			goto error;
 		}
 
+		/* Issue discard for the sectors we no longer care about */
+		blkdev_issue_discard(sb->s_bdev,
+				     fat_clus_to_blknr(sbi, fatent.entry),
+				     sbi->sec_per_clus, NULL);
+
 		ops->ent_put(&fatent, FAT_ENT_FREE);
 		if (sbi->free_clusters != -1) {
 			sbi->free_clusters++;
_
-- 
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux