Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177395
b: refs/heads/master
c: 306bb73
h: refs/heads/master
i:
  177393: 65c310d
  177391: 9502b05
v: v3
  • Loading branch information
Al Viro committed Dec 16, 2009
1 parent 75dddbb commit b099a98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6de88d72927dc85297b3075024487313c4ba3a2e
refs/heads/master: 306bb73d12f13684ffcd735838c3e6f7515ab626
46 changes: 5 additions & 41 deletions trunk/drivers/staging/dst/dcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static void dst_node_cleanup(struct dst_node *n)

if (n->bdev) {
sync_blockdev(n->bdev);
blkdev_put(n->bdev, FMODE_READ|FMODE_WRITE);
close_bdev_exclusive(n->bdev, FMODE_READ|FMODE_WRITE);
}

dst_state_lock(st);
Expand Down Expand Up @@ -463,37 +463,6 @@ void dst_node_put(struct dst_node *n)
}
}

/*
* This function finds devices major/minor numbers for given pathname.
*/
static int dst_lookup_device(const char *path, dev_t *dev)
{
int err;
struct nameidata nd;
struct inode *inode;

err = path_lookup(path, LOOKUP_FOLLOW, &nd);
if (err)
return err;

inode = nd.path.dentry->d_inode;
if (!inode) {
err = -ENOENT;
goto out;
}

if (!S_ISBLK(inode->i_mode)) {
err = -ENOTBLK;
goto out;
}

*dev = inode->i_rdev;

out:
path_put(&nd.path);
return err;
}

/*
* Setting up export device: lookup by the name, get its size
* and setup listening socket, which will accept clients, which
Expand All @@ -503,17 +472,12 @@ static int dst_setup_export(struct dst_node *n, struct dst_ctl *ctl,
struct dst_export_ctl *le)
{
int err;
dev_t dev = 0; /* gcc likes to scream here */

snprintf(n->info->local, sizeof(n->info->local), "%s", le->device);

err = dst_lookup_device(le->device, &dev);
if (err)
return err;

n->bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE);
if (!n->bdev)
return -ENODEV;
n->bdev = open_bdev_exclusive(le->device, FMODE_READ|FMODE_WRITE, NULL);
if (IS_ERR(n->bdev))
return PTR_ERR(n->bdev);

if (n->size != 0)
n->size = min_t(loff_t, n->bdev->bd_inode->i_size, n->size);
Expand All @@ -528,7 +492,7 @@ static int dst_setup_export(struct dst_node *n, struct dst_ctl *ctl,
return 0;

err_out_cleanup:
blkdev_put(n->bdev, FMODE_READ|FMODE_WRITE);
close_bdev_exclusive(n->bdev, FMODE_READ|FMODE_WRITE);
n->bdev = NULL;

return err;
Expand Down

0 comments on commit b099a98

Please sign in to comment.