From: Christoph Hellwig <hch@infradead.org>
To: Jan Kara <jack@suse.cz>
Cc: Ted Tso <tytso@mit.edu>, Christoph Hellwig <hch@infradead.org>,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH v3] ext4: Rewrite ext4_page_mkwrite() to use generic helpers
Date: Thu, 23 Jun 2011 06:39:37 -0400 [thread overview]
Message-ID: <20110623103937.GB5171@infradead.org> (raw)
In-Reply-To: <1308767062-27695-1-git-send-email-jack@suse.cz>
> loff_t size;
> unsigned long len;
> + int ret;
> struct file *file = vma->vm_file;
> struct inode *inode = file->f_path.dentry->d_inode;
> struct address_space *mapping = inode->i_mapping;
> + handle_t *handle;
> + get_block_t *get_block;
> + int retries = 0;
>
> /*
> + * This check is racy but catches the common case. We rely on
> + * __block_page_mkwrite() to do a reliable check.
> */
> + vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
> + /* Delalloc case is easy... */
> + if (test_opt(inode->i_sb, DELALLOC) &&
> + !ext4_should_journal_data(inode) &&
> + !ext4_nonda_switch(inode->i_sb)) {
> + do {
> + ret = __block_page_mkwrite(vma, vmf,
> + ext4_da_get_block_prep);
> + } while (ret == -ENOSPC &&
> + ext4_should_retry_alloc(inode->i_sb, &retries));
> + goto out_ret;
Is there any way to simply provide a different vm_operations_struct
and thus ->fault implementation for the delalloc vs non-delalloc case?
I think splitting those two cases completely would make the code a lot
more readable, even if there is a tiny amount of code duplication.
next prev parent reply other threads:[~2011-06-23 10:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 18:24 [PATCH v3] ext4: Rewrite ext4_page_mkwrite() to use generic helpers Jan Kara
2011-06-22 19:30 ` Eric Sandeen
2011-06-23 10:39 ` Christoph Hellwig [this message]
2011-06-23 11:09 ` Jan Kara
2011-06-23 11:51 ` Christoph Hellwig
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=20110623103937.GB5171@infradead.org \
--to=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.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;
as well as URLs for NNTP newsgroup(s).