From: Christoph Hellwig <hch@infradead.org>
To: Anna Schumaker <schumaker.anna@gmail.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/2] nfs: remove ->write_pageio_init from rpc ops
Date: Tue, 18 Mar 2014 07:09:42 -0700 [thread overview]
Message-ID: <20140318140942.GB11672@infradead.org> (raw)
In-Reply-To: <532840E8.5090804@gmail.com>
> > + struct nfs_server *server = NFS_SERVER(inode);
> > + const struct nfs_pageio_ops *pg_ops = &nfs_pageio_write_ops;
> > +
> > +#if IS_ENABLED(CONFIG_NFS_V4)
> > + if (server->pnfs_curr_ld)
> > + pg_ops = server->pnfs_curr_ld->pg_write_ops;
> > +#endif
> > + nfs_pageio_init(pgio, inode, pg_ops, compl_ops, server->wsize, ioflags);
> > }
>
> I thought it was bad style to put a #ifdef in the middle of a function, which is why we have so many noop functions in the rest of the code. Should this be done with a select_compl_ops() function instead?
I don't think it's much of a problem for a small and readable function
with a single ifdef. And we'd need one helper for read and write each,
which would make the code much harder to read. Still better than what's
there currently, though.
The other option would be to simply always have the pnfs_curr_ld field
in the server structure and remove the ifdef entirely.
next prev parent reply other threads:[~2014-03-18 14:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-18 11:28 [PATCH 1/2] nfs: remove ->write_pageio_init from rpc ops Christoph Hellwig
2014-03-18 11:28 ` [PATHC 2/2] nfs: remove ->read_pageio_init " Christoph Hellwig
2014-03-18 12:49 ` [PATCH 1/2] nfs: remove ->write_pageio_init " Anna Schumaker
2014-03-18 14:09 ` Christoph Hellwig [this message]
2014-03-18 18:04 ` Anna Schumaker
2014-03-19 7:41 ` Christoph Hellwig
2014-03-19 13:11 ` Anna Schumaker
2014-03-19 15:40 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2014-04-16 13:07 pageio_init simplifications, V2 Christoph Hellwig
2014-04-16 13:07 ` [PATCH 1/2] nfs: remove ->write_pageio_init from rpc ops Christoph Hellwig
2014-04-17 14:50 ` Anna Schumaker
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=20140318140942.GB11672@infradead.org \
--to=hch@infradead.org \
--cc=linux-nfs@vger.kernel.org \
--cc=schumaker.anna@gmail.com \
--cc=trond.myklebust@primarydata.com \
/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).