mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
smbd: Remove a smb1-only optimization findfirst/findnext
I don't think this is an effective optimization at all anymore. It was intended to speed up non-wildcard readdirs after we found the correct entry. Nowadays we do the non-wildcard readdirs by a direct fstatat, and after we successfully found the entry dptr_ReadDirName() immediately returns without any further action. So my very strong guess is that this never really kicked in anymore. Not using this flag can't be *that* bad, smb2 never used it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
cf4e55421b
commit
079aad50ef
@ -208,7 +208,6 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
|
||||
char *end_data,
|
||||
int space_remaining,
|
||||
struct smb_filename **smb_fname,
|
||||
bool *got_exact_match,
|
||||
int *_last_entry_off,
|
||||
struct ea_list *name_list,
|
||||
struct file_id *file_id);
|
||||
|
@ -784,7 +784,6 @@ static NTSTATUS get_lanman2_dir_entry(TALLOC_CTX *ctx,
|
||||
char *base_data,
|
||||
char *end_data,
|
||||
int space_remaining,
|
||||
bool *got_exact_match,
|
||||
int *last_entry_off,
|
||||
struct ea_list *name_list)
|
||||
{
|
||||
@ -803,7 +802,6 @@ static NTSTATUS get_lanman2_dir_entry(TALLOC_CTX *ctx,
|
||||
ppdata, base_data, end_data,
|
||||
space_remaining,
|
||||
NULL,
|
||||
got_exact_match,
|
||||
last_entry_off, name_list, NULL);
|
||||
}
|
||||
|
||||
@ -1114,7 +1112,6 @@ static void call_trans2findfirst(connection_struct *conn,
|
||||
ask_sharemode = fsp_search_ask_sharemode(fsp);
|
||||
|
||||
for (i=0;(i<maxentries) && !finished && !out_of_space;i++) {
|
||||
bool got_exact_match = False;
|
||||
|
||||
ntstatus = get_lanman2_dir_entry(talloc_tos(),
|
||||
conn,
|
||||
@ -1130,7 +1127,6 @@ static void call_trans2findfirst(connection_struct *conn,
|
||||
pdata,
|
||||
data_end,
|
||||
space_remaining,
|
||||
&got_exact_match,
|
||||
&last_entry_off,
|
||||
ea_list);
|
||||
if (NT_STATUS_EQUAL(ntstatus, NT_STATUS_ILLEGAL_CHARACTER)) {
|
||||
@ -1150,17 +1146,6 @@ static void call_trans2findfirst(connection_struct *conn,
|
||||
numentries++;
|
||||
}
|
||||
|
||||
/*
|
||||
* As an optimisation if we know we aren't looking
|
||||
* for a wildcard name (ie. the name matches the wildcard exactly)
|
||||
* then we can finish on any (first) match.
|
||||
* This speeds up large directory searches. JRA.
|
||||
*/
|
||||
|
||||
if (got_exact_match) {
|
||||
finished = true;
|
||||
}
|
||||
|
||||
/* Ensure space_remaining never goes -ve. */
|
||||
if (PTR_DIFF(p,pdata) > max_data_bytes) {
|
||||
space_remaining = 0;
|
||||
@ -1593,7 +1578,6 @@ static void call_trans2findnext(connection_struct *conn,
|
||||
ask_sharemode = fsp_search_ask_sharemode(fsp);
|
||||
|
||||
for (i=0;(i<(int)maxentries) && !finished && !out_of_space ;i++) {
|
||||
bool got_exact_match = False;
|
||||
|
||||
ntstatus = get_lanman2_dir_entry(ctx,
|
||||
conn,
|
||||
@ -1609,7 +1593,6 @@ static void call_trans2findnext(connection_struct *conn,
|
||||
pdata,
|
||||
data_end,
|
||||
space_remaining,
|
||||
&got_exact_match,
|
||||
&last_entry_off,
|
||||
ea_list);
|
||||
if (NT_STATUS_EQUAL(ntstatus, NT_STATUS_ILLEGAL_CHARACTER)) {
|
||||
@ -1629,17 +1612,6 @@ static void call_trans2findnext(connection_struct *conn,
|
||||
numentries++;
|
||||
}
|
||||
|
||||
/*
|
||||
* As an optimisation if we know we aren't looking
|
||||
* for a wildcard name (ie. the name matches the wildcard exactly)
|
||||
* then we can finish on any (first) match.
|
||||
* This speeds up large directory searches. JRA.
|
||||
*/
|
||||
|
||||
if (got_exact_match) {
|
||||
finished = true;
|
||||
}
|
||||
|
||||
space_remaining = max_data_bytes - PTR_DIFF(p,pdata);
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,6 @@ static bool smb2_query_directory_next_entry(struct tevent_req *req)
|
||||
struct smbd_smb2_query_directory_state *state = tevent_req_data(
|
||||
req, struct smbd_smb2_query_directory_state);
|
||||
struct smb_filename *smb_fname = NULL; /* relative to fsp !! */
|
||||
bool got_exact_match = false;
|
||||
int off = state->out_output_buffer.length;
|
||||
int space_remaining = state->in_output_buffer_length - off;
|
||||
struct file_id file_id;
|
||||
@ -574,7 +573,6 @@ static bool smb2_query_directory_next_entry(struct tevent_req *req)
|
||||
state->end_data,
|
||||
space_remaining,
|
||||
&smb_fname,
|
||||
&got_exact_match,
|
||||
&state->last_entry_off,
|
||||
NULL,
|
||||
&file_id);
|
||||
|
@ -1912,7 +1912,6 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
|
||||
char *end_data,
|
||||
int space_remaining,
|
||||
struct smb_filename **_smb_fname,
|
||||
bool *got_exact_match,
|
||||
int *_last_entry_off,
|
||||
struct ea_list *name_list,
|
||||
struct file_id *file_id)
|
||||
@ -1941,8 +1940,6 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
|
||||
state.got_exact_match = false;
|
||||
state.case_sensitive = dptr_case_sensitive(dirptr);
|
||||
|
||||
*got_exact_match = false;
|
||||
|
||||
p = strrchr_m(path_mask,'/');
|
||||
if(p != NULL) {
|
||||
if(p[1] == '\0') {
|
||||
@ -1971,8 +1968,6 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
|
||||
return NT_STATUS_END_OF_FILE;
|
||||
}
|
||||
|
||||
*got_exact_match = state.got_exact_match;
|
||||
|
||||
marshall_with_83_names = (mangled_names == MANGLED_NAMES_YES);
|
||||
|
||||
status = smbd_marshall_dir_entry(ctx,
|
||||
|
Loading…
Reference in New Issue
Block a user