From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE6AAC43603 for ; Tue, 17 Dec 2019 20:26:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 70D9E21775 for ; Tue, 17 Dec 2019 20:26:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="B25Yd0xd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70D9E21775 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 69EC98E00A8; Tue, 17 Dec 2019 15:26:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 64F6A8E0079; Tue, 17 Dec 2019 15:26:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 565138E00A8; Tue, 17 Dec 2019 15:26:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id 40ED18E0079 for ; Tue, 17 Dec 2019 15:26:46 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id D943F181AC9CB for ; Tue, 17 Dec 2019 20:26:45 +0000 (UTC) X-FDA: 76275766770.02.coat57_3afe58b907551 X-HE-Tag: coat57_3afe58b907551 X-Filterd-Recvd-Size: 4774 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Dec 2019 20:26:45 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id j6so12452507lja.2 for ; Tue, 17 Dec 2019 12:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i1T7+oLmgUY62ytPiNODIrz1cZeW8gAZnOGieJ8ZkwA=; b=B25Yd0xdGvGJ4bCIEr4Bgw/88tBjEJ0OPfoVc5YLKvIjM26jyP64rHYwIIEVDLTF0T 74GwFgIu0A96nSZ33TTCFUmysZjkwE8bDL13x64JVHMOo8K7cEIepUclqLbfA2V4o+Gz t+TIx/86gc/llbykG0MWlhLehR8Su42SrUwv4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i1T7+oLmgUY62ytPiNODIrz1cZeW8gAZnOGieJ8ZkwA=; b=jl9rWthC0UTM0+cis24rc9RLaz5Gc3GBTZ9qG0QJiaQPQAhdKSQjO3ROrkJwme2n/S QT6FXAC+P/eLoALDMwedGiGf5yRu9u4wjYdY2QT9IoDoztJAgHws4tULXPo7C4GF7zuU Rg8GzsNhwbcSuqrjKjSmm2hWtvoOgYGgKIB5tvKaTjynI0YwYgJPWAakrMQAqZuqetSa nhkeqnqo2j3bsTzZj5ij31KNSIB39HfscKCwuyVoUE/LZtygCpcYmEZtLhlJ+8c7IGgk GdP8gJsSLIinXt5MpS5hjunrexdmmvJm6aEG98YuCXcGZPMdxM2BT5H0R5gMF7XZ8wWu 9XGQ== X-Gm-Message-State: APjAAAVSWdlBXJOFJkpj35Iw0Io3sE1CKqeF0FRRLiollBj7oF8wQ50c HOg3NxPDbpxtu98JMLuVR7SezFhcAL8= X-Google-Smtp-Source: APXvYqzXusAovpvWttUgyOvC+pFFsr8cEdVV77LIhW+25LB/4vYR3hzGMiFZrmrLo334MtFL809vow== X-Received: by 2002:a2e:9899:: with SMTP id b25mr4504370ljj.70.1576614403584; Tue, 17 Dec 2019 12:26:43 -0800 (PST) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id s18sm72989ljj.36.2019.12.17.12.26.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Dec 2019 12:26:42 -0800 (PST) Received: by mail-lj1-f179.google.com with SMTP id j6so12452430lja.2 for ; Tue, 17 Dec 2019 12:26:42 -0800 (PST) X-Received: by 2002:a2e:91cb:: with SMTP id u11mr4707040ljg.82.1576614402189; Tue, 17 Dec 2019 12:26:42 -0800 (PST) MIME-Version: 1.0 References: <20191217143948.26380-1-axboe@kernel.dk> <20191217143948.26380-5-axboe@kernel.dk> In-Reply-To: From: Linus Torvalds Date: Tue, 17 Dec 2019 12:26:26 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/6] iomap: add struct iomap_ctx To: Jens Axboe Cc: Linux-MM , linux-fsdevel , linux-block , Matthew Wilcox , Chris Mason , Dave Chinner Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 17, 2019 at 11:39 AM Linus Torvalds wrote: > > 'loff_t length' is not right. Looking around, it does seem to get used that way. Too much, though. > > + loff_t pos = data->pos; > > + loff_t length = pos + data->len; > > And WTH is that? "pos + data->len" is not "length", that's end. And this: > > > loff_t end = pos + length, done = 0; > > What? Now 'end' is 'pos+length', which is 'pos+pos+data->len'. But this is unrelated to the crazy types. That just can't bve right. > Is there some reason for this horrible case of "let's allow 64-bit sizes?" > > Because even if there is, it shouldn't be "loff_t". That's an > _offset_. Not a length. We do seem to have a lot of these across filesystems. And a lot of confusion. Most of the IO reoutines clearly take or return a size_t (returning ssize_t) as the IO size. And then you have the zeroing/truncation stuff that tends to take loff_t. Which still smells wrong, and s64 would look like a better case, but whatever. The "iomap_zero_range() for truncate" case really does seem to need a 64-bit value, because people do the difference of two loff_t's for it. In fact, it almost looks like that function should take a "start , end" pair, which would make loff_t be the _right_ thing. Because "length" really is just (a positive) size_t normally. Linus