Skip to contentSkip to conversation

fat: warn when discard request fails other than EOPNOTSUPP

PATCH In review Namjae Jeon 2 participants 3 messages Nov 3, 2012 – Nov 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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

---
 fs/fat/fatent.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
fs/fat/fatent.c +9 -6
index 260705c..fc1f407 100644
@@ -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;
 			}
 		}
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 2 lines · Namjae Jeon

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

Why don't we do this at block layer like normal bio?

Quoted 32 lines
---
 fs/fat/fatent.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
fs/fat/fatent.c +9 -6
index 260705c..fc1f407 100644
@@ -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;
 			}
 		}
Signature · 1 line
OGAWA Hirofumi <[email protected]>
#2 lore raw

2012/11/5 OGAWA Hirofumi <[email protected]>:

Quoted 6 lines
Quoted 2 lines · Namjae Jeon

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

Why don't we do this at block layer like normal bio?

Yes, maybe it will be better than doing in filesystem. I will check more.
Thanks.

Quoted 36 lines
Quoted 23 lines
---
 fs/fat/fatent.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
fs/fat/fatent.c +2 -6
index 260705c..fc1f407 100644
@@ -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;

fs/fat/fatent.c int fat_free_clusters(struct inode *inode, int cluster) · line 597

Quoted 10 lines
fs/fat/fatent.c +7 -0
+
+                             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;
                      }
              }

--
OGAWA Hirofumi <[email protected]>