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 E252CC43603 for ; Tue, 17 Dec 2019 19:40:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9AD972146E for ; Tue, 17 Dec 2019 19:40:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="aMhd1gYr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AD972146E 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 3DC9A8E00A4; Tue, 17 Dec 2019 14:40:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 38C548E0079; Tue, 17 Dec 2019 14:40:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A23B8E00A4; Tue, 17 Dec 2019 14:40:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id 14DC98E0079 for ; Tue, 17 Dec 2019 14:40:01 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id A23534DB6 for ; Tue, 17 Dec 2019 19:40:00 +0000 (UTC) X-FDA: 76275648960.20.card47_5751cfb157a07 X-HE-Tag: card47_5751cfb157a07 X-Filterd-Recvd-Size: 5084 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Dec 2019 19:39:59 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id n25so7843341lfl.0 for ; Tue, 17 Dec 2019 11:39:59 -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=qFRWpBT/yna7msZCz1h2wfxEJHa/dpTRSDTuMPZJuko=; b=aMhd1gYr/CaA40gJd+Y5v2iKz3PpftHLH7meUakQxXR667vcpSEeG+f7RRgZ9EScB8 QPC5XzSuBsPm691KBjptv6ye07x5hIgbc7KafGV8ZlGArW6KOkIPnZeOx0iU0AevTOka 8z9zZfU3hjnoqjS219RuVLiUlb7YJo5q+60u4= 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=qFRWpBT/yna7msZCz1h2wfxEJHa/dpTRSDTuMPZJuko=; b=B5YxQl6pReknEJ4CJuC8T7Z3fHrUUt9CoGW3FXwQP9ePVKXGgXg34ozbye5sEEzMB7 pTK85uvGiTpVD0+1oaFLR1U2lXPDWgLb16oe+LXDEpXozDc9uZw4EoGY5mmQrrUcpZZM iSCkEA2qiJVkU7OWmYmXgiibZm4For9ZGQ2l90ojSZiu/pRp4QXpHOBlqnqTwPMwT0VW RXb3HsZYLeo/CK5iz1Wqj5htlZe372jPr58yh8WDHbQ9qRj94wD6qE6HkCvrSI3wN/M5 E2UngMhNmXzj85hKOzVlTBTC05hKp52MjwWMj1/Qr6873/E0ApNn5VvGDFiq4xOF7Kjy o/sg== X-Gm-Message-State: APjAAAVjfvM42vt1IRNrsRrtb0TTrewzRBKu5QNF2UGt8odHRAxerjmq VfgCp4XP73aZy+MmlpIeoKwgbbo00AE= X-Google-Smtp-Source: APXvYqzIkGIxtf+VvIk4PhaPjPj75phdTwDqPnXCqI18cDp732y8eTbFMbDYzzdioarqEZIXkJTE4g== X-Received: by 2002:ac2:5337:: with SMTP id f23mr3720562lfh.192.1576611598157; Tue, 17 Dec 2019 11:39:58 -0800 (PST) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com. [209.85.208.170]) by smtp.gmail.com with ESMTPSA id h10sm2032167ljc.39.2019.12.17.11.39.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Dec 2019 11:39:57 -0800 (PST) Received: by mail-lj1-f170.google.com with SMTP id k8so935576ljh.5 for ; Tue, 17 Dec 2019 11:39:57 -0800 (PST) X-Received: by 2002:a2e:9ad8:: with SMTP id p24mr4517160ljj.148.1576611596942; Tue, 17 Dec 2019 11:39:56 -0800 (PST) MIME-Version: 1.0 References: <20191217143948.26380-1-axboe@kernel.dk> <20191217143948.26380-5-axboe@kernel.dk> In-Reply-To: <20191217143948.26380-5-axboe@kernel.dk> From: Linus Torvalds Date: Tue, 17 Dec 2019 11:39:41 -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 6:40 AM Jens Axboe wrote: > > We pass a lot of arguments to iomap_apply(), and subsequently to the > actors that it calls. In preparation for adding one more argument, > switch them to using a struct iomap_ctx instead. The actor gets a const > version of that, they are not supposed to change anything in it. Looks generally like what I expected, but when looking at the patch I notice that the type of 'len' is crazy and wrong. It was wrong before too, though: > -dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, 'loff_t length' is not right. > + 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'. WHAA? > @@ -1197,22 +1200,26 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, > { > + loff_t ret = 0, done = 0; More insanity. "ret" shouldn't be loff_t. dax_iomap_rw() returns a ssize_t. > + loff_t count = data->len; More of this crazy things. > iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero, This was wrong before. > +struct iomap_ctx { > + struct inode *inode; > + loff_t pos; > + loff_t len; > + void *priv; > + unsigned flags; > +}; Please make 'len' be 'size_t' or something. If you're on a 32-bit architecture, you shouldn't be writing more than 4GB in a go anyway. 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. Linus