From patchwork Wed Nov 10 06:13:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 12611421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52372C433EF for ; Wed, 10 Nov 2021 06:13:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D9356103D for ; Wed, 10 Nov 2021 06:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbhKJGQ1 (ORCPT ); Wed, 10 Nov 2021 01:16:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbhKJGQ0 (ORCPT ); Wed, 10 Nov 2021 01:16:26 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86C79C061764 for ; Tue, 9 Nov 2021 22:13:39 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id u25so435635ljo.12 for ; Tue, 09 Nov 2021 22:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=8LDYDSILwReEKdK44P5QouSpkF5WXIdB3iZ2/ZYYpIo=; b=g6F0NO3EoCuuS0xnjzJI3d0oNkusO2K5dh2ZkkVxQLMSmeby2BX9Tq6FEv5Yr3HUud axbt0iiwvQt6Ug7iatlv051TVIBh67kZxVbHJgNaRZ4X6xRsN2nTey3iAtUo1HxJqbuo kOl67BymY/d/64qwJ5gkH77BaExw2etjAHxOOtVb68pd8SaIrel4nGmvNe8ZptN5EXB6 Kk4wM3q6TAHGRZUdGkjO8CFhEbXvepRTLOnB09R7K6X3PXO9eilG32H0XLzMtkkTswtX T+J2XDDVQpIhYbLuaBPAx9/3xxW+bIRdKwUnPZzAmGQOSEGwmjXuqJfWXNExc6cOWiuD NdNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=8LDYDSILwReEKdK44P5QouSpkF5WXIdB3iZ2/ZYYpIo=; b=u0wZV+epjAq2cVIRiSDLpdSpEJ0hDLKbQKvTNVg6gQ0nZtAi5PyQcLRLM9P3BgPiEQ 94mol/5jdg07CRIquNZm4cVeE9Ugfr5Z5F/8gSk2x134VWFhIpkm+ESRRujChHsi9+9E 7scyj78ZpqYr4s8V3VhXMW/YdYbnCNRWGm3X7HTRvqG0bHPthVA4SfG/stUWdaKiwh37 tJ2C2IKxorBebpGdqxzdxBAzEZho2NW7x6iBozR9wqutTyp7jBMh82Ahe1CQpAeX2uQa 2oY2hNr/n4mkdzWmYH0+ZpoK2lZd2BFgS6xo27ECU+8iOHISLovVFlHH2S2ilnVxngP7 fOVw== X-Gm-Message-State: AOAM530QlqKTW1fheejcBb9P4zR/jo8dfcDvxi2r2srWXkf/8E6THXy6 VCC0TEeC9yMfyo1f3EIDnNP8TOUp8gcByG2pnCM= X-Google-Smtp-Source: ABdhPJxqvbv888+lkkFm6JMjwEgT1lWdy0h7DMeV3Jakh23HnPfxNNXSzAYR53OlilzA5NBqg0uMUhqZo24PDGAuV5U= X-Received: by 2002:a2e:a588:: with SMTP id m8mr14250991ljp.23.1636524817695; Tue, 09 Nov 2021 22:13:37 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Wed, 10 Nov 2021 00:13:26 -0600 Message-ID: Subject: Compounding patch To: Shyam Prasad N , CIFS Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Of the 8 compounding optimizations (to use an existing handle if we already have it open), I removed 4 of the 8 sections, but merged the other half. See attached: I left out mkdir and unlink since in those cases the open is what is doing the work. For the hardlink case I wanted to verify the permissions needed (you are checking for a writable handle but the code doesn't appear to be requesting that when no handle is found) so I wanted to look at that in more detail (and also the rmdir case - although that may be one we want to add back). Even with those changes I see a few examples were we appear to not reuse the already open handle in e.g. revalidate - so there may be additional compounding optimizations that we can do. @@ -608,10 +614,13 @@ smb2_mkdir(const unsigned int xid, struct inode *parent_inode, umode_t mode, struct cifs_tcon *tcon, const char *name, struct cifs_sb_info *cifs_sb) { + struct cifsFileInfo *cfile; + + cifs_get_writable_path(tcon, name, FIND_WR_ANY, &cfile); return smb2_compound_op(xid, tcon, cifs_sb, name, FILE_WRITE_ATTRIBUTES, FILE_CREATE, CREATE_NOT_FILE, mode, NULL, SMB2_OP_MKDIR, - NULL); + cfile); } void static int @@ -642,18 +651,24 @@ int smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name, struct cifs_sb_info *cifs_sb) { + struct cifsFileInfo *cfile; + + cifs_get_writable_path(tcon, name, FIND_WR_WITH_DELETE, &cfile); return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN, CREATE_NOT_FILE, ACL_NO_MODE, - NULL, SMB2_OP_RMDIR, NULL); + NULL, SMB2_OP_RMDIR, cfile); } int smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name, struct cifs_sb_info *cifs_sb) { + struct cifsFileInfo *cfile; + + cifs_get_writable_path(tcon, name, FIND_WR_WITH_DELETE, &cfile); return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN, CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT, - ACL_NO_MODE, NULL, SMB2_OP_DELETE, NULL); + ACL_NO_MODE, NULL, SMB2_OP_DELETE, cfile); } static int @@ -696,9 +711,12 @@ smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, const char *from_name, const char *to_name, struct cifs_sb_info *cifs_sb) { + struct cifsFileInfo *cfile; + + cifs_get_writable_path(tcon, from_name, FIND_WR_ANY, &cfile); return smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb, FILE_READ_ATTRIBUTES, SMB2_OP_HARDLINK, - NULL); + cfile); } int