~ubuntu-branches/ubuntu/vivid/aufs/vivid

« back to all changes in this revision

Viewing changes to fs/aufs25/br_xfs.c

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2008-05-06 18:35:50 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080506183550-0b6c974kkgc46oeh
Tags: 0+20080506-1
* New upstream release, supports Kernel 2.6.25 (Closes: #479717)
* Fix building with older Kernels (Closes: #475042)
* Update the patches 01, 04 and 07 to also patch fs/aufs25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2008 Junjiro Okajima
 
3
 *
 
4
 * This program, aufs is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 */
 
18
 
 
19
/*
 
20
 * special handling inode attributes on XFS branch in linux-2.6.24 and later
 
21
 *
 
22
 * $Id: br_xfs.c,v 1.2 2008/04/21 01:33:00 sfjro Exp $
 
23
 */
 
24
 
 
25
#include "aufs.h"
 
26
 
 
27
/* h_mnt can be NULL, is it safe? */
 
28
dev_t au_h_rdev(struct inode *h_inode, struct vfsmount *h_mnt,
 
29
                struct dentry *h_dentry)
 
30
{
 
31
        dev_t rdev;
 
32
        int err;
 
33
        struct kstat st;
 
34
 
 
35
        LKTRTrace("hi%lu\n", h_inode->i_ino);
 
36
        if (h_dentry)
 
37
                LKTRTrace("%.*s\n", AuDLNPair(h_dentry));
 
38
 
 
39
        rdev = h_inode->i_rdev;
 
40
        if (!rdev || !au_test_xfs(h_inode->i_sb))
 
41
                goto out;
 
42
 
 
43
        rdev = 0;
 
44
        if (!h_dentry) {
 
45
                err = 0;
 
46
                h_dentry = d_find_alias(h_inode);
 
47
                if (unlikely(!h_dentry))
 
48
                        goto failure;
 
49
                err = PTR_ERR(h_dentry);
 
50
                if (IS_ERR(h_dentry)) {
 
51
                        h_dentry = NULL;
 
52
                        goto failure;
 
53
                }
 
54
                LKTRTrace("%.*s\n", AuDLNPair(h_dentry));
 
55
        } else
 
56
                dget(h_dentry);
 
57
 
 
58
        err = vfsub_getattr(h_mnt, h_dentry, &st, /*dlgt*/0);
 
59
        dput(h_dentry);
 
60
        if (!err) {
 
61
                rdev = st.rdev;
 
62
                goto out; /* success */
 
63
        }
 
64
 
 
65
 failure:
 
66
        AuIOErr("failed rdev for XFS inode, hi%lu, %d\n", h_inode->i_ino, err);
 
67
 out:
 
68
        return rdev;
 
69
}