Skip to content

Commit

Permalink
fs: modify or remove sched_[un]lock
Browse files Browse the repository at this point in the history
Signed-off-by: hujun5 <hujun5@xiaomi.com>
  • Loading branch information
hujun260 committed Jul 27, 2023
1 parent 02153a2 commit 55dfca0
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 22 deletions.
2 changes: 0 additions & 2 deletions fs/aio/aio_cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp)
*/

ret = AIO_ALLDONE;
sched_lock();
aio_lock();

if (aiocbp)
Expand Down Expand Up @@ -220,7 +219,6 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp)
}

aio_unlock();
sched_unlock();
return ret;
}

Expand Down
3 changes: 0 additions & 3 deletions fs/mqueue/mq_unlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ int file_mq_unlink(FAR const char *mq_name)

SETUP_SEARCH(&desc, fullpath, false);

sched_lock();
ret = inode_find(&desc);
if (ret < 0)
{
Expand Down Expand Up @@ -175,7 +174,6 @@ int file_mq_unlink(FAR const char *mq_name)
inode_unlock();
mq_inode_release(inode);
RELEASE_SEARCH(&desc);
sched_unlock();
return OK;

errout_with_lock:
Expand All @@ -186,7 +184,6 @@ int file_mq_unlink(FAR const char *mq_name)

errout_with_search:
RELEASE_SEARCH(&desc);
sched_unlock();
return ret;
}

Expand Down
3 changes: 0 additions & 3 deletions fs/procfs/fs_procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,8 +1172,6 @@ int procfs_register(FAR const struct procfs_entry_s *entry)
newcount = g_procfs_entrycount + 1;
newsize = newcount * sizeof(struct procfs_entry_s);

sched_lock();

newtable = (FAR struct procfs_entry_s *)
kmm_realloc(g_procfs_entries, newsize);
if (newtable != NULL)
Expand All @@ -1190,7 +1188,6 @@ int procfs_register(FAR const struct procfs_entry_s *entry)
ret = OK;
}

sched_unlock();
return ret;
}
#endif
11 changes: 0 additions & 11 deletions fs/semaphore/sem_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,6 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...)

DEBUGASSERT(name != NULL);

/* The POSIX specification requires that the "check for the existence
* of a semaphore and the creation of the semaphore if it does not
* exist shall be atomic with respect to other processes executing
* sem_open()..." A simple sched_lock() should be sufficient to meet
* this requirement.
*/

sched_lock();

/* Get the full path to the semaphore */

snprintf(fullpath, MAX_SEMPATH,
Expand Down Expand Up @@ -239,7 +230,6 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...)
}

RELEASE_SEARCH(&desc);
sched_unlock();
return sem;

errout_with_inode:
Expand All @@ -248,7 +238,6 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...)
errout_with_lock:
RELEASE_SEARCH(&desc);
set_errno(errcode);
sched_unlock();
return SEM_FAILED;
}

Expand Down
3 changes: 0 additions & 3 deletions fs/semaphore/sem_unlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ int sem_unlink(FAR const char *name)

SETUP_SEARCH(&desc, fullpath, false);

sched_lock();
ret = inode_find(&desc);
if (ret < 0)
{
Expand Down Expand Up @@ -143,7 +142,6 @@ int sem_unlink(FAR const char *name)
inode_unlock();
ret = sem_close(&inode->u.i_nsem->ns_sem);
RELEASE_SEARCH(&desc);
sched_unlock();
return ret;

errout_with_lock:
Expand All @@ -155,6 +153,5 @@ int sem_unlink(FAR const char *name)
errout_with_search:
RELEASE_SEARCH(&desc);
set_errno(errcode);
sched_unlock();
return ERROR;
}

0 comments on commit 55dfca0

Please sign in to comment.