Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp921680pxb; Thu, 19 Aug 2021 14:54:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybKgqeU0KP1vIIjoiScit7z+T8CWcsIoWe8Bg8l5mHtqSLOnlJNx5WC3ktpcHzH/fp8Zc9 X-Received: by 2002:a92:c702:: with SMTP id a2mr11301716ilp.210.1629410080305; Thu, 19 Aug 2021 14:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629410080; cv=none; d=google.com; s=arc-20160816; b=D7BsJpXEDEhElNugNHn4xzcobxcWOkTvP5KRi5lCIaztztGn1ozCS2cHcXwM/2kA8t QvIu/jWUoQcTPsNvQUjeN3fUsixMML37x2brwSrtS0XhwXAtLOPuTRax8fTVKoZ++z63 pjc9QK3Ikg3M2Z82Ve2s+6NY1hTgfbzy5auYOrZ4AU59Zc4rX0GonR881+9UP8aDRr9a 36CgattK3DeMVisnH040Ir4baByylGvGJGt1b/EShqkS8dmwT8lFI2EERC2EHWOlTntS OPnTr0zfhAsH477Yp0KnspKUKNQT3YwQJbn1a9AaaJEzEeIxXYp3tBW1IEGkcSZEu4FV YVKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Gh7P+bJgD4ftBn8Xyzyldousp27lYpH1a6zXj2KjV24=; b=Om9WaN82vJkO4pAXpx1M/9HzlJRrx/yJr9Ia/bOmFXyRwSItRchD5DrRwilHzANgln D/0IaMbkirXTOOgtN/LtPHBYBwQkg/b1oFXjzQbdPweb+ZbKer/YbPuivM6rkhydhgzU w7xYOm1aR1tO7Ky4jGMPRh6HFX8JCTq31w19A9J01ant90v8zl5jv/Vodesy680yUmkF KWN1OJ07+t01BZGYt7GxFVPLBsYWcx7dGPYXjVFLXvYkVUXVdeE/GHJr8yHfyTRTasPH 6Li5TSacyuW61/6hncM/TGp2bw49eaxkTkIKdgBgLJ32EGpvb0Iv8xl7KfCYXkZG+LL1 rK7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="XZbj/Sde"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si4667658jal.119.2021.08.19.14.54.29; Thu, 19 Aug 2021 14:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="XZbj/Sde"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235433AbhHSVx6 (ORCPT + 99 others); Thu, 19 Aug 2021 17:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232769AbhHSVx5 (ORCPT ); Thu, 19 Aug 2021 17:53:57 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F4FCC061575; Thu, 19 Aug 2021 14:53:20 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id y7so13903625ljp.3; Thu, 19 Aug 2021 14:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Gh7P+bJgD4ftBn8Xyzyldousp27lYpH1a6zXj2KjV24=; b=XZbj/Sdebgb0gcuT1OyWLtHFrLJTQj9LA+coAC9fb0pHjyxdCKO9C4w2Y5rI84fuId QX1KgfEw+8IW3VdphwJ7fLI/nx2cVKKVWiwD6sMWoNTxyYvQxdUR0RGO8A79jADBooyx tL6mYdbkri53XlFvnGOnik+xAExIWM5cCPD1T6uF5mUEPnY0QcP13dwzNDLAcDM4rn0b zvO4DMwi5Mur1VoFrsenaICWSbP4Co/pPUBWdKiEW643ZP+xAhY3oRCvcm1VYZR4ER7O RKve46kIY1+Q+kOQR1DNr5+ppQY+DVi4WYN5Nn4xBgTrwIPKsgpaIgh7AFveFI1tw8Kw KnZw== 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=Gh7P+bJgD4ftBn8Xyzyldousp27lYpH1a6zXj2KjV24=; b=C4fSV1P4EHYgIwFYYQyhC/WFS6q7BojvWpAsmfuIRKk6MsSm4ARknYtW4gHDoH/Vvo OqsAyEXMb1dd8hOPIffu671rEFZeYOcrmLN9PiNn4ayxQxnYxH2ooO/CySISdwsEn3ZD dVDyFG7hng8COZrLmVGxkjHFCac04/MHYfR6r3hs/SpQP9fviLjPxO5vW/rcrKyjsvz0 aXdnUwBlA6BxPgWho4xhU6DA7pe0jzUyXQg0d1Bpo14o653IAwCh9viXRSBGwmNVD1TZ aSVtja92FARmbjwOUFLAUfm3hYQ3AxPu/dgHshc/x1EuRnpFYRsfyV9MSOzvwrz4GDeo H4KA== X-Gm-Message-State: AOAM5326QIzOghG7BNBFKAR+FaTBVf/y9u3i3UpaUymlRPwXBq+CPi42 yaqoJaS4yWobq6hd3wGAYIE= X-Received: by 2002:a2e:a713:: with SMTP id s19mr3835976lje.177.1629409998665; Thu, 19 Aug 2021 14:53:18 -0700 (PDT) Received: from kari-VirtualBox (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id b14sm364264ljr.111.2021.08.19.14.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 14:53:18 -0700 (PDT) Date: Fri, 20 Aug 2021 00:53:15 +0300 From: Kari Argillander To: Konstantin Komarov , Christoph Hellwig Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Pali =?utf-8?B?Um9ow6Fy?= , Matthew Wilcox , Christian Brauner Subject: Re: [PATCH v2 3/6] fs/ntfs3: Use new api for mounting Message-ID: <20210819215315.uhst4ppwdbed65x7@kari-VirtualBox> References: <20210819002633.689831-1-kari.argillander@gmail.com> <20210819002633.689831-4-kari.argillander@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210819002633.689831-4-kari.argillander@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 19, 2021 at 03:26:30AM +0300, Kari Argillander wrote: > We have now new mount api as described in Documentation/filesystems. We > should use it as it gives us some benefits which are desribed here > lore.kernel.org/linux-fsdevel/159646178122.1784947.11705396571718464082.stgit@warthog.procyon.org.uk/ > > Nls loading is changed a to load with string. This did make code also > little cleaner. > > Also try to use fsparam_flag_no as much as possible. This is just nice > little touch and is not mandatory but it should not make any harm. It > is just convenient that we can use example acl/noacl mount options. > > Signed-off-by: Kari Argillander I will send new patches when Komarov has take a look of these. I have found some bugs and how to improve things. Please take a look below my second comment. > fs/ntfs3/super.c | 392 +++++++++++++++++++++++---------------------- > +static void ntfs_fs_free(struct fs_context *fc) > +{ > + struct ntfs_sb_info *sbi = fc->s_fs_info; > + > + if (sbi) > + put_ntfs(sbi); > +} > + > +static const struct fs_context_operations ntfs_context_ops = { > + .parse_param = ntfs_fs_parse_param, > + .get_tree = ntfs_fs_get_tree, > + .reconfigure = ntfs_fs_reconfigure, > + .free = ntfs_fs_free, > +}; > + > +static int ntfs_init_fs_context(struct fs_context *fc) > { > - return mount_bdev(fs_type, flags, dev_name, data, ntfs_fill_super); > + struct ntfs_sb_info *sbi; > + > + sbi = ntfs_zalloc(sizeof(struct ntfs_sb_info)); > + if (!sbi) > + return -ENOMEM; > + > + /* Default options */ > + sbi->options.fs_uid = current_uid(); > + sbi->options.fs_gid = current_gid(); > + sbi->options.fs_fmask_inv = ~current_umask(); > + sbi->options.fs_dmask_inv = ~current_umask(); > + > + fc->s_fs_info = sbi; > + fc->ops = &ntfs_context_ops; > + > + return 0; > } In this code I did not like that we make whole new sbi everytime. Especially because we do zalloc. So when we regonfigure then new sbi is allocated just for options. I notice that example xfs does allocate their "sbi" everytime. Then I notice that example squashfs allocate just mount options. I have impression that we should allocate sbi if it first time so I did "between code". I would like to do things like they are intended with api so can Christoph comment that is this "right" thing to do and is there any draw backs which I should know. static void ntfs_fs_free(struct fs_context *fc) { struct ntfs_mount_options *opts = fc->fs_private; struct ntfs_sb_info *sbi = fc->s_fs_info; if (sbi) put_ntfs(sbi); if (opts) clear_mount_options(opts); } static int ntfs_init_fs_context(struct fs_context *fc) { struct ntfs_mount_options *opts; struct ntfs_sb_info *sbi = NULL; fc->ops = &ntfs_context_ops; opts = ntfs_zalloc(sizeof(struct ntfs_mount_options)); if (!opts) return -ENOMEM; /* Default options. */ opts->fs_uid = current_uid(); opts->fs_gid = current_gid(); opts->fs_fmask_inv = ~current_umask(); opts->fs_dmask_inv = ~current_umask(); fc->fs_private = opts; /* No need to initialize sbi if we just reconf. */ if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) return 0; sbi = ntfs_zalloc(sizeof(struct ntfs_sb_info)); if (!sbi) { ntfs_free(opts); return -ENOMEM; } mutex_init(&sbi->compress.mtx_lznt); #ifdef CONFIG_NTFS3_LZX_XPRESS mutex_init(&sbi->compress.mtx_xpress); mutex_init(&sbi->compress.mtx_lzx); #endif sbi->options = opts; fc->s_fs_info = sbi; return 0; }