From: Christoph Hellwig <hch@infradead.org>
To: Vaughan Cao <vaughan.cao@oracle.com>
Cc: James.Bottomley@HansenPartnership.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] notify block layer when using temporary change to cache_type
Date: Wed, 28 May 2014 04:23:29 -0700 [thread overview]
Message-ID: <20140528112329.GA11953@infradead.org> (raw)
In-Reply-To: <1401253107-16138-1-git-send-email-vaughan.cao@oracle.com>
On Wed, May 28, 2014 at 12:58:27PM +0800, Vaughan Cao wrote:
> No, I just want to keep the modification as small as possible. Checked
> the actions of sd_revalidate_disk() again, it seems no harm to call it
> from here. Also actual actions are skipped in sd_read_cache_type() if
> cache_override!=0, so I suppose your original plan is to jump to
> sd_revalidate_disk() from here.
I think the right fix is to factor out a helper like:
static void sd_set_flush_flag(struct scsi_disk *sdkp)
{
unsigned flush = 0;
if (sdkp->WCE) {
flush |= REQ_FLUSH;
if (sdkp->DPOFUA)
flush |= REQ_FUA;
}
blk_queue_flush(sdkp->disk->queue, flush);
}
which can be called from sd_revalidate_disk and cache_type_store.
>
> However, that way may not be acceptable after further code review.
> Changing the sdkp->WCE,RCD will cause these real parameters of the
> underlying device *lost*. In sd_shutdown() and sd_suspend_common(), we
> need them to call sd_sync_cache() if necessary. I don't think this
> action is avoidable, just for the performance issue to solve. And we
> can't change the mode just by setting q->flush_flags while leave
> sdkp->WCE,RCD untouched either, because cache_type_show() needs
> sdkp->WCE,RCD to present the temporary config to userspace.
If the user overrides the cache type he should expect data not to be
flushed, so I don't really think this is na issue. Even if it is it
should be a separate issue as it already exists before your patch.
prev parent reply other threads:[~2014-05-28 11:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 11:39 [PATCH] notify block layer when using temporary change to cache_type Vaughan Cao
2014-05-27 16:18 ` James Bottomley
2014-05-28 4:58 ` Vaughan Cao
2014-05-28 11:23 ` Christoph Hellwig [this message]
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=20140528112329.GA11953@infradead.org \
--to=hch@infradead.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=vaughan.cao@oracle.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).