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=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 C52C4C2D0CD for ; Wed, 18 Dec 2019 00:15:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8AF62206D3 for ; Wed, 18 Dec 2019 00:15:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="w1cqjlIY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8AF62206D3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2499D8E00B5; Tue, 17 Dec 2019 19:15:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D2808E0079; Tue, 17 Dec 2019 19:15:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09A648E00B5; Tue, 17 Dec 2019 19:15:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id E75218E0079 for ; Tue, 17 Dec 2019 19:15:50 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id BE9041EFD for ; Wed, 18 Dec 2019 00:15:50 +0000 (UTC) X-FDA: 76276344060.16.bee24_15e446f4fbf00 X-HE-Tag: bee24_15e446f4fbf00 X-Filterd-Recvd-Size: 5240 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Dec 2019 00:15:50 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id w62so158281pfw.8 for ; Tue, 17 Dec 2019 16:15:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=YQMmzMY37i2Mof3lbYfpF5chISi7sMrvZ/ycgoxfAyA=; b=w1cqjlIYrAIkEphkj7SjLigIfIMzBn0DtSSscagQOjaBWS1xVHc9HO7ue1501V9FuR YAPsJDbP/asVmSC7PQlSEbkOqHc1WzR1NP0129mG6G7x0gNohKSh+76V7lIuFMObyPED kX32//b8ctPM3sgFXfm6SqxiXLt4eHljSLIoDruli2RsZXHQb3Hru+To3T8wt/OVW9AH bIxjtLX/riBfARkhw23oslkfo1EJwHIYkL6X/8rwC+IGGpSZFtqlw5t5cyrvcvoyNAJr uGxkFiYtrGCxH5f/QylLn/0O3f7JM0VkzNVKEBxeGUGQSFsI3xXayhR6xzo3KZSR99zA Cf8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YQMmzMY37i2Mof3lbYfpF5chISi7sMrvZ/ycgoxfAyA=; b=HyrKXwVu0QT+oDi7A55gC8w2Ra/u292LRgcMOU7Yc74gikvXDgjkgt+56yAGtPOXTe UJDEFs9ydi01rr0R642+xirh25yfRyKR6qr+g9P7jCkfmqDET0Cdku0adViFr6AACrrl qIAfHnwF8unK79seGE1bUndR2BfTgEFUvXpYIW1X0sfJ0yiwpT3SnufL7j+WM0GOFf6e kxPgvNt71E0cdbR4cW8BrfYP2xwOhuGMZwsMkaRloTe2/7uUcgZwO0ruUrei9Wd3KnoU IKLKRLTIAdANpDhudMOKIOkpauREInJWMLFeANAOMwy5JmEDAzek/hb/7qUwIK8XyPaV 72mQ== X-Gm-Message-State: APjAAAVAv8f0pe32ezvGCpI9oAn05/8JkcobkQtvjCFQFqDGtTFhgZn+ KAL23Uy/Xi4ACIi8rXsrFJ4uG7Jcdxw= X-Google-Smtp-Source: APXvYqyg4gmsFwb+g+QqPm6sNT4veLef7n1AMHYvnq9f2ULLZNauq5tLOQMsMKSXl1ieZQsQbjMe9w== X-Received: by 2002:a65:6216:: with SMTP id d22mr80575pgv.437.1576628148980; Tue, 17 Dec 2019 16:15:48 -0800 (PST) Received: from ?IPv6:2620:10d:c081:1131::13f4? ([2620:10d:c090:180::6446]) by smtp.gmail.com with ESMTPSA id l186sm161084pge.31.2019.12.17.16.15.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Dec 2019 16:15:48 -0800 (PST) Subject: Re: [PATCH 4/6] iomap: add struct iomap_ctx To: Linus Torvalds Cc: Linux-MM , linux-fsdevel , linux-block , Matthew Wilcox , Chris Mason , Dave Chinner References: <20191217143948.26380-1-axboe@kernel.dk> <20191217143948.26380-5-axboe@kernel.dk> From: Jens Axboe Message-ID: <9941995e-19c5-507b-9339-b8d2cb568932@kernel.dk> Date: Tue, 17 Dec 2019 17:15:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 12/17/19 1:26 PM, Linus Torvalds wrote: > 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. Yeah, I fixed that one up, that was my error. >> 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. Honestly, I'd much rather leave the loff_t -> size_t/ssize_t to Darrick/Dave, it's really outside the scope of this patch, and I'd prefer not to have to muck with it. They probably feel the same way! -- Jens Axboe