LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Pekka Enberg" <penberg@cs.helsinki.fi>
To: "Takashi Sato" <t-sato@yk.jp.nec.com>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Christoph Hellwig" <hch@lst.de>
Subject: Re: [RFC] ext3 freeze feature
Date: Fri, 25 Jan 2008 13:17:34 +0200	[thread overview]
Message-ID: <84144f020801250317pbdafc4fnd47cc8a297194e86@mail.gmail.com> (raw)
In-Reply-To: <20080125195938t-sato@mail.jp.nec.com>

Hi,

> diff -uprN -X linux-2.6.24-rc8/Documentation/dontdiff linux-2.6.24-rc8/include/linux/ext3_fs_sb.h linux-2.6.24-rc8-freeze/include/linux/ext3_fs_sb.h
> --- linux-2.6.24-rc8/include/linux/ext3_fs_sb.h 2008-01-16 13:22:48.000000000 +0900
> +++ linux-2.6.24-rc8-freeze/include/linux/ext3_fs_sb.h  2008-01-22 18:20:33.000000000 +0900
> @@ -81,6 +81,8 @@ struct ext3_sb_info {
>         char *s_qf_names[MAXQUOTAS];            /* Names of quota files with journalled quota */
>         int s_jquota_fmt;                       /* Format of quota to use */
>  #endif
> +       /* Delayed work for freeze */
> +       struct delayed_work s_freeze_timeout;

Why not put this in struct super_block? Then you don't need this

> +/**
> + * get_super_block - get super_block
> + * @s_fs_info  : filesystem dependent information
> + *               (super_block.s_fs_info)
> + *
> + * Get super_block which holds s_fs_info from super_blocks.
> + * get_super_block() returns a pointer of super block or
> + * %NULL if it have failed.
> + */
> +struct super_block *get_super_block(void *s_fs_info)
> +{

And these can be put to generic code:

>  /*
> + * ext3_add_freeze_timeout - Add timeout for ext3 freeze.
> + *
> + * @sbi                        : ext3 super block
> + * @timeout_msec       : timeout period
> + *
> + * Add the delayed work for ext3 freeze timeout
> + * to the delayed work queue.
> + */
> +void ext3_add_freeze_timeout(struct ext3_sb_info *sbi,
> +                       long timeout_msec)
> +{
> +       s64 timeout_jiffies = msecs_to_jiffies(timeout_msec);
> +
> +       /*
> +        * setup freeze timeout function
> +        */
> +       INIT_DELAYED_WORK(&sbi->s_freeze_timeout, ext3_freeze_timeout);
> +
> +       /* set delayed work queue */
> +       cancel_delayed_work(&sbi->s_freeze_timeout);
> +       schedule_delayed_work(&sbi->s_freeze_timeout, timeout_jiffies);
> +}
> +
> +/*
> + * ext3_del_freeze_timeout - Delete timeout for ext3 freeze.
> + *
> + * @sbi        : ext3 super block
> + *
> + * Delete the delayed work for ext3 freeze timeout
> + * from the delayed work queue.
> + */
> +void ext3_del_freeze_timeout(struct ext3_sb_info *sbi)
> +{
> +       if (delayed_work_pending(&sbi->s_freeze_timeout))
> +               cancel_delayed_work(&sbi->s_freeze_timeout);
> +}

> +/*
> + * ext3_freeze_timeout - Thaw the filesystem.
> + *
> + * @work       : work queue (delayed_work.work)
> + *
> + * Called by the delayed work when elapsing the timeout period.
> + * Thaw the filesystem.
> + */
> +static void ext3_freeze_timeout(struct work_struct *work)
> +{
> +       struct ext3_sb_info *sbi = container_of(work,
> +                               struct ext3_sb_info,
> +                               s_freeze_timeout.work);
> +       struct super_block *sb = get_super_block(sbi);
> +
> +       BUG_ON(sb == NULL);
> +
> +       if (sb->s_frozen != SB_UNFROZEN)
> +               thaw_bdev(sb->s_bdev, sb);
> +}
> +

I am also wondering whether we should have system call(s) for these:

On Jan 25, 2008 12:59 PM, Takashi Sato <t-sato@yk.jp.nec.com> wrote:
> +       case EXT3_IOC_FREEZE: {

> +       case EXT3_IOC_THAW: {

And just convert XFS to use them too?

                        Pekka

  reply	other threads:[~2008-01-25 11:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-25 10:59 Takashi Sato
2008-01-25 11:17 ` Pekka Enberg [this message]
2008-01-25 12:42   ` Takashi Sato
2008-01-26  5:17     ` David Chinner
2008-01-26 19:10     ` Christoph Hellwig
2008-01-25 12:18 ` Dmitri Monakhov
2008-01-25 13:33   ` Theodore Tso
2008-01-25 16:34     ` Eric Sandeen
2008-01-25 16:42       ` Theodore Tso
2008-02-02 13:52         ` Pavel Machek
2008-01-28 13:13     ` Takashi Sato
2008-02-01  3:03       ` Kazuto Miyoshi
2008-01-31  8:53     ` Daniel Phillips
2008-02-07  1:05     ` Takashi Sato
2008-02-08 10:48     ` Takashi Sato
2008-02-08 13:26       ` Andreas Dilger
2008-02-08 14:59         ` Christoph Hellwig
2008-02-15 11:51           ` Takashi Sato
2008-02-15 14:24             ` Eric Sandeen
2008-02-19 11:27               ` t-sato
2008-02-26  8:20                 ` [RFC] ext3 freeze feature ver 0.2 Takashi Sato
2008-02-26 16:39                   ` Eric Sandeen
2008-02-26 17:08                     ` Andreas Dilger
2008-02-27  8:31                       ` Takashi Sato
2008-03-07  9:13                 ` [RFC] freeze feature ver 1.0 Takashi Sato
2008-02-16 13:25             ` [RFC] ext3 freeze feature Christoph Hellwig
2008-02-13  8:23     ` Takashi Sato
2008-01-26  5:35 ` David Chinner
2008-01-26  5:39   ` David Chinner
2008-01-28 13:07   ` Takashi Sato

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=84144f020801250317pbdafc4fnd47cc8a297194e86@mail.gmail.com \
    --to=penberg@cs.helsinki.fi \
    --cc=hch@lst.de \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=t-sato@yk.jp.nec.com \
    --subject='Re: [RFC] ext3 freeze feature' \
    /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

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).