diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-10-15 15:34:03 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-10-17 21:32:01 -0400 |
commit | 4477288a103631980750c86547d1fd54bfd2ba7d (patch) | |
tree | e0d56476a740f043f6687e063ff88d2982b4c444 /fs/cifs/readdir.c | |
parent | 7a16f1961a5c61d1f60d9e0d3d171cf7793fb5cb (diff) |
cifs: convert GlobalSMBSeslock from a rwlock to regular spinlock
Convert this lock to a regular spinlock
A rwlock_t offers little value here. It's more expensive than a regular
spinlock unless you have a fairly large section of code that runs under
the read lock and can benefit from the concurrency.
Additionally, we need to ensure that the refcounting for files isn't
racy and to do that we need to lock areas that can increment it for
write. That means that the areas that can actually use a read_lock are
very few and relatively infrequently used.
While we're at it, change the name to something easier to type, and fix
a bug in find_writable_file. cifsFileInfo_put can sleep and shouldn't be
called while holding the lock.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r-- | fs/cifs/readdir.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 6f3d13ff9470..ef7bb7b50f58 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -528,14 +528,14 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
528 | (index_to_find < first_entry_in_buffer)) { | 528 | (index_to_find < first_entry_in_buffer)) { |
529 | /* close and restart search */ | 529 | /* close and restart search */ |
530 | cFYI(1, "search backing up - close and restart search"); | 530 | cFYI(1, "search backing up - close and restart search"); |
531 | write_lock(&GlobalSMBSeslock); | 531 | spin_lock(&cifs_file_list_lock); |
532 | if (!cifsFile->srch_inf.endOfSearch && | 532 | if (!cifsFile->srch_inf.endOfSearch && |
533 | !cifsFile->invalidHandle) { | 533 | !cifsFile->invalidHandle) { |
534 | cifsFile->invalidHandle = true; | 534 | cifsFile->invalidHandle = true; |
535 | write_unlock(&GlobalSMBSeslock); | 535 | spin_unlock(&cifs_file_list_lock); |
536 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 536 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
537 | } else | 537 | } else |
538 | write_unlock(&GlobalSMBSeslock); | 538 | spin_unlock(&cifs_file_list_lock); |
539 | if (cifsFile->srch_inf.ntwrk_buf_start) { | 539 | if (cifsFile->srch_inf.ntwrk_buf_start) { |
540 | cFYI(1, "freeing SMB ff cache buf on search rewind"); | 540 | cFYI(1, "freeing SMB ff cache buf on search rewind"); |
541 | if (cifsFile->srch_inf.smallBuf) | 541 | if (cifsFile->srch_inf.smallBuf) |