From: Alan Cox Date: Thu, 14 Dec 2017 12:13:39 +0000 (+0000) Subject: i_deref: remove repeated evaluations X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=8ec1a4ca1753479f68dc6dc380da557f1c5c15c5;p=FUZIX.git i_deref: remove repeated evaluations Cleans up the code and saves us another 26 bytes as a side effect --- diff --git a/Kernel/filesys.c b/Kernel/filesys.c index 73691179..56d5ee1d 100644 --- a/Kernel/filesys.c +++ b/Kernel/filesys.c @@ -787,12 +787,14 @@ int8_t uf_alloc(void) void i_deref(inoptr ino) { + uint16_t mode = ino->c_node.i_mode & F_MASK; + magic(ino); if(!ino->c_refs) panic(PANIC_INODE_FREED); - if((ino->c_node.i_mode & F_MASK) == F_PIPE) + if (mode == F_PIPE) wakeup((char *)ino); /* If the inode has no links and no refs, it must have @@ -802,9 +804,7 @@ void i_deref(inoptr ino) /* SN (mcy) */ - if(((ino->c_node.i_mode & F_MASK) == F_REG) || - ((ino->c_node.i_mode & F_MASK) == F_DIR) || - ((ino->c_node.i_mode & F_MASK) == F_PIPE)) + if (mode == F_REG || mode == F_DIR || mode == F_PIPE) f_trunc(ino); /* If the inode was modified, we must write it to disk. */