Re: [PATCH][SMB3] Cleanup sparse file support by creating worker function for it

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

 



On Thu, 14 Aug 2014 16:44:15 -0500, Steve French wrote:

> Simply move code to new function (for clarity).  The new function
> sets or clears the sparse file attribute flag.
> 
> Signed-off-by: Steve French <smfrench@xxxxxxxxx>
> ---
>  fs/cifs/smb2ops.c | 82 ++++++++++++++++++++++++++++++++++---------------------
>  1 file changed, 51 insertions(+), 31 deletions(-)
> 
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 7463436..04a86cc 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -731,6 +731,54 @@ smb2_sync_write(const unsigned int xid, struct
> cifsFileInfo *cfile,
>      return SMB2_write(xid, parms, written, iov, nr_segs);
>  }
> 
> +/* Set or clear the SPARSE_FILE attribute based on value passed in setsparse */
> +static bool smb2_set_sparse(const unsigned int xid, struct cifs_tcon *tcon,
> +        struct cifsFileInfo *cfile, struct inode *inode, __u8 setsparse)
> +{
> +    struct cifsInodeInfo *cifsi;
> +    int rc;
> +
> +    cifsi = CIFS_I(inode);
> +
> +    /* if file already sparse don't bother setting sparse again */
> +    if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) && setsparse)
> +        return true; /* already sparse */
> +
> +    if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) && !setsparse)
> +        return true; /* already not sparse */
> +
> +

Drop one of the empty lines above. Looks good otherwise.

Reviewed-by: David Disseldorp <ddiss@xxxxxxxxx>

Cheers, David
--
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