mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Plumb <colin@nyx.net>
To: linux-kernel@vger.rutgers.edu
Subject: Re: fsync on large files
Date: Fri, 19 Feb 1999 01:51:37 -0700 (MST)	[thread overview]
Message-ID: <199902190851.BAA04158@nyx10.nyx.net> (raw)

Regarding the shared-metadata problem, here's a possible solution.

People have pointed out that you can just put all the shared metadata
on a single list and write it all out on each fsync.

The observation here is that syncing more data than required preserves
correctness; the only cost is to efficiency.

To achieve a similar effect with higher efficiency, you can use a Bloom
filter.

When you modify shared data based on inode n, you hash n into a hash
value with two bits set.  Then you OR that hash into a mask word
associated with the block.  (It might be in the otherwise unused inode
number slot, for example.)

When it comes time to fsync the inode, you walk the list of shared
blocks, testing if (hash & mask) == hash.  (I.e. !(hash & ~mask).)
This is always true if the block contains modifications pertaining
to inode n, because the hash was ORed in.  If the block does not
contain such modifications, it probably doesn't match.

You have to choose the number of bits set in the hash in combination
with the number of different inodes that will have interest in a block
to optimize the effectiveness of the filter, but any reasonable scheme
will get rid of a great many of the false alarms.

It's a fast, clever and elegant technique.
-- 
	-Colin

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

                 reply	other threads:[~1999-02-19  7:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=199902190851.BAA04158@nyx10.nyx.net \
    --to=colin@nyx.net \
    --cc=linux-kernel@vger.rutgers.edu \
    /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

all inboxes | Powered by JetHome®