From: Dmitry Monakhov <dmonakhov@openvz.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk
Subject: Re: [PATCH 1/3] fs: fcntl add set_flags wrapper
Date: Tue, 14 Oct 2014 19:30:47 +0400 [thread overview]
Message-ID: <87bnpept20.fsf@openvz.org> (raw)
In-Reply-To: <20141011133741.GB29004@infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1362 bytes --]
Christoph Hellwig <hch@infradead.org> 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 #2: Type: application/pgp-signature, Size: 818 bytes --]
prev parent reply other threads:[~2014-10-14 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-10 16:29 [PATCH 1/3] fs: fcntl add set_flags wrapper Dmitry Monakhov
2014-10-10 16:29 ` [PATCH 2/3] fs: add fadvise file_operation Dmitry Monakhov
2014-10-10 16:29 ` [PATCH 3/3] ecryptfs: add fadvise/set_flags calbacks Dmitry Monakhov
2014-10-11 13:37 ` [PATCH 1/3] fs: fcntl add set_flags wrapper Christoph Hellwig
2014-10-14 15:30 ` Dmitry Monakhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bnpept20.fsf@openvz.org \
--to=dmonakhov@openvz.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.