#include "../h/smp_lock.h"
#endif
+#ifdef pgoff2loff
+#define pageoff(pp) pgoff2loff((pp)->index)
+#else
+#define pageoff(pp) pp->offset
+#endif
+
extern struct vcache *afs_globalVp;
extern struct dentry_operations *afs_dops;
/* filldir returns -EINVAL when the buffer is full. */
#ifdef AFS_LINUX24_ENV
- code = (*filldir)(dirbuf, de->name, len, offset, ino, DT_DIR);
+ code = (*filldir)(dirbuf, de->name, len, offset, ino, DT_UNKNOWN);
#else
code = (*filldir)(dirbuf, de->name, len, offset, ino);
#endif
/* afs_dentry_iput */
static void afs_dentry_iput(struct dentry *dp, struct inode *ip)
{
-#if defined(AFS_LINUX24_ENV)
- if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) {
-#else
- if (ip->i_count == 0 || ip->i_count & 0xffff0000) {
-#endif
- osi_Panic("Bad refCount %d on inode 0x%x\n",
-#if defined(AFS_LINUX24_ENV)
- atomic_read(&ip->i_count), ip);
-#else
- ip->i_count, ip);
-#endif
- }
-#if defined(AFS_LINUX24_ENV)
- atomic_dec(&ip->i_count);
- if (!atomic_read(&ip->i_count)) {
-#else
- ip->i_count --;
- if (!ip->i_count) {
-#endif
- afs_delete_inode(ip);
- }
+ osi_iput(ip);
}
#if defined(AFS_LINUX24_ENV)
AFS_GLOCK();
code = afs_rmdir((struct vcache*)dip, name, credp);
- /* Linux likes to see ENOTDIR returned from an rmdir() syscall
+ /* Linux likes to see ENOTEMPTY returned from an rmdir() syscall
* that failed because a directory is not empty. So, we map
- * EEXIST to ENOTDIR on linux.
+ * EEXIST to ENOTEMPTY on linux.
*/
if (code == EEXIST) {
- code = ENOTDIR;
+ code = ENOTEMPTY;
}
if (!code) {
setup_uio(&tuio, &iovec, (char*)address, pp->index << PAGE_CACHE_SHIFT,
PAGESIZE, UIO_READ, AFS_UIOSYS);
#else
- setup_uio(&tuio, &iovec, (char*)address, pp->offset, PAGESIZE,
+ setup_uio(&tuio, &iovec, (char*)address, pageoff(pp), PAGESIZE,
UIO_READ, AFS_UIOSYS);
#endif
-#ifdef AFS_LINUX24_ENV
+#if defined(AFS_LINUX24_ENV)
lock_kernel();
#endif
code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp);
-#ifdef AFS_LINUX24_ENV
+#if defined(AFS_LINUX24_ENV)
unlock_kernel();
#endif
memset((void*)(address+(PAGESIZE-tuio.uio_resid)), 0,
tuio.uio_resid);
#if defined(AFS_LINUX24_ENV)
+#ifndef __powerpc__
+ flush_dcache_page(pp);
+#endif
SetPageUptodate(pp);
#else
set_bit(PG_uptodate, &pp->flags);
UnlockPage(pp);
#else
clear_bit(PG_locked, &pp->flags);
-#endif
wake_up(&pp->wait);
+#endif
free_page(address);
crfree(credp);
if (pp->index >= end_index+1 || !offset)
return -EIO;
do_it:
+ AFS_GLOCK();
status = afs_linux_writepage_sync(inode, pp, 0, offset);
+ AFS_GUNLOCK();
SetPageUptodate(pp);
UnlockPage(pp);
/* kunmap(pp); */
int f_flags = 0;
credp = crref();
- AFS_GLOCK();
- lock_kernel();
afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
ICL_TYPE_POINTER, pp,
ICL_TYPE_INT32, atomic_read(&pp->count),
ICL_TYPE_INT32, atomic_read(&pp->count),
ICL_TYPE_INT32, code);
- unlock_kernel();
- AFS_GUNLOCK();
crfree(credp);
return code;
ICL_TYPE_POINTER, pp,
ICL_TYPE_INT32, atomic_read(&pp->count),
ICL_TYPE_INT32, 99999);
- setup_uio(&tuio, &iovec, page_addr + offset, pp->offset + offset, count,
+ setup_uio(&tuio, &iovec, page_addr + offset, pageoff(pp) + offset, count,
UIO_WRITE, AFS_UIOSYS);
code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
{
long status;
- /* lock_kernel(); */
+ AFS_GLOCK();
+ lock_kernel();
status = afs_linux_updatepage(file, page, offset, to-offset);
- /* unlock_kernel(); */
+ unlock_kernel();
+ AFS_GUNLOCK();
kunmap(page);
return status;