Re: [PATCH 1/3] fs: fcntl add set_flags wrapper

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

 



Christoph Hellwig <hch@xxxxxxxxxxxxx> writes:

>> +	else {
>> +		spin_lock(&filp->f_lock);
>> +		filp->f_flags = (arg & SETFL_MASK) |
>> +			(filp->f_flags & ~SETFL_MASK);
>> +		spin_unlock(&filp->f_lock);
>
> Please move this into an exported generic_file_set_flags helper, that
> the filesystems can use in their implementations instead of duplicating
> it.
Ok. Will do
>
> Also a more conceptual question:  Basically any check the filesystems
> may perform needs to be duplicated in open and ->set_flags.  Any chance
> to have the open path call into ->set_flags?
After your point I've checked various ->open callbacks and found
that most filesystem makes important decisions such as:
cifs_open:
        if (file->f_flags & O_DIRECT &&
            cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) {
               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
                        file->f_op = &cifs_file_direct_nobrl_ops;
                else
                        file->f_op = &cifs_file_direct_ops;
                        }
         }
And I am completely agree that it is reasonable to move such
functionality to ->set_flags and let ->open call ->set_flags internally.
 ->set_flags can determine that it is called from open by condition:
(filp->f_flags & SETFL_MASK) == (arg & SETFL_MASK)
I'll fix setfl to prevent ->set_flags if args are the same

Attachment: pgpUd7taQ7iug.pgp
Description: PGP signature


[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