-/*
- * ext2_delete_entry deletes a directory entry by merging it with the
- * previous entry. Page is up-to-date. Releases the page.
- */
-int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
-{
- struct address_space *mapping = page->mapping;
- struct inode *inode = mapping->host;
- char *kaddr = page_address(page);
- unsigned from = ((char*)dir - kaddr) & ~(ext2_chunk_size(inode)-1);
- unsigned to = ((char*)dir - kaddr) + le16_to_cpu(dir->rec_len);
- ext2_dirent * pde = NULL;
- ext2_dirent * de = (ext2_dirent *) (kaddr + from);
- int err;
-
- while ((char*)de < (char*)dir) {
- pde = de;
- de = ext2_next_entry(de);
- }
- if (pde)
- from = (char*)pde - (char*)page_address(page);
- lock_page(page);
- err = mapping->a_ops->prepare_write(NULL, page, from, to);
- if (err)
- BUG();
- if (pde)
- pde->rec_len = cpu_to_le16(to-from);
- dir->inode = 0;
- inode->i_ctime = inode->i_mtime = CURRENT_TIME;
- err = ext2_commit_chunk(page, from, to);
- UnlockPage(page);
- ext2_put_page(page);
- return err;
+ EXIT;
+ out_req:
+ ptlrpc_req_finished(request);
+ out_name:
+ putname(filename);
+ return rc;
+ }
+ case OBD_IOC_PING: {
+ struct ptlrpc_request *req = NULL;
+ char *buf = NULL;
+ int rc, len=0;
+ struct client_obd *cli;
+ struct obd_device *obd;
+
+ rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
+ if (rc)
+ RETURN(rc);
+ data = (void *)buf;
+
+ obd = class_name2obd(data->ioc_inlbuf1);
+
+ if (!obd )
+ GOTO(out_ping, rc = -ENODEV);
+
+ if (!obd->obd_attached) {
+ CERROR("Device %d not attached\n", obd->obd_minor);
+ GOTO(out_ping, rc = -ENODEV);
+ }
+ if (!obd->obd_set_up) {
+ CERROR("Device %d still not setup\n", obd->obd_minor);
+ GOTO(out_ping, rc = -ENODEV);
+ }
+ cli = &obd->u.cli;
+ req = ptlrpc_prep_req(cli->cl_import, OBD_PING, 0, NULL, NULL);
+ if (!req)
+ GOTO(out_ping, rc = -ENOMEM);
+
+ req->rq_replen = lustre_msg_size(0, NULL);
+ req->rq_send_state = LUSTRE_IMP_FULL;
+
+ rc = ptlrpc_queue_wait(req);
+
+ ptlrpc_req_finished(req);
+ out_ping:
+ obd_ioctl_freedata(buf, len);
+ return rc;
+ }
+ case OBD_IOC_LLOG_CATINFO: {
+ struct ptlrpc_request *req = NULL;
+ char *buf = NULL;
+ int rc, len = 0;
+ char *bufs[2], *str;
+ int lens[2], size;
+
+ rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
+ if (rc)
+ RETURN(rc);
+ data = (void *)buf;
+
+ if (!data->ioc_inlbuf1) {
+ obd_ioctl_freedata(buf, len);
+ RETURN(-EINVAL);
+ }
+
+ lens[0] = data->ioc_inllen1;
+ bufs[0] = data->ioc_inlbuf1;
+ if (data->ioc_inllen2) {
+ lens[1] = data->ioc_inllen2;
+ bufs[1] = data->ioc_inlbuf2;
+ } else {
+ lens[1] = 0;
+ bufs[1] = NULL;
+ }
+ size = data->ioc_plen1;
+ req = ptlrpc_prep_req(sbi2mdc(sbi)->cl_import, LLOG_CATINFO,
+ 2, lens, bufs);
+ if (!req)
+ GOTO(out_catinfo, rc = -ENOMEM);
+ req->rq_replen = lustre_msg_size(1, &size);
+
+ rc = ptlrpc_queue_wait(req);
+ str = lustre_msg_string(req->rq_repmsg, 0, data->ioc_plen1);
+ if (!rc)
+ rc = copy_to_user(data->ioc_pbuf1, str,
+ data->ioc_plen1);
+ ptlrpc_req_finished(req);
+ out_catinfo:
+ obd_ioctl_freedata(buf, len);
+ RETURN(rc);
+ }
+ default:
+ return obd_iocontrol(cmd, sbi->ll_osc_exp,0,NULL,(void *)arg);
+ }