Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 110448
b: refs/heads/master
c: 8c540a9
h: refs/heads/master
v: v3
  • Loading branch information
David Woodhouse authored and Jens Axboe committed Oct 9, 2008
1 parent 9b17710 commit 1244cca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb2dce862d9f9a68e6b9374579056ec9eca02a63
refs/heads/master: 8c540a96c175bdf55bda8707db04cec78b816454
14 changes: 14 additions & 0 deletions trunk/fs/fat/fatent.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/msdos_fs.h>
#include <linux/blkdev.h>

struct fatent_operations {
void (*ent_blocknr)(struct super_block *, int, int *, sector_t *);
Expand Down Expand Up @@ -535,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);
Expand All @@ -551,6 +553,18 @@ int fat_free_clusters(struct inode *inode, int cluster)
goto error;
}

/*
* 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);
first_cl = cluster;
}

ops->ent_put(&fatent, FAT_ENT_FREE);
if (sbi->free_clusters != -1) {
sbi->free_clusters++;
Expand Down

0 comments on commit 1244cca

Please sign in to comment.