From: Mike Waychison <mikew@google.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Mike Waychison <mikew@google.com>
Subject: [patch 3/6][RFC] Move FIBMAP logic
Date: Fri, 26 Oct 2007 16:37:35 -0700 [thread overview]
Message-ID: <20071026233848.447619470@crlf.corp.google.com> (raw)
In-Reply-To: <20071026233732.568575496@crlf.corp.google.com>
[-- Attachment #1: move_fibmap_logic.patch --]
[-- Type: text/plain, Size: 1539 bytes --]
Move FIBMAP logic out of file_ioctl() in preparation for introducing FIBMAP64.
Signed-off-by: Mike Waychison <mikew@google.com>
fs/ioctl.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
Index: linux-2.6.23/fs/ioctl.c
===================================================================
--- linux-2.6.23.orig/fs/ioctl.c 2007-10-26 15:26:11.000000000 -0700
+++ linux-2.6.23/fs/ioctl.c 2007-10-26 16:16:28.000000000 -0700
@@ -40,6 +40,21 @@ static long do_ioctl(struct file *filp,
return error;
}
+static int do_fibmap(struct address_space *mapping, sector_t block,
+ sector_t *phys_block)
+{
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+ if (!mapping->a_ops->bmap)
+ return -EINVAL;
+
+ lock_kernel();
+ *phys_block = mapping->a_ops->bmap(mapping, block);
+ unlock_kernel();
+
+ return 0;
+}
+
static int file_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -55,18 +70,14 @@ static int file_ioctl(struct file *filp,
sector_t phys_block;
int res;
/* do we support this mess? */
- if (!mapping->a_ops->bmap)
- return -EINVAL;
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
if ((error = get_user(block, p)) != 0)
return error;
if (block < 0)
return -EINVAL;
- lock_kernel();
- phys_block = mapping->a_ops->bmap(mapping, block);
- unlock_kernel();
+ error = do_fibmap(mapping, block, &phys_block);
+ if (error)
+ return error;
/* Make sure that the return value fits in the
* user's buffer. */
--
next prev parent reply other threads:[~2007-10-26 23:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-26 23:37 [patch 0/6][RFC] Cleanup FIBMAP Mike Waychison
2007-10-26 23:37 ` [patch 1/6][RFC] Keep FIBMAP from looking at negative block nrs Mike Waychison
2007-10-26 23:37 ` [patch 2/6][RFC] Allow FIBMAP to return EFBIG on large filesystems Mike Waychison
2007-10-26 23:37 ` Mike Waychison [this message]
2007-10-26 23:37 ` [patch 4/6][RFC] Attempt to plug race with truncate Mike Waychison
2007-10-29 13:36 ` Chris Mason
2007-10-26 23:37 ` [patch 5/6][RFC] Introduce FIBMAP64 Mike Waychison
2007-10-29 13:45 ` Chris Mason
2007-10-26 23:37 ` [patch 6/6][RFC] Drop CAP_SYS_RAWIO requirement on FIBMAP Mike Waychison
2007-10-27 17:57 ` [patch 0/6][RFC] Cleanup FIBMAP Anton Altaparmakov
2007-10-27 21:45 ` Szabolcs Szakacsits
2007-10-29 14:10 ` Chris Mason
2007-10-29 16:30 ` Zach Brown
2007-10-29 19:18 ` Mike Waychison
2007-10-29 19:46 ` Chris Mason
2007-10-29 20:01 ` Zach Brown
2007-10-29 20:00 ` Zach Brown
2007-10-31 11:06 ` Ric Wheeler
2007-10-31 16:16 ` Zach Brown
2007-10-31 17:17 ` Ric Wheeler
2007-10-29 19:16 ` Mike Waychison
2007-10-29 19:47 ` Andreas Dilger
2007-10-28 0:43 ` H. Peter Anvin
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=20071026233848.447619470@crlf.corp.google.com \
--to=mikew@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome