Re: [PATCH v3 3/5] CIFS: Separate protocol specific lock type handling

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

 



29 марта 2012 г. 23:34 пользователь Jeff Layton <jlayton@xxxxxxxxxx> написал:
> On Tue, 27 Mar 2012 15:38:37 +0400
> Pavel Shilovsky <piastry@xxxxxxxxxxx> wrote:
>
>> Signed-off-by: Pavel Shilovsky <piastry@xxxxxxxxxxx>
>> ---
>>  fs/cifs/file.c |   48 +++++++++++++++++++++++++++++++++++++-----------
>>  1 files changed, 37 insertions(+), 11 deletions(-)
>>
>> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
>> index 2e541f0..6e72b1f 100644
>> --- a/fs/cifs/file.c
>> +++ b/fs/cifs/file.c
>> @@ -684,6 +684,30 @@ cifs_locks_delete_block(struct file_lock *waiter)
>>       unlock_flocks();
>>  }
>>
>> +static inline __u32
>> +large_lock_type(void)
>> +{
>> +     return LOCKING_ANDX_LARGE_FILES;
>> +}
>> +
>> +static inline __u32
>> +exclusive_lock_type(void)
>> +{
>> +     return 0;
>> +}
>> +
>> +static inline __u32
>> +shared_lock_type(void)
>> +{
>> +     return LOCKING_ANDX_SHARED_LOCK;
>> +}
>> +
>> +static inline __u32
>> +unlock_lock_type(void)
>> +{
>> +     return 0;
>> +}
>> +
>
> I assume that at some point you'll need to add a set of SMB2 equivalent
> ops and then swap them in (probably at NEGOTIATE time)?
>
> If so, would it make sense to bundle these up into a "struct
> smb_protocol_operations" and hang it off the TCP_Server_Info? Then
> you'd just turn the calls below into stuff like:
>
>    server->proto_ops->large_lock_type
>
> By doing that, it'll be easier to merge in SMB2 code without disturbing
> the existing code as much. Also, if we find later that we need a new
> set of ops for 2.1, 2.2, 2.3, etc, then we can simply drop in
> replacement operations for them.
>
> I think doing that will be more sound engineering than sprinkling
> "is_smb2" checks all over the place...
>

Yes, moving these functions to a separate transport ops structure that
is going to become a part of TCP_Server_Info will be the next step.

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


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux