From: Paulo Alcantara <pc@manguebit.com>
To: smfrench@gmail.com
Cc: linux-cifs@vger.kernel.org, Paulo Alcantara <pc@manguebit.com>
Subject: [PATCH 8/8] smb: client: optimise dentry revalidation for reparse points
Date: Sat, 25 Nov 2023 19:08:13 -0300 [thread overview]
Message-ID: <20231125220813.30538-9-pc@manguebit.com> (raw)
In-Reply-To: <20231125220813.30538-1-pc@manguebit.com>
If the positive dentry is known to be a reparse point already, save a
roundtrip in ->query_path_info() by sending compound request with
OPEN_REPARSE_POINT.
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
---
fs/smb/client/inode.c | 2 ++
fs/smb/client/smb2inode.c | 11 ++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index bd83b080b184..79240f1d252a 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -1142,6 +1142,8 @@ static int cifs_get_fattr(struct cifs_open_info_data *data,
*/
if (!data) {
+ if (*inode && CIFS_I(*inode)->reparse)
+ tmp_data.reparse_point = true;
rc = server->ops->query_path_info(xid, tcon, cifs_sb,
full_path, &tmp_data);
data = &tmp_data;
diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index 3e8ba41b790d..9d1b043b8356 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -667,7 +667,6 @@ int smb2_query_path_info(const unsigned int xid,
int rc, rc2;
data->adjust_tz = false;
- data->reparse_point = false;
if (strcmp(full_path, ""))
rc = -ENOENT;
@@ -689,6 +688,9 @@ int smb2_query_path_info(const unsigned int xid,
in_iov[0].iov_len = sizeof(*data);
in_iov[1] = in_iov[0];
+ if (data->reparse_point)
+ goto open_reparse;
+
cifs_get_readable_path(tcon, full_path, &cfile);
rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
FILE_READ_ATTRIBUTES, FILE_OPEN,
@@ -714,6 +716,7 @@ int smb2_query_path_info(const unsigned int xid,
/* symlink already parsed in create response */
num_cmds = 1;
} else {
+open_reparse:
cmds[1] = SMB2_OP_GET_REPARSE;
num_cmds = 2;
}
@@ -766,8 +769,6 @@ int smb311_posix_query_path_info(const unsigned int xid,
int i, num_cmds;
data->adjust_tz = false;
- data->reparse_point = false;
-
/*
* BB TODO: Add support for using the cached root handle.
* Create SMB2_query_posix_info worker function to do non-compounded query
@@ -778,6 +779,9 @@ int smb311_posix_query_path_info(const unsigned int xid,
in_iov[0].iov_len = sizeof(*data);
in_iov[1] = in_iov[0];
+ if (data->reparse_point)
+ goto open_reparse;
+
cifs_get_readable_path(tcon, full_path, &cfile);
rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
FILE_READ_ATTRIBUTES, FILE_OPEN,
@@ -802,6 +806,7 @@ int smb311_posix_query_path_info(const unsigned int xid,
/* symlink already parsed in create response */
num_cmds = 1;
} else {
+open_reparse:
cmds[1] = SMB2_OP_GET_REPARSE;
num_cmds = 2;
}
--
2.43.0
prev parent reply other threads:[~2023-11-25 22:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-25 22:08 [PATCH 0/8] reparse points work Paulo Alcantara
2023-11-25 22:08 ` [PATCH 1/8] smb: client: extend smb2_compound_op() to accept more commands Paulo Alcantara
2023-11-25 22:08 ` [PATCH 2/8] smb: client: allow creating special files via reparse points Paulo Alcantara
2023-11-26 0:14 ` kernel test robot
2023-11-25 22:08 ` [PATCH 3/8] smb: client: allow creating symlinks " Paulo Alcantara
2023-11-26 0:56 ` kernel test robot
2023-11-25 22:08 ` [PATCH 4/8] smb: client: optimise reparse point querying Paulo Alcantara
2023-11-25 22:08 ` [PATCH 5/8] smb: client: fix renaming of reparse points Paulo Alcantara
2023-11-25 22:08 ` [PATCH 6/8] smb: client: fix hardlinking " Paulo Alcantara
2023-11-25 22:08 ` [PATCH 7/8] smb: client: cleanup smb2_query_reparse_point() Paulo Alcantara
2023-11-25 22:08 ` Paulo Alcantara [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231125220813.30538-9-pc@manguebit.com \
--to=pc@manguebit.com \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox