From 0b2b5b781ca441c83840d49ab291e58c27cffafd Mon Sep 17 00:00:00 2001 From: hujun5 Date: Thu, 15 Jun 2023 09:56:46 +0800 Subject: [PATCH] fs: remove sched_[un]lock Signed-off-by: hujun5 --- fs/aio/aio_cancel.c | 2 -- fs/mqueue/mq_unlink.c | 3 --- fs/procfs/fs_procfs.c | 3 --- fs/semaphore/sem_open.c | 11 ----------- fs/semaphore/sem_unlink.c | 3 --- 5 files changed, 22 deletions(-) diff --git a/fs/aio/aio_cancel.c b/fs/aio/aio_cancel.c index ac8b4119a9..a3a6ca9cd9 100644 --- a/fs/aio/aio_cancel.c +++ b/fs/aio/aio_cancel.c @@ -100,7 +100,6 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp) */ ret = AIO_ALLDONE; - sched_lock(); aio_lock(); if (aiocbp) @@ -220,7 +219,6 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp) } aio_unlock(); - sched_unlock(); return ret; } diff --git a/fs/mqueue/mq_unlink.c b/fs/mqueue/mq_unlink.c index 9360ca2f7f..95e92dea64 100644 --- a/fs/mqueue/mq_unlink.c +++ b/fs/mqueue/mq_unlink.c @@ -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) { @@ -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: @@ -186,7 +184,6 @@ errout_with_inode: errout_with_search: RELEASE_SEARCH(&desc); - sched_unlock(); return ret; } diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index 638b72f77b..c8fc8ba0d7 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -1181,8 +1181,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) @@ -1199,7 +1197,6 @@ int procfs_register(FAR const struct procfs_entry_s *entry) ret = OK; } - sched_unlock(); return ret; } #endif diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c index b7b8e9862d..7b5d2036ac 100644 --- a/fs/semaphore/sem_open.c +++ b/fs/semaphore/sem_open.c @@ -118,15 +118,6 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...) } } - /* 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, @@ -254,7 +245,6 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...) } RELEASE_SEARCH(&desc); - sched_unlock(); return sem; errout_with_inode: @@ -263,7 +253,6 @@ errout_with_inode: errout_with_lock: RELEASE_SEARCH(&desc); set_errno(errcode); - sched_unlock(); return SEM_FAILED; } diff --git a/fs/semaphore/sem_unlink.c b/fs/semaphore/sem_unlink.c index f363c2a534..785d942922 100644 --- a/fs/semaphore/sem_unlink.c +++ b/fs/semaphore/sem_unlink.c @@ -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) { @@ -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: @@ -155,6 +153,5 @@ errout_with_inode: errout_with_search: RELEASE_SEARCH(&desc); set_errno(errcode); - sched_unlock(); return ERROR; }