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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 8A554C48BC2 for ; Fri, 25 Jun 2021 21:08:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D3606195F for ; Fri, 25 Jun 2021 21:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229885AbhFYVKZ (ORCPT ); Fri, 25 Jun 2021 17:10:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbhFYVKZ (ORCPT ); Fri, 25 Jun 2021 17:10:25 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEEB0C061766 for ; Fri, 25 Jun 2021 14:08:02 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id h23so6154124pjv.2 for ; Fri, 25 Jun 2021 14:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iwdrmqNuPsOzJ+vHk2n49886jjtTpzSZRkfEIGBbrK4=; b=Mxh1EfJo071k5FikITprA7j5KY1IpIuJVfvkEl7ZWsosdwyTDiEvFDy740fuGMhGIQ AxAOKh8mDMZ3Zk0bZBUGmheDV4XKa+X5VOYjR3tb552FmUqirzTC69g1j2uI2Zt2HVSC kC6sm4BY7G892gR8UZP2ovtLklcLtsSgGVp0NNXyyseHl767ePNdRsR3hjnDZhBiWprh R9peJ861wi34qzN4qW/8ANN6oeKZBRo6YVCBE2raFlTFBPxATQ3fedEwqYhLpKPXU2ha c75O8Mh2sIjpWzsruGt1Dlto433gIoPup3EMvmVJIeODO8h4Hfc9AwQturZpSOGnOy6W LGNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iwdrmqNuPsOzJ+vHk2n49886jjtTpzSZRkfEIGBbrK4=; b=LWrfYAHGp2uh7nVRf7fAWCAteMoEeOTX1C66l564pQjxDIQGm+OgHMEsw5TX6AZND/ HjdcyFPL4ZHgxAMsPZpNK8OblQOCO+j3T5qOBCO+zxEUrOJQluvs9iwdulupCcArg9wY 1VJ3Rt01GPzgXYARqC48ro7Z4SgQzglg9w7QDOmmM90kSwzf9+4xqn5mBi/4Yy9w2uQf 3K7YWSS1ye00s5KQWfHYucCqVjmvJwbsMxT5gT5005zYxnd2Qg8+PlA6uV5c4dWf3EnO bYVrOUF8UMWfwBRjCeLVRd423uxIaH/yOHVhE1l7I8PZsxClof2SpVVm4Dr6gU/Xu4kK XovQ== X-Gm-Message-State: AOAM533KOcnbdsOqlI8Jhy4Hb5KPZkmmpbCYDOTcV+sXtPy59Gk7HW3S vWLlgFrE9oFKcIW+2jpFzsab5Q== X-Google-Smtp-Source: ABdhPJwR+3izSSktVvZl0BZ1BTZ8AP1mV7Dv3U/8nWTz+Ja1L+paTYW+Uc/D2EqGapUY+o0q7OmDBQ== X-Received: by 2002:a17:90a:db0c:: with SMTP id g12mr13113680pjv.166.1624655282162; Fri, 25 Jun 2021 14:08:02 -0700 (PDT) Received: from relinquished.localdomain ([2620:10d:c090:400::5:dd6d]) by smtp.gmail.com with ESMTPSA id l6sm6381275pgh.34.2021.06.25.14.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 14:08:01 -0700 (PDT) Date: Fri, 25 Jun 2021 14:07:59 -0700 From: Omar Sandoval To: Linus Torvalds Cc: Matthew Wilcox , "Martin K. Petersen" , Al Viro , Dave Chinner , linux-fsdevel , linux-btrfs , Linux API , Kernel Team , Dave Chinner Subject: Re: [PATCH RESEND x3 v9 1/9] iov_iter: add copy_struct_from_iter() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Jun 25, 2021 at 09:16:15AM -0700, Linus Torvalds wrote: > On Thu, Jun 24, 2021 at 8:38 PM Matthew Wilcox wrote: > > > > Does it make any kind of sense to talk about doing this for buffered I/O, > > given that we can't generate them for (eg) mmaped files? > > Sure we can. > > Or rather, some people might very well like to do it even for mutable > data. In fact, _especially_ for mutable data. > > You might want to do things like "write out the state I verified just > a moment ago", and if it has changed since then, you *want* the result > to be invalid because the checksums no longer match - in case somebody > else changed the data you used for the state calculation and > verification in the meantime. It's very much why you'd want a separate > checksum in the first place. > > Yeah, yeah, you can - and people do - just do things like this with a > separate checksum. But if you know that the filesystem has internal > checksumming support _anyway_, you might want to use it, and basically > say "use this checksum, if the data doesn't match when I read it back > I want to get an IO error". > > (The "data doesn't match" _could_ be just due to DRAM corruption etc, > of course. Some people care about things like that. You want > "verified" filesystem contents - it might not be about security, it > might simply be about "I have validated this data and if it's not the > same data any more it's useless and I need to re-generate it"). > > Am I a big believer in this model? No. Portability concerns (across > OS'es, across filesystems, even just across backups on the same exact > system) means that even if we did this, very few people would use it. > > People who want this end up using an external checksum instead and do > it outside of and separately from the actual IO, because then they can > do it on existing systems. > > So my argument is not "we want this". My argument is purely that some > buffered filesystem IO case isn't actually any different from the > traditional "I want access to the low-level sector hardware checksum > data". The use cases are basically exactly the same. > > Of course, basically nobody does that hw sector checksum either, for > all the same reasons, even if it's been around for decades. > > So my "checksum metadata interface" is not something I'm a big > believer in, but I really don't think it's really all _that_ different > from the whole "compressed format interface" that this whole patch > series is about. They are pretty much the same thing in many ways. I see the similarity in the sense that we basically want to pass some extra metadata down with the read or write. So then do we want to add preadv3/pwritev3 for encoded I/O now so that checksums can use it in the future? The encoding metadata could go in this "struct io_how", either directly or in a separate structure with a pointer in "struct io_how". It could get messy with compat syscalls.