[PATCH 3/3] fat: warn when discard request fails other than EOPNOTSUPP

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

 



FAT also warn user then the discard request fails
as ext4(http://patchwork.ozlabs.org/patch/192669/)

Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxx>
Signed-off-by: Amit Sahrawat <amit.sahrawat83@xxxxxxxxx>
---
 fs/fat/fatent.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index 260705c..fc1f407 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -583,12 +583,15 @@ int fat_free_clusters(struct inode *inode, int cluster)
 			 */
 			if (cluster != fatent.entry + 1) {
 				int nr_clus = fatent.entry - first_cl + 1;
-
-				sb_issue_discard(sb,
-					fat_clus_to_blknr(sbi, first_cl),
-					nr_clus * sbi->sec_per_clus,
-					GFP_NOFS, 0);
-
+				sector_t sblk = fat_clus_to_blknr(sbi, first_cl);
+				sector_t nrblk = nr_clus * sbi->sec_per_clus;
+
+				err = sb_issue_discard(sb,
+						sblk, nrblk, GFP_NOFS, 0);
+				if (err && err != -EOPNOTSUPP)
+					fat_msg(sb, KERN_WARNING, "discard request for"
+							" block:%llu count:%llu failed"
+							" with %d", sblk, nrblk, err);
 				first_cl = cluster;
 			}
 		}
-- 
1.7.9.5

--
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