All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "J. Bruce Fields" <bfields@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/5] nfsd: bypass readahead cache when have struct file
Date: Fri, 30 Jul 2010 04:10:42 -0400	[thread overview]
Message-ID: <20100730081041.GA4126@infradead.org> (raw)
In-Reply-To: <1280442084-17867-2-git-send-email-bfields@redhat.com>

On Thu, Jul 29, 2010 at 06:21:20PM -0400, J. Bruce Fields wrote:
> The readahead cache compensates for the fact that the NFS server
> currently does an open and close on every IO operation in the NFSv2 and
> NFSv3 case.
> 
> In the NFSv4 case we have long-lived struct files associated with client
> opens, so there's no need for this.  In fact, concurrent IO's using
> trying to modify the same file->f_ra may cause problems.

Interesting.  So why did we get these for v4, but not a file handle
cache for v2 and v3 at the same time?  That would make life for the
filesystems a lot easier.

>  		if (err)
>  			goto out;
>  		err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count);
> -	} else {
> -		err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
> -		if (err)
> -			goto out;
> -		err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count);
> -		nfsd_close(file);
> -	}
> +	} else
> +		err = nfsd_open_read(rqstp, fhp, offset, vec, vlen, count);

The callers of nfsd_read are:

fs/nfsd/nfs3proc.c:     nfserr = nfsd_read(rqstp, &resp->fh, NULL,
fs/nfsd/nfs4proc.c:     /* no need to check permission - this will be done in nfsd_read() */
fs/nfsd/nfs4xdr.c:      nfserr = nfsd_read(read->rd_rqstp, read->rd_fhp, read->rd_filp,
fs/nfsd/nfsproc.c:      nfserr = nfsd_read(rqstp, fh_copy(&resp->fh, &argp->fh), NULL,

which suggests that we're better off just calling nfsd_open_read
(possible with a better name) directly from fs/nfsd/nfs3proc.c and
fs/nfsd/nfsproc.c and nfsd_vfs_read directly from fs/nfsd/nfs4proc.c
and fs/nfsd/nfs4xdr.c instead of doing this conditional.


  reply	other threads:[~2010-07-30  8:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29 22:21 nfsd fixes for 2.6.36 J. Bruce Fields
2010-07-29 22:21 ` [PATCH 1/5] nfsd: bypass readahead cache when have struct file J. Bruce Fields
2010-07-30  8:10   ` Christoph Hellwig [this message]
2010-07-30  8:19     ` Bian Naimeng
2010-07-30  8:25       ` Christoph Hellwig
2010-07-30 15:41     ` J. Bruce Fields
2010-07-30 18:30       ` J. Bruce Fields
2010-07-31 18:18     ` J. Bruce Fields
2010-07-29 22:21 ` [PATCH 2/5] nfsd4: don't pretend to support write delegations J. Bruce Fields
2010-07-29 22:21 ` [PATCH 3/5] nfsd4: miscellaneous process_open2 cleanup J. Bruce Fields
2010-07-29 22:21 ` [PATCH 4/5] nfsd4: fix openmode checking on IO using lock stateid J. Bruce Fields
2010-07-29 22:21 ` [PATCH 5/5] nfsd4: share file descriptors between stateid's 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=20100730081041.GA4126@infradead.org \
    --to=hch@infradead.org \
    --cc=bfields@redhat.com \
    --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 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.