linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Anna.Schumaker@netapp.com
Cc: bfields@fieldses.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2 2/2] NFSD: Implement SEEK
Date: Tue, 9 Sep 2014 10:56:07 -0700	[thread overview]
Message-ID: <20140909175607.GB10399@infradead.org> (raw)
In-Reply-To: <1409679038-32179-3-git-send-email-Anna.Schumaker@Netapp.com>

> +	switch (seek->seek_whence) {
> +	case NFS4_CONTENT_DATA:
> +		seek->seek_pos = vfs_llseek(file, seek->seek_offset, SEEK_DATA);
> +		break;
> +	case NFS4_CONTENT_HOLE:
> +		seek->seek_pos = vfs_llseek(file, seek->seek_offset, SEEK_HOLE);
> +		break;
> +	default:
> +		status = nfserr_union_notsupp;
> +		goto out;
> +	}

nipick: maybe just assign pos in the switch, and have a single
vfs_llseek call?

Also this might want a comment that vfs_llseek is changing file->f_pos,
but nothing in NFSD should ever rely on file->f_pos.

>  static __be32
> +nfsd4_encode_seek(struct nfsd4_compoundres *resp, __be32 nfserr,
> +		  struct nfsd4_seek *seek)
> +{
> +	__be32 *p;
> +
> +	if (nfserr)
> +		return nfserr;
> +
> +	p = xdr_reserve_space(&resp->xdr, 12);

nipick: can you replace the 12 by a "4 + 8"?  I think having one
literal for each field later encoded helps reading the XDR code a lot.
And although it might not matter for a trivial encoder like this it
set standards for future copy and paste code.


  reply	other threads:[~2014-09-09 17:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 17:30 [PATCH v2 0/2] NFSD: Add v4.2 SEEK support Anna.Schumaker
2014-09-02 17:30 ` [PATCH v2 1/2] NFSD: Add generic v4.2 infrastructure Anna.Schumaker
2014-09-09 17:53   ` Christoph Hellwig
2014-09-02 17:30 ` [PATCH v2 2/2] NFSD: Implement SEEK Anna.Schumaker
2014-09-09 17:56   ` Christoph Hellwig [this message]
2014-09-09 19:17     ` Anna Schumaker
2014-09-02 19:10 ` [PATCH v2 0/2] NFSD: Add v4.2 SEEK support J. Bruce Fields
2014-09-22 17:53   ` J. Bruce Fields

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=20140909175607.GB10399@infradead.org \
    --to=hch@infradead.org \
    --cc=Anna.Schumaker@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).