From: Tejun Heo <htejun@gmail.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
Jeff Garzik <jeff@garzik.org>,
"Maciej W. Rozycki" <macro@linux-mips.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm] libata-core: convert to use cancel_rearming_delayed_work()
Date: Fri, 11 May 2007 16:18:42 +0200 [thread overview]
Message-ID: <46447B42.3020302@gmail.com> (raw)
In-Reply-To: <20070505221709.GA3955@tv-sign.ru>
Hello,
Oleg Nesterov wrote:
> void ata_port_queue_task(struct ata_port *ap, work_func_t fn, void *data,
> unsigned long delay)
> {
> - int rc;
> -
> - if (ap->pflags & ATA_PFLAG_FLUSH_PORT_TASK)
> - return;
> -
> PREPARE_DELAYED_WORK(&ap->port_task, fn);
> ap->port_task_data = data;
>
> - rc = queue_delayed_work(ata_wq, &ap->port_task, delay);
> -
> - /* rc == 0 means that another user is using port task */
> - WARN_ON(rc == 0);
> + /* may fail if ata_port_flush_task() in progress */
> + queue_delayed_work(ata_wq, &ap->port_task, delay);
> }
I don't really think ata_port_queue_task() deserves to live after this.
Feel free to kill it.
> void ata_port_flush_task(struct ata_port *ap)
> {
> - unsigned long flags;
> -
> DPRINTK("ENTER\n");
>
> - spin_lock_irqsave(ap->lock, flags);
> - ap->pflags |= ATA_PFLAG_FLUSH_PORT_TASK;
> - spin_unlock_irqrestore(ap->lock, flags);
> -
> - DPRINTK("flush #1\n");
> - cancel_work_sync(&ap->port_task.work); /* akpm: seems unneeded */
> -
> - /*
> - * At this point, if a task is running, it's guaranteed to see
> - * the FLUSH flag; thus, it will never queue pio tasks again.
> - * Cancel and flush.
> - */
> - if (!cancel_delayed_work(&ap->port_task)) {
> - if (ata_msg_ctl(ap))
> - ata_port_printk(ap, KERN_DEBUG, "%s: flush #2\n",
> - __FUNCTION__);
> - cancel_work_sync(&ap->port_task.work);
> - }
> -
> - spin_lock_irqsave(ap->lock, flags);
> - ap->pflags &= ~ATA_PFLAG_FLUSH_PORT_TASK;
> - spin_unlock_irqrestore(ap->lock, flags);
> + cancel_rearming_delayed_work(&ap->port_task);
Nor does ata_port_flush_task().
> @@ -6094,13 +6064,7 @@ void ata_port_detach(struct ata_port *ap
> spin_unlock_irqrestore(ap->lock, flags);
>
> ata_port_wait_eh(ap);
> -
> - /* Flush hotplug task. The sequence is similar to
> - * ata_port_flush_task().
> - */
> - cancel_work_sync(&ap->hotplug_task.work); /* akpm: why? */
> - cancel_delayed_work(&ap->hotplug_task);
> - cancel_work_sync(&ap->hotplug_task.work);
> + cancel_rearming_delayed_work(&ap->hotplug_task);
Yay, I've always wanted to do that. :-)
Thanks.
--
tejun
prev parent reply other threads:[~2007-05-11 14:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-05 22:17 [PATCH -mm] libata-core: convert to use cancel_rearming_delayed_work() Oleg Nesterov
2007-05-11 14:18 ` Tejun Heo [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=46447B42.3020302@gmail.com \
--to=htejun@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@linux-mips.org \
--cc=oleg@tv-sign.ru \
/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