Re: spin_lock when create pseudo inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 13, 2014 at 12:17 AM, Vadim Kochan <vadim4j@xxxxxxxxx> wrote:
> Hi,
>
> In fs/inode.c:
> ...
>
> struct inode *new_inode_pseudo(struct super_block *sb)
> {
>     struct inode *inode = alloc_inode(sb);
>
>     if (inode) {
>         spin_lock(&inode->i_lock);
>         inode->i_state = 0;
>         spin_unlock(&inode->i_lock);
>         INIT_LIST_HEAD(&inode->i_sb_list);
>     }
>     return inode;
> }
> ...
>
> Do we really need spin_lock for inode->i_state = 0 ? Why not:
>     atomic_set(&inode->i_state, 0);

->i_state is not of type atomic_t.
See also https://lkml.org/lkml/2014/1/10/101

-- 
Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux