xfs
[Top] [All Lists]

Re: [PATCH 1/4] fs: add SEEK_HOLE and SEEK_DATA flags

To: Josef Bacik <josef@xxxxxxxxxx>
Subject: Re: [PATCH 1/4] fs: add SEEK_HOLE and SEEK_DATA flags
From: Marco Stornelli <marco.stornelli@xxxxxxxxx>
Date: Fri, 29 Jul 2011 11:58:47 +0200
Cc: linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-btrfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=RmPdPnbd6HnY/VP4rnBL1bHrbOb9LPtz+jNg1js4kR8=; b=LFUJ9alXHzQ4SUJKS1fU2pTzJAXpArrYE2vexWshHRbG94wPyyle6wZvT0LBw2fMk+ W/Eb5kKdVlYnGwqVpDwbKSXPZ5ZuOSnztuDcr+uuFdWMz7qYqEJanUN3R6gC08EyO8pB hkKlBC5mcriJF7IhAKJuGQeBVhXCIec9SVEGU=
In-reply-to: <1309275199-10801-1-git-send-email-josef@xxxxxxxxxx>
References: <1309275199-10801-1-git-send-email-josef@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11
Sorry maybe I'm a bit late? :)

Il 28/06/2011 17:33, Josef Bacik ha scritto:

  loff_t default_llseek(struct file *file, loff_t offset, int origin)
  {
+       struct inode *inode = file->f_path.dentry->d_inode;
        loff_t retval;

-       mutex_lock(&file->f_dentry->d_inode->i_mutex);
+       mutex_lock(&inode->i_mutex);
        switch (origin) {
                case SEEK_END:
-                       offset += i_size_read(file->f_path.dentry->d_inode);
+                       offset += i_size_read(inode);

Here we are under mutex, so I think we can use directly i_size without i_size_read.

Marco

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH 1/4] fs: add SEEK_HOLE and SEEK_DATA flags, Marco Stornelli <=