From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 02/15] pass gfp_mask and flags to sb_issue_discard Date: Wed, 18 Aug 2010 05:29:10 -0400 Message-ID: <20100818093500.133322549@bombadil.infradead.org> References: <20100818093432.646633424@bombadil.infradead.org> Cc: chris.mason@oracle.com, swhiteho@redhat.com, konishi.ryusuke@lab.ntt.co.jp, tytso@mit.edu, jack@suse.cz, hirofumi@mail.parknet.co.jp, mfasheh@suse.com, joel.becker@oracle.com, hughd@google.com, linux-fsdevel@vger.kernel.org To: tj@kernel.org Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:48840 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752471Ab0HRJfi (ORCPT ); Wed, 18 Aug 2010 05:35:38 -0400 Content-Disposition: inline; filename=sb_issue-discard-parameters Sender: linux-fsdevel-owner@vger.kernel.org List-ID: We'll need to get rid of the BLKDEV_IFL_BARRIER flag, and to facilitate that and to make the interface less confusing pass all flags explicitly. Signed-off-by: Christoph Hellwig Index: linux-2.6/fs/ext4/mballoc.c =================================================================== --- linux-2.6.orig/fs/ext4/mballoc.c 2010-08-17 15:56:00.337259833 +0200 +++ linux-2.6/fs/ext4/mballoc.c 2010-08-17 15:59:09.490005395 +0200 @@ -2588,7 +2588,10 @@ static void release_blocks_on_commit(jou trace_ext4_discard_blocks(sb, (unsigned long long)discard_block, entry->count); - ret = sb_issue_discard(sb, discard_block, entry->count); + ret = sb_issue_discard(sb, discard_block, entry->count, + GFP_NOFS, + BLKDEV_IFL_WAIT | + BLKDEV_IFL_BARRIER); if (ret == EOPNOTSUPP) { ext4_warning(sb, "discard not supported, disabling"); Index: linux-2.6/fs/fat/fatent.c =================================================================== --- linux-2.6.orig/fs/fat/fatent.c 2010-08-17 15:56:00.351254455 +0200 +++ linux-2.6/fs/fat/fatent.c 2010-08-17 15:58:54.980023211 +0200 @@ -577,7 +577,9 @@ int fat_free_clusters(struct inode *inod sb_issue_discard(sb, fat_clus_to_blknr(sbi, first_cl), - nr_clus * sbi->sec_per_clus); + nr_clus * sbi->sec_per_clus, + GFP_NOFS, + BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); first_cl = cluster; } Index: linux-2.6/include/linux/blkdev.h =================================================================== --- linux-2.6.orig/include/linux/blkdev.h 2010-08-17 15:55:24.299003653 +0200 +++ linux-2.6/include/linux/blkdev.h 2010-08-17 15:58:49.351006024 +0200 @@ -877,13 +877,12 @@ extern int blkdev_issue_discard(struct b sector_t nr_sects, gfp_t gfp_mask, unsigned long flags); extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, sector_t nr_sects, gfp_t gfp_mask, unsigned long flags); -static inline int sb_issue_discard(struct super_block *sb, - sector_t block, sector_t nr_blocks) +static inline int sb_issue_discard(struct super_block *sb, sector_t block, + sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags) { - block <<= (sb->s_blocksize_bits - 9); - nr_blocks <<= (sb->s_blocksize_bits - 9); - return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS, - BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); + return blkdev_issue_discard(sb->s_bdev, block << (sb->s_blocksize_bits - 9), + nr_blocks << (sb->s_blocksize_bits - 9), + gfp_mask, flags); } extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);