Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754748Ab2K2ULR (ORCPT ); Thu, 29 Nov 2012 15:11:17 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:41382 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753297Ab2K2ULO (ORCPT ); Thu, 29 Nov 2012 15:11:14 -0500 MIME-Version: 1.0 In-Reply-To: References: <50B5CC5A.8060607@kernel.dk> <20121128194314.GF4939@ZenIV.linux.org.uk> <20121129191503.GB3490@shiny> <20121129194840.GC3490@shiny> From: Linus Torvalds Date: Thu, 29 Nov 2012 12:10:53 -0800 X-Google-Sender-Auth: muQzlVcsb8Q9vg25cveDMs4E-gU Message-ID: Subject: Re: [PATCH v2] Do a proper locking for mmap and block size change To: Chris Mason , Linus Torvalds , Chris Mason , Mikulas Patocka , Al Viro , Jens Axboe , Jeff Chua , Lai Jiangshan , Jan Kara , lkml , linux-fsdevel Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 941 Lines: 27 On Thu, Nov 29, 2012 at 11:55 AM, Linus Torvalds wrote: > > The blkdev_get_blocks() this is just sad. > > The underlying data structure is actually byte-based (it's > "i_size_read(bdev->bd_inode"), but we convert it to a block-based > number. > > Oops. Oh, it's even worse than that. The DIO code ends up passing in buffer heads that have sizes bigger than the inode i_blksize, which can cause problems at the end of the disk. So blkdev_get_blocks() knows about it, and will then "fix" that and shrink them down. The games with "max_block" are hilarious. In a really sad way. That whole blkdev_get_blocks() function is pure and utter shit. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/