Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753065Ab2K2TvH (ORCPT ); Thu, 29 Nov 2012 14:51:07 -0500 Received: from mail-wi0-f174.google.com ([209.85.212.174]:64123 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751334Ab2K2TvE (ORCPT ); Thu, 29 Nov 2012 14:51:04 -0500 MIME-Version: 1.0 In-Reply-To: References: <50B4B313.3030707@kernel.dk> <50B5CC5A.8060607@kernel.dk> <20121128194314.GF4939@ZenIV.linux.org.uk> <20121129191503.GB3490@shiny> From: Linus Torvalds Date: Thu, 29 Nov 2012 11:50:43 -0800 X-Google-Sender-Auth: bGcfawbIc9fdJWLaSiB-qaziCt8 Message-ID: Subject: Re: [PATCH v2] Do a proper locking for mmap and block size change To: Chris Mason , Linus Torvalds , 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: 1394 Lines: 35 On Thu, Nov 29, 2012 at 11:26 AM, Linus Torvalds wrote: > > (I now realize that Mikulas was talking about this mess, while I > thought he was talking about the AIO code which is largely sane). Oh wow. The direct-IO code really doesn't seem to care at all. I don't think it needs locking either (it seems to do everything with a private buffer-head), and the problem appears solely to be that it reads i_blksize multiple times, so changing it just happens to confuse the direct-io code. If it were to read it only once, and then use that value, it looks like it should all JustWork(tm). And the right thing to do would seem to just add it to the "dio_submit" structure, that we already have. And it already *has* a blkbits field, but that's the "IO blocksize", not the "getblocks blocksize", if I read that mess correctly. Of course, it then *ALREADY* has that "blkfactor" thing, which is the difference between i_blkbits and blktbits, so it effective *does* have i_blkbits already in the dio_submit structure. But despite it all, it keeps re-reading i_blksize. Christ. That code is a mess. 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/