On Wed, 2008-08-06 at 22:37 +0100, David Woodhouse wrote: > > Yes and no. I guess bytes or _fs_-blocksize is good interface for fs. > > OK. I'll do the latter; thank you. Incremental patch over what I posted before... diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index 5970fd6..a8b10ac 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c @@ -541,11 +541,6 @@ 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; @@ -557,6 +552,10 @@ 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); + ops->ent_put(&fatent, FAT_ENT_FREE); if (sbi->free_clusters != -1) { sbi->free_clusters++; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 3f077a5..9b33909 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -840,6 +840,15 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *); extern int blkdev_issue_discard(struct block_device *, sector_t sector, unsigned nr_sects, bio_end_io_t *); +static inline int sb_issue_discard(struct super_block *sb, + sector_t block, unsigned nr_blocks, + bio_end_io_t *endio) +{ + block <<= (sb->s_blocksize_bits - 9); + nr_blocks <<= (sb->s_blocksize_bits - 9); + return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, endio); +} + /* * command filter functions */ diff --git a/mm/bounce.c b/mm/bounce.c index b6d2d0f..1cfe193 100644 --- a/mm/bounce.c +++ b/mm/bounce.c @@ -267,7 +267,7 @@ void blk_queue_bounce(struct request_queue *q, struct bio **bio_orig) /* * Data-less bio, nothing to bounce */ - if (bio_empty_barrier(*bio_orig)) + if (bio_dataless(*bio_orig)) return; /* -- 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