xiaoxiang781216 commented on code in PR #11140:
URL: https://github.com/apache/nuttx/pull/11140#discussion_r1388758955
##########
fs/inode/fs_files.c:
##########
@@ -51,59 +52,118 @@
* Private Functions
****************************************************************************/
+/****************************************************************************
+ * Name: files_fget_by_index
+ ****************************************************************************/
+
+static FAR struct file *files_fget_by_index(FAR struct filelist *list,
+ int l1, int l2)
+{
+ FAR struct file *filep;
+ irqstate_t flags;
+
+ flags = spin_lock_irqsave(NULL);
Review Comment:
how about change fl_lock from mutex to spinlock to improve the efficient in
SMP?
##########
fs/inode/fs_files.c:
##########
@@ -51,59 +52,118 @@
* Private Functions
****************************************************************************/
+/****************************************************************************
+ * Name: files_fget_by_index
+ ****************************************************************************/
+
+static FAR struct file *files_fget_by_index(FAR struct filelist *list,
+ int l1, int l2)
+{
+ FAR struct file *filep;
+ irqstate_t flags;
+
+ flags = spin_lock_irqsave(NULL);
+
+ filep = &list->fl_files[l1][l2];
+
+ spin_unlock_irqrestore(NULL, flags);
+
+ return filep;
+}
+
+/****************************************************************************
+ * Name: files_fget
+ ****************************************************************************/
+
+static FAR struct file *files_fget(FAR struct filelist *list, int fd)
+{
+ return files_fget_by_index(list, fd / CONFIG_NFILE_DESCRIPTORS_PER_BLOCK,
+ fd % CONFIG_NFILE_DESCRIPTORS_PER_BLOCK);
Review Comment:
align
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]