Re: [PATCH 0/7] Discard requests, v2

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

 



On Mon, 2008-08-11 at 19:25 +0900, OGAWA Hirofumi wrote:
> David Woodhouse <dwmw2@xxxxxxxxxxxxx> writes:
> 
> >> [I don't know whether blkdev_issue_flush()
> >> really want to use (1 << BIO_RW_BARRIER) or not.]
> >
> > I think it seems reasonable, but let's do it in a separate patch. Do you
> > want me to put it in my tree, or will you send it to Jens directly?
> 
> Thanks. Could you put it in your tree

Will do. Can I have it with a signed-off-by?

Now I'm happy that request merging works, I'll stress it a little less,
too...

diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index a8b10ac..0942a54 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -536,6 +536,7 @@ int fat_free_clusters(struct inode *inode, int cluster)
 	struct fat_entry fatent;
 	struct buffer_head *bhs[MAX_BUF_PER_PAGE];
 	int i, err, nr_bhs;
+	int first_cl = cluster;
 
 	nr_bhs = 0;
 	fatent_init(&fatent);
@@ -552,9 +553,15 @@ int fat_free_clusters(struct inode *inode, int cluster)
 			goto error;
 		}
 
-		/* Issue discard for the sectors we no longer care about */
-		sb_issue_discard(sb, fat_clus_to_blknr(sbi, fatent.entry),
-				 sbi->sec_per_clus, NULL);
+		/* Issue discard for the sectors we no longer care about,
+		   batching contiguous clusters into one request */
+		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, NULL);
+			first_cl = cluster;
+		}
 
 		ops->ent_put(&fatent, FAT_ENT_FREE);
 		if (sbi->free_clusters != -1) {


-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@xxxxxxxxx                              Intel Corporation



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