Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638553

Re: [PATCH] cifs: cifsacl: Use a temporary ops variable to reduce code length

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] cifs: cifsacl: Use a temporary ops variable to reduce code length
Date Wed, 10 May 2017 06:30:02 +0200
Message-ID <tFrqa-442-3@gated-at.bofh.it> (permalink)
References <tED0l-3AS-9@gated-at.bofh.it>
X-Original-To Joe Perches <joe@perches.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JtDjVJktW6tI/tH+6QtVfsQNp0DWSQJnA3857kmB8Lo=; b=uzcHaHu5ne+Bijt/mkhIUjexT256pqS2O9LtseEuA5sI+A6xuX5ICqRzSbqaWmIMEf 8m21elY4IdOhW7P6uGKv727pfGPR2uo5NkGOtyKmiBzMaB7rchd4vWHb0SAeW02+DqQ5 x5Thb3NX1hQacaB5eQR9pOZTxod8mw2bMoSZQPG3pKL1NRS8zRbt5aijpUbE7H3H1NYF uURnJO6MXoICdfpBDIB/zbHMpF6+KfJPdN6KtI/6HalVyP5B1gV/tUeDdwOVCxgzJzxv hqjGu/N3Wvl5mQc8N27UtkO1bQWqzeOF3g2XU7i4LvDTvwun0bKN0VA0uW9Mrod+3oEG fWhg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JtDjVJktW6tI/tH+6QtVfsQNp0DWSQJnA3857kmB8Lo=; b=FL9RL62V6qsb7vgXyQ3tHZwnz+WwMWqjfMiD/RoX6p/gNjxts2OZY++VqMCUjLBhzl WXi/WBsXKW3RuBctxSeG6c6Tnt/beMv6lBZUYkE8oD6ea/TsytuA+Grn987gBXtraYDj YvXfPjoUQe/KMQjB8fJ4szk9C3x+0htdptBX0CO/2WwEAdo5Gk5+635N3cNlI+xsTE6S gpqtEYsi9gMkxkInTaVoBj5fejqN0wepGdcnsxaJVYE9NVo9/Aint7XgmdJUObhtAaJU /+q26PTKQbn90ikyC79MPg8W+ALvMdSkcpHhmBfUrs5GWGX4YEmk0j1fqW94qJBBXx5B +tiw==
X-Gm-Message-State AODbwcBGh4CEcx0hs79alu0dygWAky27zv7XARGr610Q8/b58fo3Db+O QmTaIfv/Wu4+X5vbEUHtcywxXp+QXQ==
X-Received by 10.98.19.12 with SMTP id b12mr3889353pfj.21.1494390385789; Tue, 09 May 2017 21:26:25 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 100
Organization linux.* mail to news gateway
X-Original-Cc Steve French <sfrench@samba.org>, linux-cifs <linux-cifs@vger.kernel.org>, samba-technical <samba-technical@lists.samba.org>, LKML <linux-kernel@vger.kernel.org>
X-Original-Date Tue, 9 May 2017 23:26:25 -0500
X-Original-Message-ID <CADT32eKcAAa9ORxf1OLL-+ju_XhSevb5d44=N7m6ngsbwuZ_rQ@mail.gmail.com>
X-Original-References <35756168f871fb4f8149153f6e5b85352de3166b.1494145833.git.joe@perches.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1638553

Show key headers only | View raw


Looks correct.

Acked-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>

On Sun, May 7, 2017 at 3:31 AM, Joe Perches via samba-technical
<samba-technical@lists.samba.org> wrote:
> Create an ops variable to store tcon->ses->server->ops and cache
> indirections and reduce code size a trivial bit.
>
> $ size fs/cifs/cifsacl.o*
>    text    data     bss     dec     hex filename
>    5338     136       8    5482    156a fs/cifs/cifsacl.o.new
>    5371     136       8    5515    158b fs/cifs/cifsacl.o.old
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  fs/cifs/cifsacl.c | 30 ++++++++++++++----------------
>  1 file changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
> index 15bac390dff9..b98436f5c7c7 100644
> --- a/fs/cifs/cifsacl.c
> +++ b/fs/cifs/cifsacl.c
> @@ -1135,20 +1135,19 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
>         u32 acllen = 0;
>         int rc = 0;
>         struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
> -       struct cifs_tcon *tcon;
> +       struct smb_version_operations *ops;
>
>         cifs_dbg(NOISY, "converting ACL to mode for %s\n", path);
>
>         if (IS_ERR(tlink))
>                 return PTR_ERR(tlink);
> -       tcon = tlink_tcon(tlink);
>
> -       if (pfid && (tcon->ses->server->ops->get_acl_by_fid))
> -               pntsd = tcon->ses->server->ops->get_acl_by_fid(cifs_sb, pfid,
> -                                                         &acllen);
> -       else if (tcon->ses->server->ops->get_acl)
> -               pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path,
> -                                                       &acllen);
> +       ops = tlink_tcon(tlink)->ses->server->ops;
> +
> +       if (pfid && (ops->get_acl_by_fid))
> +               pntsd = ops->get_acl_by_fid(cifs_sb, pfid, &acllen);
> +       else if (ops->get_acl)
> +               pntsd = ops->get_acl(cifs_sb, inode, path, &acllen);
>         else {
>                 cifs_put_tlink(tlink);
>                 return -EOPNOTSUPP;
> @@ -1181,23 +1180,23 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
>         struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
>         struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
>         struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
> -       struct cifs_tcon *tcon;
> +       struct smb_version_operations *ops;
>
>         if (IS_ERR(tlink))
>                 return PTR_ERR(tlink);
> -       tcon = tlink_tcon(tlink);
> +
> +       ops = tlink_tcon(tlink)->ses->server->ops;
>
>         cifs_dbg(NOISY, "set ACL from mode for %s\n", path);
>
>         /* Get the security descriptor */
>
> -       if (tcon->ses->server->ops->get_acl == NULL) {
> +       if (ops->get_acl == NULL) {
>                 cifs_put_tlink(tlink);
>                 return -EOPNOTSUPP;
>         }
>
> -       pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path,
> -                                               &secdesclen);
> +       pntsd = ops->get_acl(cifs_sb, inode, path, &secdesclen);
>         if (IS_ERR(pntsd)) {
>                 rc = PTR_ERR(pntsd);
>                 cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc);
> @@ -1224,13 +1223,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
>
>         cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc);
>
> -       if (tcon->ses->server->ops->set_acl == NULL)
> +       if (ops->set_acl == NULL)
>                 rc = -EOPNOTSUPP;
>
>         if (!rc) {
>                 /* Set the security descriptor */
> -               rc = tcon->ses->server->ops->set_acl(pnntsd, secdesclen, inode,
> -                                                    path, aclflag);
> +               rc = ops->set_acl(pnntsd, secdesclen, inode, path, aclflag);
>                 cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc);
>         }
>         cifs_put_tlink(tlink);
> --
> 2.10.0.rc2.1.g053435c
>
>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] cifs: cifsacl: Use a temporary ops variable to reduce code length Joe Perches <joe@perches.com> - 2017-05-08 00:40 +0200
  Re: [PATCH] cifs: cifsacl: Use a temporary ops variable to reduce  code length Shirish Pargaonkar <shirishpargaonkar@gmail.com> - 2017-05-10 06:30 +0200

csiph-web